summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/tq.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/tq.el b/lisp/emacs-lisp/tq.el
index 8654e76fd59..e0524bb6e19 100644
--- a/lisp/emacs-lisp/tq.el
+++ b/lisp/emacs-lisp/tq.el
@@ -87,10 +87,14 @@ 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."
- (set-buffer (tq-buffer tq))
- (goto-char (point-max))
- (insert string)
- (tq-process-buffer tq))
+ (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))))
(defun tq-process-buffer (tq)
"Check TQ's buffer for the regexp at the head of the queue."