unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Xiyue Deng <manphiz@gmail.com>
Cc: 67669@debbugs.gnu.org
Subject: bug#67669: 29.1; Drop text suggesting using `and' to replace `if'
Date: Thu, 07 Dec 2023 12:16:00 +0200	[thread overview]
Message-ID: <83a5qm2u8v.fsf@gnu.org> (raw)
In-Reply-To: <87r0jytm58.fsf@debian-hx90.lan> (message from Xiyue Deng on Thu,  07 Dec 2023 01:08:51 -0800)

> From: Xiyue Deng <manphiz@gmail.com>
> Cc: 67669@debbugs.gnu.org
> Date: Thu, 07 Dec 2023 01:08:51 -0800
> 
> Eli Zaretskii <eliz@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.





  reply	other threads:[~2023-12-07 10:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 21:47 bug#67669: 29.1; Drop text suggesting using `and' to replace `if' Xiyue Deng
     [not found] ` <handler.67669.B.170189926211616.ack@debbugs.gnu.org>
2023-12-06 22:08   ` Xiyue Deng
2023-12-07  6:28 ` Eli Zaretskii
2023-12-07  9:08   ` Xiyue Deng
2023-12-07 10:16     ` Eli Zaretskii [this message]
2023-12-07 17:49       ` Xiyue Deng
2023-12-07 17:56         ` Eli Zaretskii
2023-12-07 19:54           ` Xiyue Deng
2023-12-07 20:22             ` Eli Zaretskii
2023-12-07 20:37               ` Xiyue Deng
2023-12-07 21:29                 ` Drew Adams
2023-12-08  9:11                   ` Xiyue Deng
2023-12-08  6:25                 ` Eli Zaretskii
2023-12-08  9:07                   ` Xiyue Deng
2023-12-08 15:37                   ` Drew Adams
2023-12-07 19:37         ` Drew Adams
2023-12-07 20:00           ` Xiyue Deng
2023-12-08 10:45         ` Sean Whitton
2023-12-08 22:41           ` Xiyue Deng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a5qm2u8v.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=67669@debbugs.gnu.org \
    --cc=manphiz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).