summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-01-26 18:08:39 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-01-26 18:08:39 +0100
commitdd0ef53303074c1217363d363c1cccc6fcad6dc7 (patch)
treea26c5a328d8f601cd349d15ebb19df1e36a770ba
parent26e9c414608c3e287f736bbedffff291e46e6f40 (diff)
downloadgeiser-guile-dd0ef53303074c1217363d363c1cccc6fcad6dc7.tar.gz
geiser-guile-dd0ef53303074c1217363d363c1cccc6fcad6dc7.tar.bz2
Guile: Minimal support for the new REPL debug mode.
We just don't hang when the REPL enters its debug mode, and salute any attempt at using a Geiser command with a warning (and no result).
-rw-r--r--elisp/geiser-guile.el28
1 files changed, 26 insertions, 2 deletions
diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el
index ccc048c..3008878 100644
--- a/elisp/geiser-guile.el
+++ b/elisp/geiser-guile.el
@@ -48,7 +48,9 @@ started."
;;; REPL support:
(defun geiser-guile--binary ()
- (if (listp geiser-guile-binary) (car geiser-guile-binary) geiser-guile-binary))
+ (if (listp geiser-guile-binary)
+ (car geiser-guile-binary)
+ geiser-guile-binary))
(defun geiser-guile--parameters ()
"Return a list with all parameters needed to start Guile.
@@ -63,9 +65,31 @@ This function uses `geiser-guile-init-file' if it exists."
(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ")
+;;; Catching the debugger
+(make-variable-buffer-local
+ (defvar geiser-guile--is-debugging nil))
+
+(defun geiser-guile--is-debugging ()
+ (with-current-buffer (geiser-repl--get-repl geiser-impl--implementation)
+ geiser-guile--is-debugging))
+
+(defvar geiser-guile--debugger-prompt-regexp "[0-9]+ debug> *$")
+(defun geiser-guile--watch-debugger (str)
+ (setq geiser-guile--is-debugging
+ (string-match-p geiser-guile--debugger-prompt-regexp str)))
+
+(defun geiser-guile--startup ()
+ (add-hook 'comint-output-filter-functions
+ 'geiser-guile--watch-debugger
+ nil
+ t))
+
+
;;; Evaluation support:
(defun geiser-guile--geiser-procedure (proc)
+ (when (geiser-guile--is-debugging)
+ (error "(Guile REPL is in debug mode)"))
(let ((proc (intern (format "ge:%s" (if (eq proc 'eval) 'compile proc)))))
`(@ (geiser emacs) ,proc)))
@@ -145,7 +169,7 @@ This function uses `geiser-guile-init-file' if it exists."
(define-geiser-implementation guile
(binary geiser-guile--binary)
(arglist geiser-guile--parameters)
- (startup)
+ (startup geiser-guile--startup)
(prompt-regexp geiser-guile--prompt-regexp)
(marshall-procedure geiser-guile--geiser-procedure)
(find-module geiser-guile--get-module)