all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#52491: 28.0.90; Regression in window deletion with minibuffer
@ 2021-12-14 21:08 Juri Linkov
  2021-12-16 17:28 ` Juri Linkov
  0 siblings, 1 reply; 23+ messages in thread
From: Juri Linkov @ 2021-12-14 21:08 UTC (permalink / raw)
  To: 52491

emacs-28 -Q

 M-x	    ;; execute-extended-command
 <tab>	    ;; minibuffer-complete
 <kp-prior> ;; switch-to-completions
 q	    ;; quit-window

Point moves to the *scratch* buffer.  This is a regression.
In emacs-27 it moved to the minibuffer.

The problem is that delete-window now uses get-mru-window
to get the window to select after deleting the completions window.
But get-mru-window ignores the minibuffer window.
This could be fixed by:

diff --git a/lisp/window.el b/lisp/window.el
index 0f17bb28b4..507eaab705 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2556,7 +2556,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 nil 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))))

Maybe better to add a new argument to get-mru-window
and pass it down to window-list-1.

This problem exists for the default value 'mru' of
delete-window-choose-selected.  When its value is customized
to 'pos' then the *scratch* buffer is selected too,
but for a different reason.  In this case, the *scratch* buffer
is selected instead of the minibuffer because frame coordinates
of point that was previously in the completions window
now belongs to the window of the *scratch* buffer
that now takes screen space previously used by completions.
To prevent this, maybe completion-setup-function should set
buffer-local delete-window-choose-selected to 'mru'
in the completions buffer:

diff --git a/lisp/simple.el b/lisp/simple.el
index 0a58297bd2..08932c689a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9256,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))
diff --git a/lisp/window.el b/lisp/window.el
index 0f17bb28b4..507eaab705 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4205,6 +4205,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 +4256,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,7 +4290,7 @@ 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)))
                  (and mru-window
-- 





^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2021-12-22  9:23 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.