emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/xref 93edcf7: xref-goto-xref: Use other window or


From: Dmitry Gutov
Subject: [Emacs-diffs] scratch/xref 93edcf7: xref-goto-xref: Use other window or frame as appropriate
Date: Sun, 21 Dec 2014 01:11:26 +0000

branch: scratch/xref
commit 93edcf76c14e5f89f30089ffe275b810066d5c07
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    xref-goto-xref: Use other window or frame as appropriate
---
 lisp/progmodes/xref.el |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 54e2028..9f177ac 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -328,11 +328,15 @@ WINDOW controls how the buffer is displayed:
   (or (get-text-property (point) 'xref-location)
       (error "No reference at point")))
 
+(defvar-local xref--window nil)
+
 (defun xref-goto-xref ()
-  "Jump to the xref at point and close the xref buffer."
+  "Jump to the xref at point and bury the xref buffer."
   (interactive)
-  (quit-window)
-  (xref--show-location (xref--location-at-point)))
+  (let ((loc (xref--location-at-point))
+        (window xref--window))
+    (quit-window)
+    (xref--pop-to-location loc window)))
 
 (define-derived-mode xref--xref-buffer-mode fundamental-mode "XREF"
   "Mode for displaying cross-refenences."
@@ -376,7 +380,7 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
                     (xref-location-group (xref--xref-location x)))
                   #'equal))
 
-(defun xref--show-xref-buffer (xrefs)
+(defun xref--show-xref-buffer (xrefs window)
   (let ((xref-alist (xref--analyze xrefs)))
     (with-current-buffer (get-buffer-create xref-buffer-name)
       (let ((inhibit-read-only t))
@@ -385,6 +389,7 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
         (xref--xref-buffer-mode)
         (pop-to-buffer (current-buffer))
         (goto-char (point-min))
+        (setq xref--window window)
         (current-buffer)))))
 
 
@@ -406,7 +411,7 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
     (xref--pop-to-location (xref--xref-location (car xrefs)) window))
    (t
     (xref-push-marker-stack)
-    (funcall xref-show-xrefs-function xrefs))))
+    (funcall xref-show-xrefs-function xrefs window))))
 
 (defun xref--read-identifier (prompt)
   "Return the identifier at point or read it from the minibuffer."
@@ -440,7 +445,7 @@ With prefix argument, prompt for the identifier."
 
 ;;;###autoload
 (defun xref-find-definitions-other-frame (identifier)
-  "Like `xref-find-definitions' but switch to the other window."
+  "Like `xref-find-definitions' but switch to the other frame."
   (interactive (list (xref--read-identifier "Find definitions of: ")))
   (xref--find-definitions identifier 'frame))
 



reply via email to

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