From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 52491@debbugs.gnu.org
Subject: bug#52491: 28.0.90; Regression in window deletion with minibuffer
Date: Fri, 17 Dec 2021 10:25:52 +0200 [thread overview]
Message-ID: <86tuf73aen.fsf@mail.linkov.net> (raw)
In-Reply-To: <83fsqsfh8i.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Dec 2021 22:05:17 +0200")
[-- Attachment #1: Type: text/plain, Size: 435 bytes --]
>> > And the patch you proposed earlier doesn't fix this other problem?
>>
>> Unfortunately, it doesn't fix this, since 28.0.90 uses mru,
>> but 27.2 didn't.
>
> FWIW, I don't see any catastrophe here: whoever plays such games with
> switching windows during completion should know what they are doing,
> and how to switch back to the minibuffer.
Anyway, here is the patch for the release branch
that fixes the previous regression:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: delete-window.patch --]
[-- Type: text/x-diff, Size: 3708 bytes --]
diff --git a/lisp/window.el b/lisp/window.el
index 0f17bb28b4..0a422b4305 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2531,14 +2531,15 @@ get-lru-window
(setq best-window window)))))
(or best-window second-best-window)))
-(defun get-mru-window (&optional all-frames dedicated not-selected no-other)
+(defun get-mru-window (&optional all-frames dedicated not-selected no-other minibuf)
"Return the most recently used window on frames specified by ALL-FRAMES.
-A minibuffer window is never a candidate. A dedicated window is
-never a candidate unless DEDICATED is non-nil, so if all windows
-are dedicated, the value is nil. Optional argument NOT-SELECTED
-non-nil means never return the selected window. Optional
+A dedicated window is never a candidate unless DEDICATED is non-nil,
+so if all windows are dedicated, the value is nil. Optional argument
+NOT-SELECTED non-nil means never return the selected window. Optional
argument NO-OTHER non-nil means to never return a window whose
-'no-other-window' parameter is non-nil.
+'no-other-window' parameter is non-nil. 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.
The following non-nil values of the optional argument ALL-FRAMES
have special meanings:
@@ -2556,7 +2557,7 @@ get-mru-window
Any other value of ALL-FRAMES means consider all windows on the
selected frame and no others."
(let (best-window best-time time)
- (dolist (window (window-list-1 nil 'nomini all-frames))
+ (dolist (window (window-list-1 nil (unless minibuf 'nomini) all-frames))
(setq time (window-use-time window))
(when (and (or dedicated (not (window-dedicated-p window)))
(or (not not-selected) (not (eq window (selected-window))))
@@ -4205,6 +4206,7 @@ delete-window
(let* ((frame (window-frame window))
(function (window-parameter window 'delete-window))
(parent (window-parent window))
+ (choose-selected delete-window-choose-selected)
atom-root)
(window--check frame)
(catch 'done
@@ -4255,7 +4257,7 @@ delete-window
;; Can't do without resizing fixed-size windows.
(window--resize-siblings window (- size) horizontal t)))
- (when (eq delete-window-choose-selected 'pos)
+ (when (eq choose-selected 'pos)
;; Remember edges and position of point of the selected window
;; of WINDOW'S frame.
(setq frame-selected-window-edges
@@ -4289,9 +4291,9 @@ delete-window
;; Select window at WINDOW's position at point.
(set-frame-selected-window
frame new-frame-selected-window)))))
- ((and (eq delete-window-choose-selected 'mru)
+ ((and (eq choose-selected 'mru)
;; Try to use the most recently used window.
- (let ((mru-window (get-mru-window frame nil nil t)))
+ (let ((mru-window (get-mru-window frame nil nil t t)))
(and mru-window
(set-frame-selected-window frame mru-window)))))
((and (window-parameter
diff --git a/lisp/simple.el b/lisp/simple.el
index 84928caa31..73c5840e02 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9252,6 +9278,7 @@ completion-setup-function
(setq-local completion-base-position base-position)
(setq-local completion-list-insert-choice-function insert-fun))
(setq-local completion-reference-buffer mainbuf)
+ (setq-local delete-window-choose-selected 'mru)
(if base-dir (setq default-directory base-dir))
(when completion-tab-width
(setq tab-width completion-tab-width))
next prev parent reply other threads:[~2021-12-17 8:25 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 [this message]
2021-12-17 12:04 ` Eli Zaretskii
2021-12-18 9:05 ` martin rudalics
2021-12-18 17:20 ` Juri Linkov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86tuf73aen.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=52491@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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.