emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9c359b0cec: xref-goto-xref: Set input focus in addition to select


From: Dmitry Gutov
Subject: master 9c359b0cec: xref-goto-xref: Set input focus in addition to selecting window
Date: Sun, 19 Jun 2022 20:46:17 -0400 (EDT)

branch: master
commit 9c359b0cec5248871fb0ddb9f1f3bc84fffd4dd5
Author: Miha Rihtaršič <miha@kamnitnik.top>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    xref-goto-xref: Set input focus in addition to selecting window
    
    * lisp/progmodes/xref.el (xref--show-location): Set input focus in
    addition to selecting displayed window (Bug#55983).
---
 lisp/progmodes/xref.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 683589d71c..0213ab3cc5 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -645,9 +645,15 @@ SELECT is `quit', also quit the *xref* window."
              (xref-buffer (current-buffer)))
         (cond (select
                (if (eq select 'quit) (quit-window nil nil))
-               (select-window
-                (with-current-buffer xref-buffer
-                  (xref--show-pos-in-buf marker buf))))
+               (let* ((old-frame (selected-frame))
+                      (window (with-current-buffer xref-buffer
+                                (xref--show-pos-in-buf marker buf)))
+                      (frame (window-frame window)))
+                 ;; If we chose another frame, make sure it gets input
+                 ;; focus.
+                 (unless (eq frame old-frame)
+                   (select-frame-set-input-focus frame))
+                 (select-window window)))
               (t
                (save-selected-window
                  (xref--with-dedicated-window



reply via email to

[Prev in Thread] Current Thread [Next in Thread]