From: Alan Mackenzie <acm@muc.de>
To: martin rudalics <rudalics@gmx.at>
Cc: 56305@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
monnier@iro.umontreal.ca
Subject: bug#56305: 29.0.50; 'yes-or-no-p' deselects minibuffer frame
Date: Sat, 16 Jul 2022 20:34:15 +0000 [thread overview]
Message-ID: <YtMgxz5LkhosyRdb@ACM> (raw)
In-Reply-To: <171bab25-5eb2-884b-5c32-bcfe4fed21cc@gmx.at>
Hello, Martin.
On Tue, Jul 12, 2022 at 09:35:00 +0200, martin rudalics wrote:
[ .... ]
> > Apologies: the doc string for select-window virtually says it grabs
> > the focus. Couldn't we go the whole way, and explicitly state that
> > select-window is really "select-window-set-input-focus"?
> But we can't guarantee that. Popping up a new frame via
> 'pop-to-buffer' should do that via 'select-frame-set-input-focus'. But
> if the window manager forbids focus stealing, it doesn't. The new
> frame may even come up totally obscured.
> >> The Elisp manual is controversial about this. A sentence like
> >> Note that sometimes selecting a window is not enough to show
> >> it, or make its frame the top-most frame on display: you may
> >> also need to raise the frame or make sure input focus is
> >> directed to that frame.
> > That sounds like the text from a bug report. Selecting a window
> > should either do all these GUI things, or it shouldn't do them.
> > "Sometimes" feels like an apology for failing to fix a bug before a
> > release.
> The text mirrors the savage wilderness of GUIs - eat and be eaten.
> That's not the clean, well-lighted environment of a tty.
Doesn't terminfo cater for this sort of thing? Whether it does or not,
surely we could set up a set of capability variables, nil/t, a bit like
we've got focus-follows-mouse.
[ .... ]
> 'display-buffer', for example, should not select the window it uses.
> But if you display the buffer in a new frame and the window manager
> decides to always give focus to a new frame, that window will be
> selected. It took me years to convince Drew that Emacs can't do
> anything about that.
Again, where are our capability variables?
> It would help if we had APIs that left the choice whether a new frame
> should receive focus or be raised to the application. I've never seen
> one that does that. (Rightfully so - think of applications that within
> milliseconds ask for moving focus from one window to another and back.)
I'm thinking of one at the moment. ;-(
[ .... ]
> > Yes. :-( But that (normal) frame _is_ selected. It's just that
> > its focus has been redirected to the minibuffer frame. Normally,
> > C-x o doesn't move the focus away from the currently focussed frame.
> >> and about the window “selected within the frame”
> >> For the selected frame, that window is called the “selected
> >> window”—the one in which most editing takes place, and in which
> >> the cursor for selected windows appears
> >> Here the cursor for the selected window appears in the minibuffer
> >> frame window and that's what fooled me. In which window should the
> >> cursor appear in your opinion?
> > In the focussed frame, in the selected window in it. That would be
> > in the minibuffer window, surely?
> But that's not the selected window which is, according to what you say
> above, the selected window of the normal frame.
> > I don't think the documentation in the Elisp manual quite covers
> > complexities like MB-only frames and focus redirection. Surely C-x
> > o shouldn't move the focus to a different frame?
> When the minibuffer is active it should (even if it does not succeed in
> all cases) because 'other-window' calls 'select-window'.
> > Surely C-x o shouldn't move the focus to a different frame?
> It did so ever since the code you elided was written.
C-x o calls next-window and the spec for that, with arguments like
ALL-FRAMES and MINIBUF is right on the boundaries of understandability.
> > Here the user would have C-x 5 o to move to that normal frame. Any
> > user chosing a minibuffer-only frame setup (for whatever advantages)
> > should be aware of things like that.
> This is not only about minibuffer-only frame setups. It can happen
> whenever a frame without minibuffer is made. The underlying idea is
> that navigation within the cyclic ordering of windows should be
> coherent regardless of where the minibuffer window resides.
> > That's a terrible piece of writing. The "using" could mean either
> > of "switch between all the frames which use that MB frame" or
> > "switch between all the frames by using the minibuffer frame as a
> > mechanism".
> > I still can't make sense out of that comment. But the code it was
> > attached to caused the new frame to grab the focus, and that was
> > what happened in the bug scenario. In fact there, the redirection
> > of the new frame (the normal frame) was left pointing at itself.
> You're barking at the wrong tree. That code worked well for half of
> its lifetime.
It strikes me it was really fragile code. In the middle of the function
to switch the current frame there was a difficult to understand ad-hoc
section which redirected the focus, sometimes. Surely that should be
done somewhere else (where?) more systematically.
> What really got us into the present bredouille was commit
> 6355802033d202c63f6fff4b77bf2b0c7aecceef and its ill-fated decision to
> call Fselect_window instead of directly setting selected frame and
> window as the well-established and tested code in display_mode_lines
> did and still does.
I think we can understand the motivation behind that. Fselect_window
will surely do everything to keep everything consistent and coherent.
Just setting the variable is liable to lead to inconsistency and chaos if
you're not very careful what you do. This pattern is not unknown in
Emacs, where a high-level function (or command, even) wants to do things
which are inconvenient at the nitty-gritty level. I don't recall seeing
any comments about Fselect_window saying "be careful!".
> In the sequel, obscure bugs began to pile up, all very difficult to
> describe and reproduce (Bug#23124, Bug#24285, Bug#34317) and were fixed
> with some trickery. The origin of all that evil remained in place.
What is stopping you fixing it, given that you understand it better than
anybody else?
> Making the minibuffer follow the selected frame was just the final
> stab.
That's optional: now, either the MB follows the selected frame or it
doesn't.
> >> If we were to change that, we would change the entire cyclic
> >> ordering of windows concept which explicitly states that "If the
> >> minibuffer is active, the minibuffer window is included too" and
> >> that window may reside on any frame.
Yes. :-(
> > If we change all this (and I think we should), we should do it in a
> > way which doesn't disturb the cyclic ordering.
> We should eliminate the original sin and be done with it once and for
> all.
Commit 6355802033d202....aecceef? Why not?
> martin
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2022-07-16 20:34 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 17:54 bug#56305: 29.0.50; 'yes-or-no-p' deselects minibuffer frame martin rudalics
2022-06-29 19:10 ` Eli Zaretskii
2022-06-30 10:35 ` Alan Mackenzie
2022-06-30 20:32 ` Alan Mackenzie
2022-07-02 11:38 ` Alan Mackenzie
2022-07-03 8:16 ` martin rudalics
2022-07-03 16:09 ` Alan Mackenzie
2022-07-03 16:17 ` Eli Zaretskii
2022-07-04 19:10 ` Alan Mackenzie
2022-07-04 19:21 ` Eli Zaretskii
2022-07-04 19:43 ` Alan Mackenzie
2022-07-05 2:29 ` Eli Zaretskii
2022-07-05 15:59 ` Alan Mackenzie
2022-07-05 16:24 ` Eli Zaretskii
2022-07-05 17:09 ` Alan Mackenzie
2022-07-06 17:04 ` Alan Mackenzie
2022-07-06 17:29 ` Eli Zaretskii
2022-07-06 18:16 ` Alan Mackenzie
2022-07-06 18:34 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-06 18:58 ` Andreas Schwab
2022-07-06 19:05 ` Alan Mackenzie
2022-07-06 19:09 ` Andreas Schwab
2022-07-06 19:22 ` Alan Mackenzie
2022-07-07 17:25 ` Alan Mackenzie
2022-07-07 18:57 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-08 21:03 ` Alan Mackenzie
2022-07-09 2:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-07 7:55 ` martin rudalics
2022-07-07 9:12 ` Alan Mackenzie
2022-07-08 7:01 ` martin rudalics
2022-07-08 10:55 ` Alan Mackenzie
2022-07-08 11:55 ` Eli Zaretskii
2022-07-08 18:31 ` Alan Mackenzie
2022-07-09 8:36 ` martin rudalics
2022-07-08 21:45 ` Gregory Heytings
2022-07-09 8:35 ` martin rudalics
2022-07-09 10:57 ` Alan Mackenzie
2022-07-10 8:07 ` martin rudalics
2022-07-10 11:34 ` Alan Mackenzie
2022-07-10 11:47 ` Eli Zaretskii
2022-07-10 12:41 ` Alan Mackenzie
2022-07-10 13:01 ` Eli Zaretskii
2022-07-10 16:13 ` Drew Adams
2022-07-10 16:55 ` Alan Mackenzie
2022-07-11 7:45 ` martin rudalics
2022-07-11 11:12 ` Eli Zaretskii
2022-07-12 7:33 ` martin rudalics
2022-07-12 16:02 ` Eli Zaretskii
2022-07-11 16:22 ` Alan Mackenzie
2022-07-11 16:43 ` Eli Zaretskii
2022-07-11 17:15 ` Alan Mackenzie
2022-07-11 17:33 ` Eli Zaretskii
2022-07-11 17:34 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-11 20:09 ` Alan Mackenzie
2022-07-11 17:06 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-11 20:01 ` Alan Mackenzie
2022-07-12 7:35 ` martin rudalics
2022-07-12 14:56 ` Drew Adams
2022-07-16 7:06 ` martin rudalics
2022-07-16 20:34 ` Alan Mackenzie [this message]
2022-07-18 7:36 ` martin rudalics
2022-07-18 14:44 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-19 8:09 ` martin rudalics
2022-07-19 16:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-16 23:39 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-17 11:29 ` Alan Mackenzie
2022-07-17 14:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-17 15:06 ` Alan Mackenzie
2022-07-18 7:37 ` martin rudalics
2022-07-18 14:58 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-18 15:58 ` Eli Zaretskii
2022-07-18 16:12 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-18 16:50 ` Eli Zaretskii
2022-07-19 20:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-20 12:17 ` Eli Zaretskii
2022-07-20 14:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-20 16:02 ` Eli Zaretskii
2022-07-21 15:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-21 15:58 ` Eli Zaretskii
2022-07-19 8:09 ` martin rudalics
2022-07-07 15:54 ` Alan Mackenzie
2022-07-04 19:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-04 19:59 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YtMgxz5LkhosyRdb@ACM \
--to=acm@muc.de \
--cc=56305@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.