From 83095a89f69f92833401ee437c8e455a4834c2c6 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 16 Jun 2019 03:49:46 +0300 Subject: [PATCH] Fix regressions in xref-find-definitions and ...-other-window * 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 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index e88f30ca358..8769641b084 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -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 -- 2.39.2