emacs-devel
[Top][All Lists]
Advanced

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

Re: Change to `use-dialog-box-p'


From: Eli Zaretskii
Subject: Re: Change to `use-dialog-box-p'
Date: Sun, 21 May 2023 10:40:44 +0300

> 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 via email to

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