emacs-31 13814795727: Improve the previous fix in toggle-window-dedicated

Juri Linkov <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 13814795727e1ca23db6b70b83b459bbfbaa5579
Author: Juri Linkov <[email protected]>
Commit: Juri Linkov <[email protected]>

    Improve the previous fix in toggle-window-dedicated
    
    * lisp/window.el (toggle-window-dedicated):
    Don't select the window by mouse click in another window.
    This keeps the currently selected window like for
    toggling other indicators on the mode-line (bug#81178).
---
 lisp/window.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/window.el b/lisp/window.el
index 5f00801d55c..35b49a19a5e 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7993,7 +7993,13 @@ variable to t, strong dedication will be used by default and
 \\[universal-argument] will make the window weakly dedicated.
 
 See the info node `(elisp)Dedicated Windows' for more details."
-  (interactive "@i\nP\np")
+  (interactive "i\nP\np")
+
+  (when (and (not window) (mouse-event-p last-input-event))
+    (let ((event-window (posn-window (event-start last-input-event))))
+      (unless (eq (selected-window) event-window)
+        (setq window event-window))))
+
   (setq window (window-normalize-window window))
   (setq flag (cond
               ((consp flag)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.