GNU bug report logs - #67669
29.1; Drop text suggesting using `and' to replace `if'

Previous Next

Package: emacs;

Reported by: Xiyue Deng <manphiz <at> gmail.com>

Date: Wed, 6 Dec 2023 21:48:01 UTC

Severity: normal

Found in version 29.1

Done: Xiyue Deng <manphiz <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 67669 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Xiyue Deng <manphiz <at> gmail.com>
Cc: 67669 <at> debbugs.gnu.org
Subject: Re: bug#67669: 29.1; Drop text suggesting using `and' to replace `if'
Date: Thu, 07 Dec 2023 12:16:00 +0200
> From: Xiyue Deng <manphiz <at> gmail.com>
> Cc: 67669 <at> debbugs.gnu.org
> Date: Thu, 07 Dec 2023 01:08:51 -0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > AFAIU, the relevant fragment is:
> >
> >      The expression looks like this:
> >
> > 	 (if interprogram-cut-function
> > 	     (funcall interprogram-cut-function string (not replace))))
> >
> >      If an ‘interprogram-cut-function’ exists, then Emacs executes
> >   ‘funcall’, which in turn calls its first argument as a function and
> >   passes the remaining arguments to it.  (Incidentally, as far as I can
> >   see, this ‘if’ expression could be replaced by an ‘and’ expression
> >   similar to the one in the first part of the function.)
> >
> > I don't see anything wrong here.  Can you elaborate on why you think
> > the text in parentheses is inaccurate or incorrect or unclear?
> 
> Sorry I wasn't very clear.  I was referring to the part "... could be
> replaced by an ‘and’ expression similar to _the one in the first part of
> the function_."  But when I tried to search for `and' in the example
> code of that section I found no `and' usage at all, which confused me a
> bit.

I think it means this part earlier in the node:

       (if (fboundp 'menu-bar-update-yank-menu)
            (menu-bar-update-yank-menu string (and replace (car kill-ring))))

> It was not until I looked at the texi source that I noticed that
> the original example code did use `and' which I linked in my first
> email, and it was later replace by the current one from Emacs 22 which
> no longer used `and'.  Thus I would consider the text in the parentheses
> you quoted to be obsolete.

I don't think so.

> And of course as I mentioned in the previous email, IMHO it is probably
> not a good advice to use `and' to emulate `if'.

I disagree.  I think the discussion of 'if' and 'and' there is
entirely appropriate and educational, and I personally do use these
interchangeably in some situations.




This bug report was last modified 1 year and 224 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.