diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-09-07 01:45:18 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-09-07 01:45:18 +0200 |
commit | 9d596fa6baed97d8ca57b76934c100d0f7fedcae (patch) | |
tree | 7e013d34b4237632cf2e47f7ada3e54d941a4e54 | |
parent | c21b375451a6b47bcb922514a962c9e2dabcf3f0 (diff) | |
download | geiser-9d596fa6baed97d8ca57b76934c100d0f7fedcae.tar.gz geiser-9d596fa6baed97d8ca57b76934c100d0f7fedcae.tar.bz2 |
Make next-error (C-x `) work on debug buffers
-rw-r--r-- | elisp/geiser-debug.el | 2 | ||||
-rw-r--r-- | elisp/geiser-edit.el | 30 |
2 files changed, 29 insertions, 3 deletions
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el index 7f70d19..7b47cd7 100644 --- a/elisp/geiser-debug.el +++ b/elisp/geiser-debug.el @@ -11,6 +11,7 @@ +(require 'geiser-edit) (require 'geiser-autodoc) (require 'geiser-impl) (require 'geiser-eval) @@ -37,6 +38,7 @@ (set-syntax-table scheme-mode-syntax-table) (setq mode-name "Geiser DBG") (setq major-mode 'geiser-debug-mode) + (setq next-error-function 'geiser-edit--open-next) (setq buffer-read-only t)) (defun geiser-debug--button-p (nextp) diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el index 55106d3..8af56c8 100644 --- a/elisp/geiser-edit.el +++ b/elisp/geiser-edit.el @@ -145,8 +145,9 @@ or following links in error buffers.") (defconst geiser-edit--default-file-rx "^\\([^<>:\n\"]+\\):\\([0-9]+\\):\\([0-9]+\\)") -(defun geiser-edit--buttonize-files (&optional rx) - (let ((rx (or rx geiser-edit--default-file-rx))) +(defun geiser-edit--buttonize-files (&optional rx no-fill) + (let ((rx (or rx geiser-edit--default-file-rx)) + (fill-column (- (window-width) 2))) (save-excursion (while (re-search-forward rx nil t) (geiser-edit--make-link (match-beginning 1) @@ -154,7 +155,30 @@ or following links in error buffers.") (match-string 1) (match-string 2) (match-string 3) - 'window))))) + 'window) + (unless no-fill (fill-region (match-beginning 0) (point-at-eol))))))) + +(defun geiser-edit--open-next (&optional n reset) + (interactive) + (let* ((n (or n 1)) + (nxt (if (< n 0) 'backward-button 'forward-button)) + (msg (if (< n 0) "previous" "next")) + (n (abs n)) + (p (point)) + (found nil)) + (when reset (goto-char (point-min))) + (while (> n 0) + (let ((b (ignore-errors (funcall nxt 1)))) + (unless b (setq n 0)) + (when (and b (eq (button-type b) 'geiser-edit--button)) + (setq n (- n 1)) + (when (<= n 0) + (setq found t) + (push-button (point)))))) + (unless found + (goto-char p) + (error "No %s error" msg)))) + ;;; Commands: |