diff options
| -rw-r--r-- | lisp/progmodes/xref.el | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 9f1068668b1..fc27c268845 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -444,7 +444,22 @@ Used for temporary buffers.") | |||
| 444 | 444 | ||
| 445 | (define-derived-mode xref--xref-buffer-mode special-mode "XREF" | 445 | (define-derived-mode xref--xref-buffer-mode special-mode "XREF" |
| 446 | "Mode for displaying cross-references." | 446 | "Mode for displaying cross-references." |
| 447 | (setq buffer-read-only t)) | 447 | (setq buffer-read-only t) |
| 448 | (setq next-error-function #'xref--next-error-function) | ||
| 449 | (setq next-error-last-buffer (current-buffer))) | ||
| 450 | |||
| 451 | (defun xref--next-error-function (n reset?) | ||
| 452 | (when reset? | ||
| 453 | (goto-char (point-min))) | ||
| 454 | (let ((backward (< n 0)) | ||
| 455 | (n (abs n)) | ||
| 456 | (loc nil)) | ||
| 457 | (dotimes (_ n) | ||
| 458 | (setq loc (xref--search-property 'xref-location backward))) | ||
| 459 | (cond (loc | ||
| 460 | (xref--pop-to-location loc)) | ||
| 461 | (t | ||
| 462 | (error "No %s xref" (if backward "previous" "next")))))) | ||
| 448 | 463 | ||
| 449 | (defun xref-quit (&optional kill) | 464 | (defun xref-quit (&optional kill) |
| 450 | "Bury temporarily displayed buffers, then quit the current window. | 465 | "Bury temporarily displayed buffers, then quit the current window. |