From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Some Emacs outside Emacs Date: Fri, 29 Jul 2022 10:37:04 -0400 Message-ID: References: <87sfml692a.fsf@elite.giraud> <87wnbx39vl.fsf@elite.giraud> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20613"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Andreas Schwab , "emacs-devel" To: Manuel Giraud Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 29 16:37:56 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oHR7k-00057X-7H for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Jul 2022 16:37:56 +0200 Original-Received: from localhost ([::1]:40306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHR7i-0005KG-KT for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Jul 2022 10:37:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHR73-0004bE-JP for emacs-devel@gnu.org; Fri, 29 Jul 2022 10:37:13 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12104) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHR70-0008L3-7c for emacs-devel@gnu.org; Fri, 29 Jul 2022 10:37:12 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1EE0F4412AB; Fri, 29 Jul 2022 10:37:09 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 84AD44414DC; Fri, 29 Jul 2022 10:37:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1659105427; bh=47YG9vhTJEna9HEr5Wv3c+yLSlRcphTLWVNzQDGm0L0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=GUubxqfu0PMq+E7deSwl2h/5r/Fy0gssok/6A1L2VsABSlNzmgTd6V1eSfqv4wBHD NHFaY84kEmrANCosNnx8l6Zpu126Igcdr1tTxriZQ1lHfCZpIF21zrfbYj0ALfHgH/ cZYMClvCh6HlA/2PFMLKLolPcZeoVO4hMRMI+eior+lM6DGguSr3pgRV/v+6nMwi2z FGF8ijvZDg7wnfIaFirWe3jrh3gLoiFyAaUcy9cmyI0FfblZPEBbmOEXFzsDTPsivC 1FDRfjZsWZonPgpM0vPPAH3oyFt0AjPAkhl5D7pXbxTMOGdTiGFoaqjVt3R1ifmDgU nDCGFyUVfDMBQ== Original-Received: from milanesa (dyn.144-85-172-183.dsl.vtx.ch [144.85.172.183]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C117E120164; Fri, 29 Jul 2022 10:37:06 -0400 (EDT) In-Reply-To: <87wnbx39vl.fsf@elite.giraud> (Manuel Giraud's message of "Thu, 28 Jul 2022 10:43:42 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:292837 Archived-At: > --8<---------------cut here---------------start------------->8--- > Lisp_Object frame; > XFontSet fs; > > frame = menu_bar_to_frame(mw); > if (FRAMEP (frame)) > fs = FRAME_XIC_FONTSET (XFRAME (frame)); > --8<---------------cut here---------------end--------------->8--- Style comment: I recommend you try to initialize your variables directly in their declaration, as in: Lisp_Object frame = menu_bar_to_frame(mw); XFontSet fs = (FRAMEP (frame) ? FRAME_XIC_FONTSET (XFRAME (frame)) : ...); This eliminates the possibility of having the variable be uninitialized, and reduces the "risk" of leaving a unused variable declaration. It also often results in more concise code. Stefan