bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#56305: 29.0.50; 'yes-or-no-p' deselects minibuffer frame


From: Alan Mackenzie
Subject: bug#56305: 29.0.50; 'yes-or-no-p' deselects minibuffer frame
Date: Mon, 4 Jul 2022 19:10:07 +0000

[ Adding Stefan M., because he's had experience of this sort of thing. ]

Hello, Eli, Martin, and Stefan.

On Sun, Jul 03, 2022 at 19:17:21 +0300, Eli Zaretskii wrote:
> > Date: Sun, 3 Jul 2022 16:09:43 +0000
> > Cc: Eli Zaretskii <eliz@gnu.org>, 56305@debbugs.gnu.org, acm@muc.de
> > From: Alan Mackenzie <acm@muc.de>

> > While debugging, is there any easy way of determining which frame
> > currently has the focus?

> Yes, call x_get_focus_frame (or just examine the value of
> FRAME_DISPLAY_INFO (f)->x_focus_frame manually).

Thank you indeed.  That was very helpful.  I've spent several hours in
gdb since these recent posts.

Quick summary of the problem: On an Emacs with a minibuffer-only frame
(MBF) and a minibuffer-less frame (NF), with MBF selected with focus,
type C-x C-c.  Instead of the focus remaining in MBF, it's moved to NF.

I've pretty much tracked down what is happening, though I don't
understand the last bit.  Line ~71 in do_switch_frame (frame.c) is this:

          Fredirect_frame_focus (gfocus, frame);

At this point in time gfocus is NF and frame is also NF.  NF's frame
focus had earlier been redirected to MBF.  When Fredirect_frame_focus is
executed, NF becomes redirected to itself, and also becomes the focussed
frame (otherwise known as, sort of, the "highlighted frame").  This
becoming the focussed frame is the problem.

A few lines higher up in do_switch_frame, there is a comment which
purports to explain this shifting of the frame focus, namely:

    /* If a frame's focus has been redirected toward the currently
       selected frame, we should change the redirection to point to the
       newly selected frame.  This means that if the focus is redirected
       from a minibufferless frame to a surrogate minibuffer frame, we
       can use `other-window' to switch between all the frames using
       that minibuffer frame, and the focus redirection will follow us
       around.  */

I don't understand this at all well.  What it describes is indeed what
happens.  But if NF has been redirected to MBF, that surely means that
when NF is the selected frame with focus, any characters typed will
appear in MBF.  Not the other way around.

What happens to NF's focus, which previously pointed at MBF, is that it
points to NF itself.  This is as described in the comment.  It is wrong.

Surely what the comment should say, and what should happen is that if
there is a frame switch from NF to NF2, then NF2 should become
redirected to MBF.  No?

What am I missing?

Apologies for this post being somewhat dense.

-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

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