summaryrefslogtreecommitdiff
path: root/elisp/geiser-guile.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-03-13 03:49:22 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-03-13 03:49:22 +0100
commiteb1f0a9362c8b6b19d3f4e41d32f89b94d17e873 (patch)
treef71d0b7fb69e268c9211d344985c0d27d98fc455 /elisp/geiser-guile.el
parent495a4b9bb253cb4dc443ae45fbdc2e02b7e81e4f (diff)
downloadgeiser-chez-eb1f0a9362c8b6b19d3f4e41d32f89b94d17e873.tar.gz
geiser-chez-eb1f0a9362c8b6b19d3f4e41d32f89b94d17e873.tar.bz2
Guile: heuristically resolving relative paths in REPL errors.
Diffstat (limited to 'elisp/geiser-guile.el')
-rw-r--r--elisp/geiser-guile.el37
1 files changed, 35 insertions, 2 deletions
diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el
index 0523dfe..db4b27d 100644
--- a/elisp/geiser-guile.el
+++ b/elisp/geiser-guile.el
@@ -150,11 +150,44 @@ This function uses `geiser-guile-init-file' if it exists."
;;; Compilation shell regexps
+
+(defconst geiser-guile--path-rx "^In \\([^:\n]+\\):\n")
+
+(defconst geiser-guile--rel-path-rx
+ "^In \\([^/\n]+.+?/module/\\([^:\n]+\\)\\):\n")
+
+(make-variable-buffer-local
+ (defvar geiser-guile--load-path nil))
+
+(defun geiser-guile--load-path ()
+ (geiser-eval--send/result `(:eval (:scm "%load-path"))))
+
+(defun geiser-guile--find-in-load-path (f ps)
+ (when ps
+ (let ((c (expand-file-name f (car ps))))
+ (or (and (file-exists-p c) c)
+ (geiser-guile--find-in-load-path f (cdr ps))))))
+
+(defun geiser-guile--resolve-file-x ()
+ (let ((f (match-string-no-properties 1)))
+ (if (file-name-absolute-p f)
+ (list f)
+ (let ((p (match-string-no-properties 0)))
+ (when (string-match geiser-guile--rel-path-rx p)
+ (let ((f (geiser-guile--find-in-load-path
+ (match-string-no-properties 2 p)
+ geiser-guile--load-path)))
+ (and f (list f))))))))
+
(defun geiser-guile--startup ()
(set (make-local-variable 'compilation-error-regexp-alist)
- '(("^In \\(/[^:\n]+\\):\n +\\([0-9]+\\): +" 1 2)
+ `((,geiser-guile--path-rx geiser-guile--resolve-file-x)
+ ("^ +\\([0-9]+\\): +" nil 1)
("at \\(/[^:\n]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)" 1 2 3)))
- (compilation-setup t))
+ (setq geiser-guile--load-path (geiser-guile--load-path))
+ (compilation-setup t)
+ (font-lock-add-keywords
+ nil `((,geiser-guile--path-rx 1 compilation-error-face))))
;;; Implementation definition: