GNU bug report logs - #56305
29.0.50; 'yes-or-no-p' deselects minibuffer frame

Previous Next

Package: emacs;

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

Date: Wed, 29 Jun 2022 17:55:01 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rudalics <at> gmx.at, 56305 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>, acm <at> muc.de
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 <at> gnu.org>, 56305 <at> debbugs.gnu.org, acm <at> muc.de
> > From: Alan Mackenzie <acm <at> 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).




This bug report was last modified 2 years and 331 days ago.

Previous Next


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