diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-07-20 22:20:16 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-07-20 22:20:16 +0200 |
commit | 1fef55a87f0b10945b185d80f5282fc5fd82997e (patch) | |
tree | ed9b6306576ebefce1aadda5bf8e3255d1178c1b /elisp/geiser-connection.el | |
parent | d0ac61ce118cd8a5a49bf6515d17387bbe258357 (diff) | |
download | geiser-guile-1fef55a87f0b10945b185d80f5282fc5fd82997e.tar.gz geiser-guile-1fef55a87f0b10945b185d80f5282fc5fd82997e.tar.bz2 |
Guile: geiser commands working at the debugging prompt.
Diffstat (limited to 'elisp/geiser-connection.el')
-rw-r--r-- | elisp/geiser-connection.el | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el index 577ca97..dfdb21d 100644 --- a/elisp/geiser-connection.el +++ b/elisp/geiser-connection.el @@ -126,8 +126,15 @@ (make-variable-buffer-local (defvar geiser-con--debugging-prompt-regexp nil)) +(make-variable-buffer-local + (defvar geiser-con--debugging-inhibits-eval t)) + +(make-variable-buffer-local + (defvar geiser-con--debugging-preamble-regexp nil)) + (defun geiser-con--is-debugging () (and geiser-con--debugging-prompt-regexp + geiser-con--debugging-inhibits-eval comint-last-prompt-overlay (string-match-p geiser-con--debugging-prompt-regexp (buffer-substring (overlay-start @@ -135,16 +142,25 @@ (overlay-end comint-last-prompt-overlay))))) +(defsubst geiser-con--has-entered-debugger () + (and geiser-con--debugging-prompt-regexp + (re-search-backward geiser-con--debugging-prompt-regexp nil t) + (or (null geiser-con--debugging-preamble-regexp) + (save-excursion + (re-search-backward geiser-con--debugging-preamble-regexp nil t))))) + (defun geiser-con--cleanup-connection (c) (geiser-con--connection-cancel-timer c)) (defun geiser-con--setup-connection (buffer prompt-regexp - &optional debug-prompt-regexp) + &optional debug-prompt-regexp + debug-preamble-regexp) (with-current-buffer buffer (when geiser-con--connection (geiser-con--cleanup-connection geiser-con--connection)) (setq geiser-con--debugging-prompt-regexp debug-prompt-regexp) + (setq geiser-con--debugging-preamble-regexp debug-preamble-regexp) (setq geiser-con--connection (geiser-con--make-connection buffer)) (geiser-con--setup-comint prompt-regexp debug-prompt-regexp) (geiser-con--connection-start-timer geiser-con--connection) @@ -169,8 +185,7 @@ (defun geiser-con--comint-buffer-form () (with-current-buffer (geiser-con--comint-buffer) (goto-char (point-max)) - (if (and geiser-con--debugging-prompt-regexp - (re-search-backward geiser-con--debugging-prompt-regexp nil t)) + (if (geiser-con--has-entered-debugger) `((error (key . geiser-debugger)) (output . ,(buffer-substring (point-min) (point)))) (condition-case nil @@ -188,6 +203,8 @@ (let* ((buffer (geiser-con--connection-buffer con)) (debug-prompt (with-current-buffer buffer geiser-con--debugging-prompt-regexp)) + (debug-preamble (with-current-buffer buffer + geiser-con--debugging-preamble-regexp)) (req (geiser-con--connection-pop-request con)) (str (and req (geiser-con--request-string req))) (cbuf (geiser-con--comint-buffer))) @@ -197,6 +214,7 @@ (with-current-buffer cbuf (setq comint-redirect-echo-input nil) (setq geiser-con--debugging-prompt-regexp debug-prompt) + (setq geiser-con--debugging-preamble-regexp debug-preamble) (delete-region (point-min) (point-max))) (set-buffer buffer) (if (geiser-con--is-debugging) |