comparison lisp/emacs-lisp/tq.el @ 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 408eeedc18cd
children b5b7d7552f34
comparison
equal deleted inserted replaced
16202:68eb8e1eeb13 16203:5a8275a74b25
85 (delete-process (tq-process tq)) 85 (delete-process (tq-process tq))
86 (kill-buffer (tq-buffer tq))) 86 (kill-buffer (tq-buffer tq)))
87 87
88 (defun tq-filter (tq string) 88 (defun tq-filter (tq string)
89 "Append STRING to the TQ's buffer; then process the new data." 89 "Append STRING to the TQ's buffer; then process the new data."
90 (set-buffer (tq-buffer tq)) 90 (let ((old-buffer (current-buffer)))
91 (goto-char (point-max)) 91 (unwind-protect
92 (insert string) 92 (save-match-data
93 (tq-process-buffer tq)) 93 (set-buffer (tq-buffer tq))
94 (goto-char (point-max))
95 (insert string)
96 (tq-process-buffer tq))
97 (set-buffer old-buffer))))
94 98
95 (defun tq-process-buffer (tq) 99 (defun tq-process-buffer (tq)
96 "Check TQ's buffer for the regexp at the head of the queue." 100 "Check TQ's buffer for the regexp at the head of the queue."
97 (set-buffer (tq-buffer tq)) 101 (set-buffer (tq-buffer tq))
98 (if (= 0 (buffer-size)) () 102 (if (= 0 (buffer-size)) ()