help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling optional argument with t value


From: Jean Louis
Subject: Re: Handling optional argument with t value
Date: Mon, 5 Dec 2022 22:16:49 +0300
User-agent: Mutt/2.2.9+54 (af2080d) (2022-11-21)

* 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 via email to

[Prev in Thread] Current Thread [Next in Thread]