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

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

Handling optional argument with t value


From: Heime
Subject: Handling optional argument with t value
Date: Sun, 04 Dec 2022 23:01:21 +0000

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.  

Does the use of (unless kpact  (insert " ")) do the job or am I missing some 
possible
condition that might occur?

(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"))))))









reply via email to

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