]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/tq.el
(lisp-mode-shared-map): Bind `backspace' to `backward-delete-char-untabify'.
[gnu-emacs] / lisp / emacs-lisp / tq.el
index e0524bb6e19cb405e0b6fcff2c36a724d02bb71b..41839c8f11f5e8372c08951dde5591d362f8e1e8 100644 (file)
@@ -87,14 +87,10 @@ that's how we tell where the answer ends."
 
 (defun tq-filter (tq string)
   "Append STRING to the TQ's buffer; then process the new data."
-  (let ((old-buffer (current-buffer)))
-    (unwind-protect
-       (save-match-data
-         (set-buffer (tq-buffer tq))
-         (goto-char (point-max))
-         (insert string)
-         (tq-process-buffer tq))
-      (set-buffer old-buffer))))
+  (with-current-buffer (tq-buffer tq)
+    (goto-char (point-max))
+    (insert string)
+    (tq-process-buffer tq)))
 
 (defun tq-process-buffer (tq)
   "Check TQ's buffer for the regexp at the head of the queue."
@@ -112,10 +108,13 @@ that's how we tell where the answer ends."
       (if (re-search-forward (tq-queue-head-regexp tq) nil t)
          (let ((answer (buffer-substring (point-min) (point))))
            (delete-region (point-min) (point))
-           (funcall (tq-queue-head-fn tq)
-                    (tq-queue-head-closure tq)
-                    answer)
-           (tq-queue-pop tq)
+           (unwind-protect
+               (condition-case nil
+                   (funcall (tq-queue-head-fn tq)
+                            (tq-queue-head-closure tq)
+                            answer)
+                 (error nil))
+             (tq-queue-pop tq))
            (tq-process-buffer tq))))))
 
 (provide 'tq)