aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-04-19 23:25:04 -0400
committerStefan Monnier2019-04-19 23:25:04 -0400
commit9ffbe127c13803e1a949a18f8e84ed3eeb440b74 (patch)
tree2adf7267ac841769dfcdfd4645f150383936cec7
parentb793a881792271b939473cddfa95e7e7569107c7 (diff)
downloademacs-9ffbe127c13803e1a949a18f8e84ed3eeb440b74.tar.gz
emacs-9ffbe127c13803e1a949a18f8e84ed3eeb440b74.zip
* lisp/calendar/parse-time.el (parse-time-string): Use functionp and setf
-rw-r--r--lisp/calendar/parse-time.el26
1 files changed, 13 insertions, 13 deletions
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index 93e7e53b6ab..68d6ce05d6c 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -168,8 +168,7 @@ unknown DST value is returned as -1."
168 (when (and (not (nth (car slots) time)) ;not already set 168 (when (and (not (nth (car slots) time)) ;not already set
169 (setq parse-time-val 169 (setq parse-time-val
170 (cond ((and (consp predicate) 170 (cond ((and (consp predicate)
171 (not (eq (car predicate) 171 (not (functionp predicate)))
172 'lambda)))
173 (and (numberp parse-time-elt) 172 (and (numberp parse-time-elt)
174 (<= (car predicate) parse-time-elt) 173 (<= (car predicate) parse-time-elt)
175 (or (not (cdr predicate)) 174 (or (not (cdr predicate))
@@ -191,7 +190,7 @@ unknown DST value is returned as -1."
191 :end (aref this 1)) 190 :end (aref this 1))
192 (funcall this))) 191 (funcall this)))
193 parse-time-val))) 192 parse-time-val)))
194 (rplaca (nthcdr (pop slots) time) new-val)))))))) 193 (setf (nth (pop slots) time) new-val))))))))
195 time)) 194 time))
196 195
197(defconst parse-time-iso8601-regexp 196(defconst parse-time-iso8601-regexp
@@ -244,16 +243,17 @@ If DATE-STRING cannot be parsed, it falls back to
244 re-start (match-end 0)) 243 re-start (match-end 0))
245 (when (string-match tz-re date-string re-start) 244 (when (string-match tz-re date-string re-start)
246 (setq dst nil) 245 (setq dst nil)
247 (if (string= "Z" (match-string 1 date-string)) 246 (setq tz (if (string= "Z" (match-string 1 date-string))
248 (setq tz 0) ;; UTC timezone indicated by Z 247 0 ;; UTC timezone indicated by Z
249 (setq tz (+ 248 (let ((tz (+
250 (* 3600 249 (* 3600
251 (string-to-number (match-string 3 date-string))) 250 (string-to-number
252 (* 60 251 (match-string 3 date-string)))
253 (string-to-number 252 (* 60
254 (or (match-string 4 date-string) "0"))))) 253 (string-to-number
255 (when (string= "-" (match-string 2 date-string)) 254 (or (match-string 4 date-string) "0"))))))
256 (setq tz (- tz))))) 255 (if (string= "-" (match-string 2 date-string))
256 (- tz) tz)))))
257 (setq time (list seconds minute hour day month year day-of-week dst tz)))) 257 (setq time (list seconds minute hour day month year day-of-week dst tz))))
258 258
259 ;; Fall back to having `parse-time-string' do fancy things for us. 259 ;; Fall back to having `parse-time-string' do fancy things for us.