aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2019-06-16 03:49:46 +0300
committerDmitry Gutov2019-06-16 03:50:54 +0300
commit83095a89f69f92833401ee437c8e455a4834c2c6 (patch)
treea9a7dd73e7dddcb24ffd3a0bc39f4509b08ef119
parentcdd8cb3a9e18f87da31e52236fd2c4ebfcd676bd (diff)
downloademacs-83095a89f69f92833401ee437c8e455a4834c2c6.tar.gz
emacs-83095a89f69f92833401ee437c8e455a4834c2c6.zip
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)
-rw-r--r--lisp/progmodes/xref.el20
1 files 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."
492 (cond ((eq xref--original-window-intent 'frame) 492 (cond ((eq xref--original-window-intent 'frame)
493 t) 493 t)
494 ((eq xref--original-window-intent 'window) 494 ((eq xref--original-window-intent 'window)
495 '(display-buffer-same-window)) 495 `((xref--display-buffer-in-other-window)
496 (window . ,xref--original-window)))
496 ((and 497 ((and
497 (window-live-p xref--original-window) 498 (window-live-p xref--original-window)
498 (or (not (window-dedicated-p xref--original-window)) 499 (or (not (window-dedicated-p xref--original-window))
499 (eq (window-buffer xref--original-window) buf))) 500 (eq (window-buffer xref--original-window) buf)))
500 `((display-buffer-in-previous-window) 501 `((xref--display-buffer-in-window)
501 (previous-window . ,xref--original-window)))))) 502 (window . ,xref--original-window))))))
502 (with-selected-window (display-buffer buf action) 503 (with-selected-window (display-buffer buf action)
503 (xref--goto-char pos) 504 (xref--goto-char pos)
504 (run-hooks 'xref-after-jump-hook) 505 (run-hooks 'xref-after-jump-hook)
@@ -507,6 +508,19 @@ and finally return the window."
507 (setq-local other-window-scroll-buffer buf))) 508 (setq-local other-window-scroll-buffer buf)))
508 (selected-window)))) 509 (selected-window))))
509 510
511(defun xref--display-buffer-in-other-window (buffer alist)
512 (let ((window (assoc-default 'window alist)))
513 (cl-assert window)
514 (xref--with-dedicated-window
515 (with-selected-window window
516 (display-buffer buffer t)))))
517
518(defun xref--display-buffer-in-window (buffer alist)
519 (let ((window (assoc-default 'window alist)))
520 (cl-assert window)
521 (with-selected-window window
522 (display-buffer buffer '(display-buffer-same-window)))))
523
510(defun xref--show-location (location &optional select) 524(defun xref--show-location (location &optional select)
511 "Help `xref-show-xref' and `xref-goto-xref' do their job. 525 "Help `xref-show-xref' and `xref-goto-xref' do their job.
512Go to LOCATION and if SELECT is non-nil select its window. If 526Go to LOCATION and if SELECT is non-nil select its window. If