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

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

RE: [External] : Re: Functions with multiple optional arguments


From: Heime
Subject: RE: [External] : Re: Functions with multiple optional arguments
Date: Mon, 17 Oct 2022 17:28:57 +0000

------- Original Message -------
On Monday, October 17th, 2022 at 4:52 PM, Drew Adams <drew.adams@oracle.com> 
wrote:


> > I want the last argument to use a symbol. Would you be so kind to scrutinise
> > my implementation please.
> > 
> > (defun mesgb (mesg &optional bufr actm)
> > "Display message except on 'nogo symbol."
> > (let ((bfr (or bufr "Gundit"))
> > (acm (or actm 'go)))
> > 
> > (when (not (eq 'nogo acm))
> > (with-current-buffer (get-buffer-create bfr)
> > (org-mode)
> > (insert mesg))) ))
> 
> 
> (defun mesgb (message &optional buffer actm)
> "Show MESSAGE, unless ACTM is the symbol `nogo'."
> (setq buffer (or buffer "Gundit")
> actm (or actm 'go))
> (unless (eq 'actm 'nogo)
> (with-current-buffer (get-buffer-create buffer))
> (org-mode)
> (insert message))))

Your adaptation is much neater.  Did not realise that equality 
on symbols should be (eq 'actm 'nogo) rather than (eq actm 'nogo).
Do you have time to describe what does wrong with (eq actm 'nogo)?
 




reply via email to

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