changeset 16203:5a8275a74b25

(tq-filter): Add unwind-protect and save-match-data.
author Richard M. Stallman <rms@gnu.org>
date Sun, 15 Sep 1996 18:38:49 +0000
parents 68eb8e1eeb13
children 7cd96606306e
files lisp/emacs-lisp/tq.el
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/tq.el	Sun Sep 15 02:18:43 1996 +0000
+++ b/lisp/emacs-lisp/tq.el	Sun Sep 15 18:38:49 1996 +0000
@@ -87,10 +87,14 @@
 
 (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."