unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Handling optional argument with t value
Date: Mon, 5 Dec 2022 22:16:49 +0300	[thread overview]
Message-ID: <Y45DoWLdxDxw9NPE@protected.localdomain> (raw)
In-Reply-To: <ZLirSnqURtzcLUuxl7E7uPdgU5w9vHpDiJdNzqp9CtOwzFdWUyfLqQsybeWNBWQzVAnBD4trjznM3emUmGU_X_nZ37lPWuLPTh_S9GnT0SI=@protonmail.com>

* Heime <heimeborgia@protonmail.com> [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/



  reply	other threads:[~2022-12-05 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-04 23:01 Handling optional argument with t value Heime
2022-12-05 19:16 ` Jean Louis [this message]
2022-12-05 20:09   ` Heime
2022-12-05 23:03     ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y45DoWLdxDxw9NPE@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).