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 | acd2cde3b603bcc48dc02337398f7418bad3fa29 (patch) | |
tree | bd892072740fdb7a827228838d0a9fa83dce76ec /elisp | |
parent | 841681e4360b08820bf1e9e0b260a83139d30911 (diff) | |
download | geiser-chez-acd2cde3b603bcc48dc02337398f7418bad3fa29.tar.gz geiser-chez-acd2cde3b603bcc48dc02337398f7418bad3fa29.tar.bz2 |
Make next-error (C-x `) work on debug buffers
Diffstat (limited to 'elisp')
-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: |