diff options
| author | Helmut Eller | 2015-04-30 03:41:34 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-04-30 03:41:42 +0300 |
| commit | fa175b449597256dc4cb0411ce1978aa2016c170 (patch) | |
| tree | b131fe05e5b589dfbbc623a4c117222f02ccc59e | |
| parent | 8b7e2c495af65d28ae1320f52f7a08a6a0920ee1 (diff) | |
| download | emacs-fa175b449597256dc4cb0411ce1978aa2016c170.tar.gz emacs-fa175b449597256dc4cb0411ce1978aa2016c170.zip | |
Set next-error-* in xref--xref-buffer-mode
* xref.el (xref--xref-buffer-mode): Set `next-error-function' and
`next-error-last-buffer'.
(xref--next-error-function): New function.
(http://lists.gnu.org/archive/html/emacs-devel/2015-04/msg01311.html)
| -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. |