aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-11-22 04:38:30 +0000
committerRichard M. Stallman1994-11-22 04:38:30 +0000
commit1f66361e086553204783f7088a8cf2d4e095e256 (patch)
tree7cc88cfb7d7dc2c63ce1dec62c808911c1a224dc
parent1d56cc39c16d8cd7fd40a151c195b9f366ade48c (diff)
downloademacs-1f66361e086553204783f7088a8cf2d4e095e256.tar.gz
emacs-1f66361e086553204783f7088a8cf2d4e095e256.zip
(timer-process-filter): No need for save-match-data.
-rw-r--r--lisp/timer.el57
1 files changed, 28 insertions, 29 deletions
diff --git a/lisp/timer.el b/lisp/timer.el
index b23b3a9184d..192df175753 100644
--- a/lisp/timer.el
+++ b/lisp/timer.el
@@ -124,35 +124,34 @@ will happen at the specified time."
124 (setcar (cdr (cdr elt)) 'ignore)) 124 (setcar (cdr (cdr elt)) 'ignore))
125 125
126(defun timer-process-filter (proc str) 126(defun timer-process-filter (proc str)
127 (save-match-data 127 (setq timer-out (concat timer-out str))
128 (setq timer-out (concat timer-out str)) 128 (let (do token error)
129 (let (do token error) 129 (while (string-match "\n" timer-out)
130 (while (string-match "\n" timer-out) 130 (setq token (substring timer-out 0 (match-beginning 0))
131 (setq token (substring timer-out 0 (match-beginning 0)) 131 do (assoc token timer-alist)
132 do (assoc token timer-alist) 132 timer-out (substring timer-out (match-end 0)))
133 timer-out (substring timer-out (match-end 0))) 133 (cond
134 (cond 134 (do
135 (do 135 (apply (nth 2 do) (nth 3 do)) ; do it
136 (apply (nth 2 do) (nth 3 do)) ; do it 136 (if (natnump (nth 1 do)) ; reschedule it
137 (if (natnump (nth 1 do)) ; reschedule it 137 (send-string proc (concat (nth 1 do) " sec@" (car do) "\n"))
138 (send-string proc (concat (nth 1 do) " sec@" (car do) "\n")) 138 (setq timer-alist (delq do timer-alist))))
139 (setq timer-alist (delq do timer-alist)))) 139 ((string-match "timer: \\([^:]+\\): \\([^@]*\\)@\\(.*\\)$" token)
140 ((string-match "timer: \\([^:]+\\): \\([^@]*\\)@\\(.*\\)$" token) 140 (setq error (substring token (match-beginning 1) (match-end 1))
141 (setq error (substring token (match-beginning 1) (match-end 1)) 141 do (substring token (match-beginning 2) (match-end 2))
142 do (substring token (match-beginning 2) (match-end 2)) 142 token (assoc (substring token (match-beginning 3) (match-end 3))
143 token (assoc (substring token (match-beginning 3) (match-end 3)) 143 timer-alist)
144 timer-alist) 144 timer-alist (delq token timer-alist))
145 timer-alist (delq token timer-alist)) 145 (or timer-alist
146 (or timer-alist 146 timer-dont-exit
147 timer-dont-exit 147 (process-send-eof proc))
148 (process-send-eof proc)) 148 ;; Update error message for this particular instance
149 ;; Update error message for this particular instance 149 (put 'timer-filter-error
150 (put 'timer-filter-error 150 'error-message
151 'error-message 151 (format "%s for %s; couldn't set at \"%s\""
152 (format "%s for %s; couldn't set at \"%s\"" 152 error (nth 2 token) do))
153 error (nth 2 token) do)) 153 (signal 'timer-filter-error (list proc str)))))
154 (signal 'timer-filter-error (list proc str))))) 154 (or timer-alist timer-dont-exit (process-send-eof proc))))
155 (or timer-alist timer-dont-exit (process-send-eof proc)))))
156 155
157(defun timer-process-sentinel (proc str) 156(defun timer-process-sentinel (proc str)
158 (let ((stat (process-status proc))) 157 (let ((stat (process-status proc)))