unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: Change to `use-dialog-box-p'
Date: Sun, 21 May 2023 10:40:44 +0300	[thread overview]
Message-ID: <83ttw6qghv.fsf@gnu.org> (raw)
In-Reply-To: <875y8m1903.fsf@yahoo.com> (message from Po Lu on Sun, 21 May 2023 14:41:48 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 21 May 2023 14:41:48 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I guess that's only with a Yes/No dialog, and only if you press RET to
> > accept the default response.  But GUI dialogs can show much more than
> > that, and this function is for all of them.  It would be unthinkable
> > for us to pop up a File Selection dialog, for example, when
> > last-nonmenu-event is nil.
> 
> Right, but then, what could lead to a file selection dialog being
> displayed immediately after startup?

Where's the condition "immediately after startup" in this case?  This
function is general-purpose.

And why should a question Emacs asks after startup _always_ pop up the
GUI dialog?  Such behavior makes no sense at all!

> > If you want to convince me to make some change, please describe how to
> > distinguish between this particular case which is of interest to you
> > and the other ones, when last-nonmenu-event is nil.
> 
> How about ``if the function displaying the dialog is y-or-n-p?''

No, not good enough.  We ask these questions all the time.  See below
for some descriptive examples.

> > And even then I still don't see why we should pop up a GUI dialog in
> > this situation.  Once again: Emacs defaults to not showing GUI
> > dialogs, it's our long-time behavior, and this situation doesn't seem
> > to have any aspects that would require us to show a dialog.  It is
> > simply a bug that we were showing a dialog in previous versions: the
> > code didn't distinguish between nil and a proper list.
> 
> But then, why does yes-or-no-p say:
> 
>   If dialog boxes are supported, a dialog box will be used
>   if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil.
> 
> I would expect use-dialog-box-p to behave identically to yes-or-no-p.

Is this a documentation problem?  Augmenting yes-or-no-p's doc string
is easy.  Or do you mean that you want

  emacs -Q --eval "(yes-or-no-p \"What?\")"

to pop up a GUI dialog?

Also, please note that use-dialog-box is nowadays non-nil on TTY
frames as well, so what you want will make

  emacs -Q -nw --eval "(yes-or-no-p \"What?\")"

pop up the dialog as well.  Is that reasonable behavior?

Btw, use-dialog-box-p also looks at last-input-event, and only pops up
a dialog box if that is non-nil.  In your scenario, is
last-input-event non-nil?  If so, what is it, and where did it come
from?

> > Just get over it.
> 
> I don't think that's the right attitude to take towards user visible
> changes in behavior.

It's not a "behavior", it's a bug!  The behavior we will get with the
change you suggest will surprise (and annoy) many more users!



  reply	other threads:[~2023-05-21  7:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87o7mf3em6.fsf.ref@yahoo.com>
2023-05-20  2:45 ` Change to `use-dialog-box-p' Po Lu
2023-05-20  5:56   ` Eli Zaretskii
2023-05-20  6:29     ` Po Lu
2023-05-20  8:14       ` Eli Zaretskii
2023-05-20  8:32         ` Po Lu
2023-05-20  9:41           ` Eli Zaretskii
2023-05-20 11:17             ` Po Lu
2023-05-20 12:38               ` Eli Zaretskii
2023-05-21  0:47                 ` Po Lu
2023-05-21  5:50                   ` Eli Zaretskii
2023-05-21  6:41                     ` Po Lu
2023-05-21  7:40                       ` Eli Zaretskii [this message]
2023-05-22  5:33 Pedro A. Aranda Gutiérrez
2023-05-22  9:27 ` Po Lu
2023-05-22 10:17   ` Pedro Andres Aranda Gutierrez
2023-05-22 11:28   ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2023-05-23  1:39 Samuel Wales
2023-05-23 11:35 ` Eli Zaretskii

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=83ttw6qghv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.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).