diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-01-03 01:45:13 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-01-03 01:45:13 +0100 |
commit | 7342870bfce4071673936597559ae60ffcba03b2 (patch) | |
tree | f5981ae0636cd8c985d724f6b1932bbe378f4ee8 /elisp | |
parent | 95af5d35139f8d8825dcfa2381a5bc16d46e0043 (diff) | |
download | geiser-chez-7342870bfce4071673936597559ae60ffcba03b2.tar.gz geiser-chez-7342870bfce4071673936597559ae60ffcba03b2.tar.bz2 |
Really avoiding *spurious* buffers
My previous attempt was bogus! Also, i'm taking advantage of our
sending queries serially to simplify transaction queue processing, and
to clean after ourserlves on error.
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-connection.el | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el index 3638e12..cade18a 100644 --- a/elisp/geiser-connection.el +++ b/elisp/geiser-connection.el @@ -73,13 +73,21 @@ 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))) + (when (buffer-live-p (tq-buffer tq)) + (with-current-buffer (tq-buffer tq) + (if (tq-queue-empty tq) + (progn (geiser-log--error "Unexpected queue input:\n %s" in) + (delete-region (point-min) (point-max))) + (goto-char (point-max)) + (insert in) + (goto-char (point-min)) + (when (re-search-forward (tq-queue-head-regexp tq) nil t) + (unwind-protect + (funcall (tq-queue-head-fn tq) + (tq-queue-head-closure tq) + (buffer-substring (point-min) (point))) + (delete-region (point-min) (point-max)) + (tq-queue-pop tq))))))) (defun geiser-con--combined-prompt (prompt debug) (format "\\(%s%s\\)" prompt (if debug (format "\\|%s" debug) ""))) |