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 | 759da77c957816820803d525ed8779224a89aec3 (patch) | |
| tree | db3228b4526dafd42d6a7259d1eaaffcdda71ce4 | |
| parent | 02c0f7b213c52fb5643fc4578d68af8d43991530 (diff) | |
| download | geiser-759da77c957816820803d525ed8779224a89aec3.tar.gz geiser-759da77c957816820803d525ed8779224a89aec3.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) | 
