From 14603e08e2297dfab3c32f8181b346982d291ba6 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 15 Sep 1996 18:38:49 +0000 Subject: [PATCH] (tq-filter): Add unwind-protect and save-match-data. --- lisp/emacs-lisp/tq.el | 12 ++++++++---- 1 file 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." -- 2.39.2