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: Heime
Subject: Re: Handling optional argument with t value
Date: Mon, 05 Dec 2022 20:09:38 +0000

------- Original Message -------
On Monday, December 5th, 2022 at 7:16 PM, Jean Louis <bugs@gnu.support> wrote:


> * 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.

I need some advice on how to handle optional arguments, where one either 
does not pass it or passes t.

For instance, should I put a default for it, as in (setq kpact (or kpact nil)) ?

Or handle things with a "when", or using some other combination ?

(defun ticker-hour (lampkl &optional kpact)

  (setq kpact (or kpact nil))
  (when () )
)




reply via email to

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