From e19c1c301700430ae428f40c2a364671f5d50dcf Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 22 Feb 2016 00:40:53 +0200 Subject: [PATCH] Kill off xref--display-history Now that the core workflow keeps the xref window visible, there's less value in storing this history. And it never was comprehensive enough to undo scrolling changes. * lisp/progmodes/xref.el (xref--display-history) (xref--save-to-history, xref-quit): Remove. (xref--show-pos-in-buf): Update accordingly. (xref--xref-buffer-mode-map): Remove xref-quit binding. --- lisp/progmodes/xref.el | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 31a03d9d1e9..f983525e928 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -437,16 +437,6 @@ If SELECT is non-nil, select the target window." ;; The xref buffer is used to display a set of xrefs. -(defvar-local xref--display-history nil - "List of pairs (BUFFER . WINDOW), for temporarily displayed buffers.") - -(defun xref--save-to-history (buf win) - (let ((restore (window-parameter win 'quit-restore))) - ;; Save the new entry if the window displayed another buffer - ;; previously. - (when (and restore (not (eq (car restore) 'same))) - (push (cons buf win) xref--display-history)))) - (defmacro xref--with-dedicated-window (&rest body) `(let* ((xref-w (get-buffer-window xref-buffer-name)) (xref-w-dedicated (window-dedicated-p xref-w))) @@ -469,8 +459,7 @@ If SELECT is non-nil, select the target window." (let ((buf (current-buffer))) (setq win (selected-window)) (with-current-buffer xref-buf - (setq-local other-window-scroll-buffer buf) - (xref--save-to-history buf win)))) + (setq-local other-window-scroll-buffer buf)))) (when select (select-window win)))) @@ -606,7 +595,6 @@ references displayed in the current *xref* buffer." (defvar xref--xref-buffer-mode-map (let ((map (make-sparse-keymap))) - (define-key map [remap quit-window] #'xref-quit) (define-key map (kbd "n") #'xref-next-line) (define-key map (kbd "p") #'xref-prev-line) (define-key map (kbd "r") #'xref-query-replace-in-results) @@ -638,23 +626,6 @@ references displayed in the current *xref* buffer." (t (error "No %s xref" (if backward "previous" "next")))))) -(defun xref-quit (&optional kill) - "Bury temporarily displayed buffers, then quit the current window. - -If KILL is non-nil, also kill the current buffer. - -The buffers that the user has otherwise interacted with in the -meantime are preserved." - (interactive "P") - (let ((window (selected-window)) - (history xref--display-history)) - (setq xref--display-history nil) - (pcase-dolist (`(,buf . ,win) history) - (when (and (window-live-p win) - (eq buf (window-buffer win))) - (quit-window nil win))) - (quit-window kill window))) - (defconst xref-buffer-name "*xref*" "The name of the buffer to show xrefs.") -- 2.39.2