diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-07 02:26:44 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-07 02:26:44 +0200 |
commit | e00cf1fd0a98d168a71c9eff1fe086a1e664680a (patch) | |
tree | 1f64bfcf195c5a611eb53198bcd61ee77531de21 | |
parent | f0db115f00abb485c0197de931aa4f233d764e5f (diff) | |
download | geiser-guile-e00cf1fd0a98d168a71c9eff1fe086a1e664680a.tar.gz geiser-guile-e00cf1fd0a98d168a71c9eff1fe086a1e664680a.tar.bz2 |
Oops, it wasn't dead.
-rw-r--r-- | elisp/geiser-guile.el | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 9855a11..b76228e 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -100,6 +100,47 @@ This function uses `geiser-guile-init-file' if it exists." (save-excursion (skip-syntax-backward "^-()>") (point)))) +;;; Error display +(defvar geiser-guile--file-cache (make-hash-table :test 'equal)) + +(defun geiser-guile--resolve-file (file) + (when (and (stringp file) (not (string-equal file "unknown file"))) + (if (file-name-absolute-p file) file + (or (gethash file geiser-guile--file-cache) + (puthash file + (geiser-eval--send/result `(:eval ((:ge find-file) ,file))) + geiser-guile--file-cache))))) + +(defconst geiser-guile--file-rx + "^In \\([^\n:]+\\):\n *\\([[:digit:]]+\\|\\?\\):") + +(defun geiser-guile--find-files () + (with--geiser-implementation 'guile + (save-excursion + (while (re-search-forward geiser-guile--file-rx nil t) + (let ((file (match-string 1)) + (beg (match-beginning 1)) + (end (match-end 1)) + (line (string-to-number (or (match-string 2) "0")))) + (let ((file (geiser-guile--resolve-file file))) + (when file + (geiser-edit--make-link beg end file line 0)))))))) + +(defun geiser-guile--display-error (module key msg) + (if (eq key 'geiser-debugger) + (comint-send-string nil "bt\n") + (when key + (insert "Error: ") + (geiser--insert-with-face (format "%s" key) 'bold) + (newline 2)) + (when msg + (let ((p (point))) + (insert msg) + (goto-char p) + (geiser-guile--find-files))) + t)) + + ;;; Trying to ascertain whether a buffer is Guile Scheme: (defun geiser-guile--guess () @@ -157,7 +198,7 @@ This function uses `geiser-guile-init-file' if it exists." (find-module geiser-guile--get-module) (enter-command geiser-guile--enter-command) (find-symbol-begin geiser-guile--symbol-begin) - (display-error) + (display-error geiser-guile--display-error) (display-help) (check-buffer geiser-guile--guess)) |