diff options
| author | Dmitry Gutov | 2016-02-22 00:40:53 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2016-02-22 00:57:41 +0200 |
| commit | e19c1c301700430ae428f40c2a364671f5d50dcf (patch) | |
| tree | 2626d7e8ded534016c6120e443f26d085121fd97 | |
| parent | 5698947ff9335cf150c73cca257a5e7e5951b045 (diff) | |
| download | emacs-e19c1c301700430ae428f40c2a364671f5d50dcf.tar.gz emacs-e19c1c301700430ae428f40c2a364671f5d50dcf.zip | |
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.
| -rw-r--r-- | lisp/progmodes/xref.el | 31 |
1 files changed, 1 insertions, 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." | |||
| 437 | 437 | ||
| 438 | ;; The xref buffer is used to display a set of xrefs. | 438 | ;; The xref buffer is used to display a set of xrefs. |
| 439 | 439 | ||
| 440 | (defvar-local xref--display-history nil | ||
| 441 | "List of pairs (BUFFER . WINDOW), for temporarily displayed buffers.") | ||
| 442 | |||
| 443 | (defun xref--save-to-history (buf win) | ||
| 444 | (let ((restore (window-parameter win 'quit-restore))) | ||
| 445 | ;; Save the new entry if the window displayed another buffer | ||
| 446 | ;; previously. | ||
| 447 | (when (and restore (not (eq (car restore) 'same))) | ||
| 448 | (push (cons buf win) xref--display-history)))) | ||
| 449 | |||
| 450 | (defmacro xref--with-dedicated-window (&rest body) | 440 | (defmacro xref--with-dedicated-window (&rest body) |
| 451 | `(let* ((xref-w (get-buffer-window xref-buffer-name)) | 441 | `(let* ((xref-w (get-buffer-window xref-buffer-name)) |
| 452 | (xref-w-dedicated (window-dedicated-p xref-w))) | 442 | (xref-w-dedicated (window-dedicated-p xref-w))) |
| @@ -469,8 +459,7 @@ If SELECT is non-nil, select the target window." | |||
| 469 | (let ((buf (current-buffer))) | 459 | (let ((buf (current-buffer))) |
| 470 | (setq win (selected-window)) | 460 | (setq win (selected-window)) |
| 471 | (with-current-buffer xref-buf | 461 | (with-current-buffer xref-buf |
| 472 | (setq-local other-window-scroll-buffer buf) | 462 | (setq-local other-window-scroll-buffer buf)))) |
| 473 | (xref--save-to-history buf win)))) | ||
| 474 | (when select | 463 | (when select |
| 475 | (select-window win)))) | 464 | (select-window win)))) |
| 476 | 465 | ||
| @@ -606,7 +595,6 @@ references displayed in the current *xref* buffer." | |||
| 606 | 595 | ||
| 607 | (defvar xref--xref-buffer-mode-map | 596 | (defvar xref--xref-buffer-mode-map |
| 608 | (let ((map (make-sparse-keymap))) | 597 | (let ((map (make-sparse-keymap))) |
| 609 | (define-key map [remap quit-window] #'xref-quit) | ||
| 610 | (define-key map (kbd "n") #'xref-next-line) | 598 | (define-key map (kbd "n") #'xref-next-line) |
| 611 | (define-key map (kbd "p") #'xref-prev-line) | 599 | (define-key map (kbd "p") #'xref-prev-line) |
| 612 | (define-key map (kbd "r") #'xref-query-replace-in-results) | 600 | (define-key map (kbd "r") #'xref-query-replace-in-results) |
| @@ -638,23 +626,6 @@ references displayed in the current *xref* buffer." | |||
| 638 | (t | 626 | (t |
| 639 | (error "No %s xref" (if backward "previous" "next")))))) | 627 | (error "No %s xref" (if backward "previous" "next")))))) |
| 640 | 628 | ||
| 641 | (defun xref-quit (&optional kill) | ||
| 642 | "Bury temporarily displayed buffers, then quit the current window. | ||
| 643 | |||
| 644 | If KILL is non-nil, also kill the current buffer. | ||
| 645 | |||
| 646 | The buffers that the user has otherwise interacted with in the | ||
| 647 | meantime are preserved." | ||
| 648 | (interactive "P") | ||
| 649 | (let ((window (selected-window)) | ||
| 650 | (history xref--display-history)) | ||
| 651 | (setq xref--display-history nil) | ||
| 652 | (pcase-dolist (`(,buf . ,win) history) | ||
| 653 | (when (and (window-live-p win) | ||
| 654 | (eq buf (window-buffer win))) | ||
| 655 | (quit-window nil win))) | ||
| 656 | (quit-window kill window))) | ||
| 657 | |||
| 658 | (defconst xref-buffer-name "*xref*" | 629 | (defconst xref-buffer-name "*xref*" |
| 659 | "The name of the buffer to show xrefs.") | 630 | "The name of the buffer to show xrefs.") |
| 660 | 631 | ||