]> git.eshelyaron.com Git - emacs.git/commitdiff
xref-goto-xref: Set input focus in addition to selecting window
authorMiha Rihtaršič <miha@kamnitnik.top>
Sun, 19 Jun 2022 13:29:59 +0000 (15:29 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 20 Jun 2022 00:44:14 +0000 (03:44 +0300)
* lisp/progmodes/xref.el (xref--show-location): Set input focus in
addition to selecting displayed window (Bug#55983).

lisp/progmodes/xref.el

index 683589d71c6a5d3bd408eb9559fde3e83af75257..0213ab3cc58171c274106b453b883730fb68d40d 100644 (file)
@@ -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