summaryrefslogtreecommitdiff
path: root/lisp/=timer.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-11-17 16:50:21 +0000
committerRichard M. Stallman <rms@gnu.org>1994-11-17 16:50:21 +0000
commit5d96b2d5aecaaaa367ef2f5c902f54e80d9786c6 (patch)
tree8e1af7173765502dbaf2599c90688b38ef38ef6f /lisp/=timer.el
parentba9ff0046101e449c2453731ceb1b1350d3a60f6 (diff)
downloademacs-5d96b2d5aecaaaa367ef2f5c902f54e80d9786c6.tar.gz
(timer-process-filter): Use save-match-data.
Diffstat (limited to 'lisp/=timer.el')
-rw-r--r--lisp/=timer.el57
1 files changed, 29 insertions, 28 deletions
diff --git a/lisp/=timer.el b/lisp/=timer.el
index 446abd426b4..b23b3a9184d 100644
--- a/lisp/=timer.el
+++ b/lisp/=timer.el
@@ -124,34 +124,35 @@ will happen at the specified time."
(setcar (cdr (cdr elt)) 'ignore))
(defun timer-process-filter (proc str)
- (setq timer-out (concat timer-out str))
- (let (do token error)
- (while (string-match "\n" timer-out)
- (setq token (substring timer-out 0 (match-beginning 0))
- do (assoc token timer-alist)
- timer-out (substring timer-out (match-end 0)))
- (cond
- (do
- (apply (nth 2 do) (nth 3 do)) ; do it
- (if (natnump (nth 1 do)) ; reschedule it
- (send-string proc (concat (nth 1 do) " sec@" (car do) "\n"))
- (setq timer-alist (delq do timer-alist))))
- ((string-match "timer: \\([^:]+\\): \\([^@]*\\)@\\(.*\\)$" token)
- (setq error (substring token (match-beginning 1) (match-end 1))
- do (substring token (match-beginning 2) (match-end 2))
- token (assoc (substring token (match-beginning 3) (match-end 3))
- timer-alist)
- timer-alist (delq token timer-alist))
- (or timer-alist
- timer-dont-exit
- (process-send-eof proc))
- ;; Update error message for this particular instance
- (put 'timer-filter-error
- 'error-message
- (format "%s for %s; couldn't set at \"%s\""
- error (nth 2 token) do))
- (signal 'timer-filter-error (list proc str)))))
- (or timer-alist timer-dont-exit (process-send-eof proc))))
+ (save-match-data
+ (setq timer-out (concat timer-out str))
+ (let (do token error)
+ (while (string-match "\n" timer-out)
+ (setq token (substring timer-out 0 (match-beginning 0))
+ do (assoc token timer-alist)
+ timer-out (substring timer-out (match-end 0)))
+ (cond
+ (do
+ (apply (nth 2 do) (nth 3 do)) ; do it
+ (if (natnump (nth 1 do)) ; reschedule it
+ (send-string proc (concat (nth 1 do) " sec@" (car do) "\n"))
+ (setq timer-alist (delq do timer-alist))))
+ ((string-match "timer: \\([^:]+\\): \\([^@]*\\)@\\(.*\\)$" token)
+ (setq error (substring token (match-beginning 1) (match-end 1))
+ do (substring token (match-beginning 2) (match-end 2))
+ token (assoc (substring token (match-beginning 3) (match-end 3))
+ timer-alist)
+ timer-alist (delq token timer-alist))
+ (or timer-alist
+ timer-dont-exit
+ (process-send-eof proc))
+ ;; Update error message for this particular instance
+ (put 'timer-filter-error
+ 'error-message
+ (format "%s for %s; couldn't set at \"%s\""
+ error (nth 2 token) do))
+ (signal 'timer-filter-error (list proc str)))))
+ (or timer-alist timer-dont-exit (process-send-eof proc)))))
(defun timer-process-sentinel (proc str)
(let ((stat (process-status proc)))