From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Handling optional argument with t value Date: Mon, 5 Dec 2022 22:16:49 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4829"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.2.9+54 (af2080d) (2022-11-21) Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 05 20:23:17 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1p2H3c-00012K-Pi for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 05 Dec 2022 20:23:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2H2v-0007e4-7q; Mon, 05 Dec 2022 14:22:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2H2u-0007ce-6z for help-gnu-emacs@gnu.org; Mon, 05 Dec 2022 14:22:32 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2H2s-0007k9-DI for help-gnu-emacs@gnu.org; Mon, 05 Dec 2022 14:22:31 -0500 Original-Received: from localhost ([::ffff:102.87.201.197]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000055EAB.00000000638E44F6.00001B02; Mon, 05 Dec 2022 12:22:29 -0700 Mail-Followup-To: Heime , Heime via Users list for the GNU Emacs text editor Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141409 Archived-At: * Heime [2022-12-05 02:02]: > I have this function to which I am adding the capability to print a > compact version that excludes the whitespace. Thus I include an > optional argument "kpact", so that when it is set to t, the (insert > " ") in excluded. Is this a good strategy. "To print a compact version..." compact version of what? I understand you wish to print propertized version of some symbol. If it is good strategy or not, I guess you are the one to decide. Because it is with special background, I would insert space before and after, to make it more indicative or to make it more visible. > Does the use of (unless kpact (insert " ")) do the job or am I > missing some possible condition that might occur? You missed to express better what you wish to achieve. (defun ticker-hour (lampkl &optional kpact) "TODO." (interactive) (unless kpact (insert " ")) (cond ((eq 'magenta lampkl) (insert (propertize "⚒" 'font-lock-face '(:background "#FF29FF" :foreground "black")))) ((eq 'red lampkl) (insert (propertize "⚒" 'font-lock-face '(:background "#B30000" :foreground "black")))))) (ticker-hour 'magenta) ⚒ (ticker-hour 'red) ⚒ Heime, don't give up. 🔧 -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/