]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix regressions in xref-find-definitions and ...-other-window
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 16 Jun 2019 00:49:46 +0000 (03:49 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 16 Jun 2019 00:50:54 +0000 (03:50 +0300)
* lisp/progmodes/xref.el:
(xref--display-buffer-in-other-window)
(xref--display-buffer-in-window): New functions.
(xref--show-pos-in-buf): Use them (bug#33870)

lisp/progmodes/xref.el

index e88f30ca35855b62c825b538769ab283305da202..8769641b08419fd1398dcc5828d0acf1489b0787 100644 (file)
@@ -492,13 +492,14 @@ and finally return the window."
           (cond ((eq xref--original-window-intent 'frame)
                  t)
                 ((eq xref--original-window-intent 'window)
-                 '(display-buffer-same-window))
+                 `((xref--display-buffer-in-other-window)
+                   (window . ,xref--original-window)))
                 ((and
                   (window-live-p xref--original-window)
                   (or (not (window-dedicated-p xref--original-window))
                       (eq (window-buffer xref--original-window) buf)))
-                 `((display-buffer-in-previous-window)
-                   (previous-window . ,xref--original-window))))))
+                 `((xref--display-buffer-in-window)
+                   (window . ,xref--original-window))))))
     (with-selected-window (display-buffer buf action)
       (xref--goto-char pos)
       (run-hooks 'xref-after-jump-hook)
@@ -507,6 +508,19 @@ and finally return the window."
           (setq-local other-window-scroll-buffer buf)))
       (selected-window))))
 
+(defun xref--display-buffer-in-other-window (buffer alist)
+  (let ((window (assoc-default 'window alist)))
+    (cl-assert window)
+    (xref--with-dedicated-window
+     (with-selected-window window
+       (display-buffer buffer t)))))
+
+(defun xref--display-buffer-in-window (buffer alist)
+  (let ((window (assoc-default 'window alist)))
+    (cl-assert window)
+    (with-selected-window window
+      (display-buffer buffer '(display-buffer-same-window)))))
+
 (defun xref--show-location (location &optional select)
   "Help `xref-show-xref' and `xref-goto-xref' do their job.
 Go to LOCATION and if SELECT is non-nil select its window.  If