From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 52491@debbugs.gnu.org
Subject: bug#52491: 28.0.90; Regression in window deletion with minibuffer
Date: Sat, 18 Dec 2021 19:20:09 +0200 [thread overview]
Message-ID: <86sfupu8xi.fsf@mail.linkov.net> (raw)
In-Reply-To: <4318fa2c-0127-4a14-f65e-399b5c097028@gmx.at> (martin rudalics's message of "Sat, 18 Dec 2021 10:05:50 +0100")
> The bug is a regression so it should be fixed. Whether and how Juri's
> fix can affect other operations that use the minibuffer before deleting
> some window is beyond my imagination.
Maybe it would be possible to change the default behavior of delete-window
to do what it did in Emacs 27? But honestly, I don't understand how
this old code managed to select the minibuffer after deleting the
completions buffer and why its behavior differs after it was moved to Lisp:
- /* Now look whether `get-mru-window' gets us something. */
- mru_window = call1 (Qget_mru_window, frame);
- if (WINDOW_LIVE_P (mru_window)
- && EQ (XWINDOW (mru_window)->frame, frame))
- new_selected_window = mru_window;
-
- /* If all ended up well, we now promote the mru window. */
- if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))
- Fselect_window (new_selected_window, Qnil);
- else
- fset_selected_window (f, new_selected_window);
> I do not understand two things: It seems that this part of the
> doc-string
>
> A minibuffer window is never
> a candidate when MINIBUF is nil or omitted. MINIBUF t means consider
> the minibuffer window only if the minibuffer is active.
>
> does not match well this part of the code
>
> (dolist (window (window-list-1 nil (unless minibuf 'nomini) all-frames))
When MINIBUF is nil, ‘(unless minibuf 'nomini)’ is ‘'nomini’,
when MINIBUF is non-nil, ‘(unless minibuf 'nomini)’ is ‘nil’,
but the third possible value MINIBUF=‘t’ of window-list-1
is not used here. This value means consider the minibuffer window
even if the minibuffer is not active. It seems this value is useless
in get-mru-window for the purposes of delete-window?
> And this (are we sure that we always want to do it when "setting up"
> completions?)
Another place would be completion-list-mode, but it's empty.
> (setq-local delete-window-choose-selected 'mru)
>
> apparently makes this binding
>
> (choose-selected delete-window-choose-selected)
>
> necessary. But this would imply that at the time 'delete-window' is
> called, its buffer is current which is by no means guaranteed. So the
> latter form should probably become
>
> (choose-selected
> (buffer-local-value
> 'delete-window-choose-selected (window-buffer window))))
‘buffer-local-value’ would be more correct, thanks.
next prev parent reply other threads:[~2021-12-18 17:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 21:08 bug#52491: 28.0.90; Regression in window deletion with minibuffer Juri Linkov
2021-12-16 17:28 ` Juri Linkov
2021-12-16 17:50 ` Eli Zaretskii
2021-12-16 19:02 ` Juri Linkov
2021-12-16 20:05 ` Eli Zaretskii
2021-12-17 8:25 ` Juri Linkov
2021-12-17 12:04 ` Eli Zaretskii
2021-12-18 9:05 ` martin rudalics
2021-12-18 17:20 ` Juri Linkov [this message]
2021-12-19 10:14 ` martin rudalics
2021-12-19 17:14 ` Juri Linkov
2021-12-19 18:16 ` martin rudalics
2021-12-19 18:25 ` Juri Linkov
2021-12-20 9:18 ` martin rudalics
2021-12-20 17:29 ` Eli Zaretskii
2021-12-20 18:08 ` martin rudalics
2021-12-20 18:18 ` Eli Zaretskii
2021-12-21 8:05 ` Juri Linkov
2021-12-21 10:33 ` martin rudalics
2021-12-21 19:13 ` Juri Linkov
2021-12-22 9:23 ` martin rudalics
2021-12-21 8:08 ` Juri Linkov
2021-12-21 10:34 ` martin rudalics
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86sfupu8xi.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=52491@debbugs.gnu.org \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).