summaryrefslogtreecommitdiff
path: root/elisp/geiser-connection.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2011-02-14 06:10:50 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2011-02-14 06:10:50 +0100
commitba932f095a7078d602802940f326216e85a847ce (patch)
treeb3bba30f76e3a46fac29ac28687fa6233cf40449 /elisp/geiser-connection.el
parent7188073719a1c8668d38cfb32dee258f5dde88a9 (diff)
downloadgeiser-ba932f095a7078d602802940f326216e85a847ce.tar.gz
geiser-ba932f095a7078d602802940f326216e85a847ce.tar.bz2
Guile REPL: bug fix: correctly track debugging status
We weren't tracking the "enter debugger" event correctly, and all evaluations in debug mode were failing. There's still (at least) another bug, because error navigation in backtraces seems broken.
Diffstat (limited to 'elisp/geiser-connection.el')
-rw-r--r--elisp/geiser-connection.el25
1 files changed, 19 insertions, 6 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index d3c99cb..fb16aa6 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -104,6 +104,7 @@
(cons :eot (geiser-con--connection-eot-re prompt debug-prompt))
(cons :prompt prompt)
(cons :debug-prompt debug-prompt)
+ (cons :is-debugging nil)
(cons :count 0)
(cons :completed (make-hash-table :weakness 'value))))
@@ -128,6 +129,18 @@
(defsubst geiser-con--connection-debug-prompt (c)
(cdr (assoc :debug-prompt c)))
+(defsubst geiser-con--connection-is-debugging (c)
+ (cdr (assoc :is-debugging c)))
+
+(defsubst geiser-con--connection-set-debugging (c d)
+ (setcdr (assoc :is-debugging c) d))
+
+(defun geiser-con--connection-update-debugging (c txt)
+ (let* ((dp (geiser-con--connection-debug-prompt c))
+ (is-d (and (stringp dp) (string-match dp txt))))
+ (geiser-con--connection-set-debugging c is-d)
+ is-d))
+
(defsubst geiser-con--connection-completed (c r)
(geiser-con--request-deactivate r)
(puthash (geiser-con--request-id r) r (cdr (assoc :completed c))))
@@ -142,8 +155,8 @@
new))
(defun geiser-con--has-entered-debugger (con answer)
- (let ((dp (geiser-con--connection-debug-prompt con)))
- (and (stringp dp) (string-match dp answer))))
+ (and (not (geiser-con--connection-is-debugging con))
+ (geiser-con--connection-update-debugging con answer)))
(defun geiser-con--connection-close (con)
(let ((tq (geiser-con--connection-tq con)))
@@ -184,10 +197,10 @@
`((error (key . geiser-debugger))
(output . ,answer))
(condition-case err
- (let* ((start (and (string-match "((\\(?:result\\|error\\)" answer)
- (match-beginning 0)))
- (form (car (read-from-string answer start))))
- (and (listp form) form))
+ (let* ((start (string-match "((\\(?:result\\|error\\) " answer))
+ (form (or (and start (car (read-from-string answer start)))
+ `((error . retort-syntax) (output . ,answer)))))
+ form)
(error `((error (key . geiser-con-error))
(output . ,(format "%s\n(%s)"
answer