diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-12-14 22:57:18 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-12-14 22:57:18 +0100 |
commit | 8cac1fd62779f6552ce4e5ac5d8f9a886526420d (patch) | |
tree | e897bfa4df14d1e7e4d691838465188829e2508e | |
parent | 41f4dcc669f809dd3a73f78b81f50f780f152aeb (diff) | |
download | geiser-guile-8cac1fd62779f6552ce4e5ac5d8f9a886526420d.tar.gz geiser-guile-8cac1fd62779f6552ce4e5ac5d8f9a886526420d.tar.bz2 |
No more vicious error circle on tq errors
I've eliminated the annoying *spurious* popup produced by tq, so that
Geiser can recover from error conditions arising from unexpected
input to a transaction queue that has no active transaction. We now
log the offending input and keep going.
Greg, over at racket's list, reported such a happening when leaving
the REPL after C-u C-c C-z; but i've been unable to reproduce the
problem. Probably, we have a bug lurking somewhere that this patch
doesn't fix, but at least it should work as a palliative.
-rw-r--r-- | elisp/geiser-connection.el | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el index 509bdf0..49f0b0b 100644 --- a/elisp/geiser-connection.el +++ b/elisp/geiser-connection.el @@ -66,6 +66,21 @@ ;;; Connection datatype: +(defun geiser-con--tq-create (process) + (let ((tq (tq-create process))) + (set-process-filter process + `(lambda (p s) (geiser-con--tq-filter ',tq s))) + tq)) + +(defun geiser-con--tq-filter (tq in) + (if (tq-queue-empty tq) + (let ((buffer (tq-buffer tq))) + (geiser-log--error "Unexpected queue input:\n %s" in) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (delete-region (point-min) (point-max))))) + (tq-filter tq in))) + (defun geiser-con--combined-prompt (prompt debug) (format "\\(%s%s\\)" prompt (if debug (format "\\|%s" debug) ""))) @@ -76,7 +91,7 @@ (defun geiser-con--make-connection (proc prompt debug-prompt) (list t (cons :filter (process-filter proc)) - (cons :tq (tq-create proc)) + (cons :tq (geiser-con--tq-create proc)) (cons :tq-filter (process-filter proc)) (cons :eot (geiser-con--connection-eot-re prompt debug-prompt)) (cons :prompt prompt) |