From ba932f095a7078d602802940f326216e85a847ce Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 14 Feb 2011 06:10:50 +0100 Subject: 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. --- elisp/geiser-connection.el | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'elisp/geiser-connection.el') 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 -- cgit v1.2.3