GNU bug report logs - #63655
29.0.91; Dialog box not displayed upon closing frame

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Tue, 23 May 2023 05:13:02 UTC

Severity: normal

Found in version 29.0.91

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 63655 in the body.
You can then email your comments to 63655 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#63655; Package emacs. (Tue, 23 May 2023 05:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Po Lu <luangruo <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 23 May 2023 05:13:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.91; Dialog box not displayed upon closing frame
Date: Tue, 23 May 2023 13:12:38 +0800
Start Emacs, then set confirm-kill-emacs to t.
Close the last frame on the only terminal by clicking the close button
on the WM frame window.  Emacs will ask:

  Really exit Emacs? (y or n)

in the echo area, instead of displaying a popup dialog as in Emacs 28.
This makes it difficult to close Emacs using only the mouse.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63655; Package emacs. (Tue, 23 May 2023 11:15:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 63655 <at> debbugs.gnu.org
Subject: Re: bug#63655: 29.0.91; Dialog box not displayed upon closing frame
Date: Tue, 23 May 2023 14:14:58 +0300
> Date: Tue, 23 May 2023 13:12:38 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Start Emacs, then set confirm-kill-emacs to t.
> Close the last frame on the only terminal by clicking the close button
> on the WM frame window.  Emacs will ask:
> 
>   Really exit Emacs? (y or n)

confirm-kill-emacs, if non-nil, should be a function.  If I try what
you described above, Emacs signals an error when I close the last
frame.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63655; Package emacs. (Tue, 23 May 2023 12:09:01 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63655 <at> debbugs.gnu.org
Subject: Re: bug#63655: 29.0.91; Dialog box not displayed upon closing frame
Date: Tue, 23 May 2023 20:07:58 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Tue, 23 May 2023 13:12:38 +0800
>> From:  Po Lu via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> Start Emacs, then set confirm-kill-emacs to t.
>> Close the last frame on the only terminal by clicking the close button
>> on the WM frame window.  Emacs will ask:
>> 
>>   Really exit Emacs? (y or n)
>
> confirm-kill-emacs, if non-nil, should be a function.  If I try what
> you described above, Emacs signals an error when I close the last
> frame.

Sorry, I meant to set it to `y-or-n-p'.  I did that from Custom.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63655; Package emacs. (Tue, 23 May 2023 13:00:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 63655 <at> debbugs.gnu.org
Subject: Re: bug#63655: 29.0.91; Dialog box not displayed upon closing frame
Date: Tue, 23 May 2023 16:00:17 +0300
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 63655 <at> debbugs.gnu.org
> Date: Tue, 23 May 2023 20:07:58 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >>   Really exit Emacs? (y or n)
> >
> > confirm-kill-emacs, if non-nil, should be a function.  If I try what
> > you described above, Emacs signals an error when I close the last
> > frame.
> 
> Sorry, I meant to set it to `y-or-n-p'.  I did that from Custom.

Does the patch below give good results?

diff --git a/lisp/subr.el b/lisp/subr.el
index 52227b5..9aa28d9 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3544,6 +3544,8 @@ use-dialog-box-p
   "Return non-nil if the current command should prompt the user via a dialog box."
   (and last-input-event                 ; not during startup
        (or (consp last-nonmenu-event)   ; invoked by a mouse event
+           (and (null last-nonmenu-event)
+                (consp last-input-event))
            from--tty-menu-p)            ; invoked via TTY menu
        use-dialog-box))
 
diff --git a/src/fns.c b/src/fns.c
index e8cd621..e01739c 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3193,8 +3193,11 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
 
   CHECK_STRING (prompt);
 
-  if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
-      && use_dialog_box && ! NILP (last_input_event))
+  if (!NILP (last_input_event)
+      && (CONSP (last_nonmenu_event)
+	  || (NILP (last_nonmenu_event) && CONSP (last_input_event))
+	  || !NILP (find_symbol_value (Qfrom__tty_menu_p)))
+      && use_dialog_box)
     {
       Lisp_Object pane, menu, obj;
       redisplay_preserve_echo_area (4);
@@ -6358,4 +6361,5 @@ syms_of_fns (void)
   defsubr (&Sbuffer_line_statistics);
 
   DEFSYM (Qreal_this_command, "real-this-command");
+  DEFSYM (Qfrom__tty_menu_p, "from--tty-menu-p");
 }




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63655; Package emacs. (Tue, 23 May 2023 13:17:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63655 <at> debbugs.gnu.org
Subject: Re: bug#63655: 29.0.91; Dialog box not displayed upon closing frame
Date: Tue, 23 May 2023 21:16:40 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Po Lu <luangruo <at> yahoo.com>
>> Cc: 63655 <at> debbugs.gnu.org
>> Date: Tue, 23 May 2023 20:07:58 +0800
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> >>   Really exit Emacs? (y or n)
>> >
>> > confirm-kill-emacs, if non-nil, should be a function.  If I try what
>> > you described above, Emacs signals an error when I close the last
>> > frame.
>> 
>> Sorry, I meant to set it to `y-or-n-p'.  I did that from Custom.
>
> Does the patch below give good results?
>
> diff --git a/lisp/subr.el b/lisp/subr.el
> index 52227b5..9aa28d9 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -3544,6 +3544,8 @@ use-dialog-box-p
>    "Return non-nil if the current command should prompt the user via a dialog box."
>    (and last-input-event                 ; not during startup
>         (or (consp last-nonmenu-event)   ; invoked by a mouse event
> +           (and (null last-nonmenu-event)
> +                (consp last-input-event))
>             from--tty-menu-p)            ; invoked via TTY menu
>         use-dialog-box))
>  
> diff --git a/src/fns.c b/src/fns.c
> index e8cd621..e01739c 100644
> --- a/src/fns.c
> +++ b/src/fns.c
> @@ -3193,8 +3193,11 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
>  
>    CHECK_STRING (prompt);
>  
> -  if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
> -      && use_dialog_box && ! NILP (last_input_event))
> +  if (!NILP (last_input_event)
> +      && (CONSP (last_nonmenu_event)
> +	  || (NILP (last_nonmenu_event) && CONSP (last_input_event))
> +	  || !NILP (find_symbol_value (Qfrom__tty_menu_p)))
> +      && use_dialog_box)
>      {
>        Lisp_Object pane, menu, obj;
>        redisplay_preserve_echo_area (4);
> @@ -6358,4 +6361,5 @@ syms_of_fns (void)
>    defsubr (&Sbuffer_line_statistics);
>  
>    DEFSYM (Qreal_this_command, "real-this-command");
> +  DEFSYM (Qfrom__tty_menu_p, "from--tty-menu-p");
>  }

Yes, it does.  Thanks.

BTW, could we please not change yes-or-no-p on the release branch?  It's
not involved in y-or-n-p, and doing so makes me skittish for a reason
you can surely understand.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 23 May 2023 14:49:02 GMT) Full text and rfc822 format available.

Notification sent to Po Lu <luangruo <at> yahoo.com>:
bug acknowledged by developer. (Tue, 23 May 2023 14:49:02 GMT) Full text and rfc822 format available.

Message #22 received at 63655-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 63655-done <at> debbugs.gnu.org
Subject: Re: bug#63655: 29.0.91; Dialog box not displayed upon closing frame
Date: Tue, 23 May 2023 17:48:06 +0300
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 63655 <at> debbugs.gnu.org
> Date: Tue, 23 May 2023 21:16:40 +0800
> 
> Yes, it does.  Thanks.

Thanks, installed on the release branch, after some cleanup and update
of the docs.

> BTW, could we please not change yes-or-no-p on the release branch?  It's
> not involved in y-or-n-p, and doing so makes me skittish for a reason
> you can surely understand.

I'm just being proactive -- the very next bug report we will get is
why yes-or-no-p behaves differently wrt use of dialog boxes.  Even in
the recipe you posted here, yes-or-no-p behaved differently.  It makes
no sense to me to have such subtle differences, especially when many
people replace one of these function by the other, and we even have a
user option nowadays to do that automatically.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63655; Package emacs. (Wed, 24 May 2023 00:19:02 GMT) Full text and rfc822 format available.

Message #25 received at 63655-done <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63655-done <at> debbugs.gnu.org
Subject: Re: bug#63655: 29.0.91; Dialog box not displayed upon closing frame
Date: Wed, 24 May 2023 08:18:31 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> I'm just being proactive -- the very next bug report we will get is
> why yes-or-no-p behaves differently wrt use of dialog boxes.  Even in
> the recipe you posted here, yes-or-no-p behaved differently.  It makes
> no sense to me to have such subtle differences, especially when many
> people replace one of these function by the other, and we even have a
> user option nowadays to do that automatically.

I think we really ought to wait until a complaint to make this change on
emacs-29.  I'm fine with doing it on master.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63655; Package emacs. (Wed, 24 May 2023 02:32:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 63655 <at> debbugs.gnu.org
Subject: Re: bug#63655: 29.0.91; Dialog box not displayed upon closing frame
Date: Wed, 24 May 2023 05:31:33 +0300
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 63655-done <at> debbugs.gnu.org
> Date: Wed, 24 May 2023 08:18:31 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > I'm just being proactive -- the very next bug report we will get is
> > why yes-or-no-p behaves differently wrt use of dialog boxes.  Even in
> > the recipe you posted here, yes-or-no-p behaved differently.  It makes
> > no sense to me to have such subtle differences, especially when many
> > people replace one of these function by the other, and we even have a
> > user option nowadays to do that automatically.
> 
> I think we really ought to wait until a complaint to make this change on
> emacs-29.  I'm fine with doing it on master.

I understand, but I think we are fine with the change on emacs-29.  If
I'm wrong, we'd know soon enough.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 21 Jun 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 309 days ago.

Previous Next


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