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
commit55c37c72c7a0c04c1ca2e1642776c673c6c6a3a7 (patch)
treeeddb4f07b9504c9efbc148cc1b9297d758ac412c
parent5835dc58d7dc06b68103fd3a726b8723b7b55936 (diff)
downloadgeiser-guile-55c37c72c7a0c04c1ca2e1642776c673c6c6a3a7.tar.gz
geiser-guile-55c37c72c7a0c04c1ca2e1642776c673c6c6a3a7.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)