GNU bug report logs - #34317
26.1.90; Wrong unbinding order in x_consider_frame_title

Previous Next

Package: emacs;

Reported by: martin rudalics <rudalics <at> gmx.at>

Date: Mon, 4 Feb 2019 18:51:01 UTC

Severity: normal

Found in version 26.1.90

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

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 34317 in the body.
You can then email your comments to 34317 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#34317; Package emacs. (Mon, 04 Feb 2019 18:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 04 Feb 2019 18:51:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 26.1.90; Wrong unbinding order in x_consider_frame_title
Date: Mon, 04 Feb 2019 19:49:54 +0100
[Message part 1 (text/plain, inline)]
The unbinding order in x_consider_frame_title is botched.  Hence,
while do_switch_frame will not resize the minibuffer window when the
frame of the title bar gets selected, it will still resize when the
old frame gets reselected in the unbind form.

The behavior can be seen with emacs -Q evaluating the following two
forms in row:

(make-frame '((minibuffer . nil)))
(y-or-n-p "\n")

The attached trivial patch cures it.  Obviously, there's no guarantee
that some other client relies on the wrong order.

martin
[x_consider_frame_title.diff~ (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Tue, 19 Feb 2019 09:08:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Tue, 19 Feb 2019 10:07:36 +0100
> The unbinding order in x_consider_frame_title is botched.  Hence,
> while do_switch_frame will not resize the minibuffer window when the
> frame of the title bar gets selected, it will still resize when the
> old frame gets reselected in the unbind form.
>
> The behavior can be seen with emacs -Q evaluating the following two
> forms in row:
>
> (make-frame '((minibuffer . nil)))
> (y-or-n-p "\n")

Maybe it's not entirely clear from this description.  The

(y-or-n-p "\n")

form must be evaluated in the new, minibuffer-less frame.  Then the
minibuffer window in the first, minibuffer-equipped frame appears
empty.

> The attached trivial patch cures it.  Obviously, there's no guarantee
> that some other client relies on the wrong order.

Any suggestions on how to proceed?  This is a regression wrt Emacs 25.

Thanks, martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Sat, 23 Feb 2019 09:44:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Sat, 23 Feb 2019 11:43:30 +0200
> Date: Tue, 19 Feb 2019 10:07:36 +0100
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  > The attached trivial patch cures it.  Obviously, there's no guarantee
>  > that some other client relies on the wrong order.
> 
> Any suggestions on how to proceed?  This is a regression wrt Emacs 25.

How about installing this on master?  Just please mention in the
comments the convoluted use case that caused the change in order, so
that we don't forget.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Sat, 23 Feb 2019 14:01:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Sat, 23 Feb 2019 15:00:31 +0100
> How about installing this on master?  Just please mention in the
> comments the convoluted use case that caused the change in order, so
> that we don't forget.

The use case is by no means convoluted.  Try 'y-or-n-p' with a single
line prompt that exceeds the minibuffer window width.  No feedback is
visible which is IMO a quite dangerous effect.  Missing a question is
bad.

Anyway.  I doubt that installing my change without accompanying
measures will work out of the box.  But first of all I'd like to know
whether your change was intentionally asymmetric (if so, why?),
experimentally asymmetric (which experiments did you conduct?), or
accidentally so (it's rather atypical of you to install asymmetric
behavior and not document it).

And obviously, all this evil has two roots: The fact that redisplay
may call 'select-frame' and the one that do_switch_frame always
shrinks the minibuffer window of the frame it leaves.  Together these
make debugging resize_mini_window calls a nightmare.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Sat, 23 Feb 2019 16:47:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Sat, 23 Feb 2019 18:46:32 +0200
> Date: Sat, 23 Feb 2019 15:00:31 +0100
> From: martin rudalics <rudalics <at> gmx.at>
> CC: 34317 <at> debbugs.gnu.org
> 
>  > How about installing this on master?  Just please mention in the
>  > comments the convoluted use case that caused the change in order, so
>  > that we don't forget.
> 
> The use case is by no means convoluted.

That single word was hardly the main part of what I wrote...

> first of all I'd like to know whether your change was intentionally
> asymmetric (if so, why?), experimentally asymmetric (which
> experiments did you conduct?), or accidentally so (it's rather
> atypical of you to install asymmetric behavior and not document it).

I didn't realize we were discussing my change.  Which change was that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Sun, 24 Feb 2019 08:44:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Sun, 24 Feb 2019 09:43:09 +0100
>> first of all I'd like to know whether your change was intentionally
>> asymmetric (if so, why?), experimentally asymmetric (which
>> experiments did you conduct?), or accidentally so (it's rather
>> atypical of you to install asymmetric behavior and not document it).
>
> I didn't realize we were discussing my change.  Which change was that?

commit 821ea144bd446268fbe4a4a4775a06da52dea8cb

Display mini-window resized even when there are several frames

* src/xdisp.c (x_consider_frame_title): Bind inhibit-redisplay to
t to avoid resizing back the mini-window as result of considering
the title of other frames.  (Bug#24285)
(redisplay_window): No need to bind inhibit-redisplay here.


This means that in x_consider_frame_title we now do

      ptrdiff_t count = SPECPDL_INDEX ();

      ...

      record_unwind_protect (unwind_format_mode_line,
                             format_mode_line_unwind_data
                               (f, current_buffer, selected_window, false));
      ...

      specbind (Qinhibit_redisplay, Qt);

      Fselect_window (f->selected_window, Qt);

     ...

      unbind_to (count, Qnil);

where unwind_format_mode_line does

      Fselect_window (old_window, Qt);

The asymmetry I mentioned is that while binding Qinhibit_redisplay
covers the Fselect_window call in x_consider_frame_title, it does not
cover the Fselect_window in unwind_format_mode_line since that is
performed _after_ the special binding of Qinhibit_redisplay has been
abolished.  Which means that we call resize_mini_window for the first
call when the corresponding windows are on different frames but not
for the second.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Sun, 24 Feb 2019 16:09:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Sun, 24 Feb 2019 18:08:32 +0200
> Date: Sun, 24 Feb 2019 09:43:09 +0100
> From: martin rudalics <rudalics <at> gmx.at>
> CC: 34317 <at> debbugs.gnu.org
> 
> * src/xdisp.c (x_consider_frame_title): Bind inhibit-redisplay to
> t to avoid resizing back the mini-window as result of considering
> the title of other frames.  (Bug#24285)
> (redisplay_window): No need to bind inhibit-redisplay here.
> 
> 
> This means that in x_consider_frame_title we now do
> 
>        ptrdiff_t count = SPECPDL_INDEX ();
> 
>        ...
> 
>        record_unwind_protect (unwind_format_mode_line,
>                               format_mode_line_unwind_data
>                                 (f, current_buffer, selected_window, false));
>        ...
> 
>        specbind (Qinhibit_redisplay, Qt);
> 
>        Fselect_window (f->selected_window, Qt);
> 
>       ...
> 
>        unbind_to (count, Qnil);
> 
> where unwind_format_mode_line does
> 
>        Fselect_window (old_window, Qt);
> 
> The asymmetry I mentioned is that while binding Qinhibit_redisplay
> covers the Fselect_window call in x_consider_frame_title, it does not
> cover the Fselect_window in unwind_format_mode_line since that is
> performed _after_ the special binding of Qinhibit_redisplay has been
> abolished.  Which means that we call resize_mini_window for the first
> call when the corresponding windows are on different frames but not
> for the second.

I cannot imagine that was on purpose.

But your proposed change fixes that, so I'm unsure why you said it
won't work OOTB.  What did I miss?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Sun, 24 Feb 2019 18:31:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Sun, 24 Feb 2019 19:30:42 +0100
[Message part 1 (text/plain, inline)]
> I cannot imagine that was on purpose.

OK.

> But your proposed change fixes that, so I'm unsure why you said it
> won't work OOTB.  What did I miss?

Because I encountered problems in another context but do not remember
the details.  All I can tell is that here I additionally had to install
the attached.

martin
[keyboard.c.diff (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Sun, 24 Feb 2019 18:58:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Sun, 24 Feb 2019 20:57:20 +0200
> Date: Sun, 24 Feb 2019 19:30:42 +0100
> From: martin rudalics <rudalics <at> gmx.at>
> CC: 34317 <at> debbugs.gnu.org
> 
>  > But your proposed change fixes that, so I'm unsure why you said it
>  > won't work OOTB.  What did I miss?
> 
> Because I encountered problems in another context but do not remember
> the details.  All I can tell is that here I additionally had to install
> the attached.

This addition makes sense regardless, so why not install both and see
what breaks?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34317; Package emacs. (Mon, 04 Mar 2019 10:15:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34317 <at> debbugs.gnu.org
Subject: Re: bug#34317: 26.1.90;
 Wrong unbinding order in x_consider_frame_title
Date: Mon, 04 Mar 2019 11:14:23 +0100
fixed 34317 27.1
quit

> This addition makes sense regardless, so why not install both and see
> what breaks?

Installed.  Marking bug as done.

Thanks, martin




bug Marked as fixed in versions 27.1. Request was from martin rudalics <rudalics <at> gmx.at> to control <at> debbugs.gnu.org. (Mon, 04 Mar 2019 10:15:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 34317 <at> debbugs.gnu.org and martin rudalics <rudalics <at> gmx.at> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 30 Mar 2019 02:57:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 27 Apr 2019 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 6 days ago.

Previous Next


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