comparison lisp/calendar/time-date.el @ 100993:a16e9f7c2536

Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1513
author Miles Bader <miles@gnu.org>
date Fri, 09 Jan 2009 03:01:50 +0000
parents a9dc0e7c3f2b
children b04b1ea82ee0
comparison
equal deleted inserted replaced
100992:5cb6d276b93a 100993:a16e9f7c2536
36 ;; function `encode-time-value' make it easier to deal with these 36 ;; function `encode-time-value' make it easier to deal with these
37 ;; three formats. See `time-subtract' for an example of how to use 37 ;; three formats. See `time-subtract' for an example of how to use
38 ;; them. 38 ;; them.
39 39
40 ;;; Code: 40 ;;; Code:
41
42 ;; Only necessary for `declare' when compiling Gnus with Emacs 21.
43 (eval-when-compile (require 'cl))
41 44
42 (defmacro with-decoded-time-value (varlist &rest body) 45 (defmacro with-decoded-time-value (varlist &rest body)
43 "Decode a time value and bind it according to VARLIST, then eval BODY. 46 "Decode a time value and bind it according to VARLIST, then eval BODY.
44 47
45 The value of the last form in BODY is returned. 48 The value of the last form in BODY is returned.
288 spec match usedunits zeroflag larger prev name unit num zeropos) 291 spec match usedunits zeroflag larger prev name unit num zeropos)
289 (while (string-match "%\\.?[0-9]*\\(.\\)" string start) 292 (while (string-match "%\\.?[0-9]*\\(.\\)" string start)
290 (setq start (match-end 0) 293 (setq start (match-end 0)
291 spec (match-string 1 string)) 294 spec (match-string 1 string))
292 (unless (string-equal spec "%") 295 (unless (string-equal spec "%")
296 ;; `assoc-string' is not available in Emacs 21. So when compiling
297 ;; Gnus (`time-date.el' is part of Gnus) with Emacs 21, we get a
298 ;; warning here. But `format-seconds' is not used anywhere in Gnus so
299 ;; it's not a real problem. --rsteib
293 (or (setq match (assoc-string spec units t)) 300 (or (setq match (assoc-string spec units t))
294 (error "Bad format specifier: `%s'" spec)) 301 (error "Bad format specifier: `%s'" spec))
295 (if (assoc-string spec usedunits t) 302 (if (assoc-string spec usedunits t)
296 (error "Multiple instances of specifier: `%s'" spec)) 303 (error "Multiple instances of specifier: `%s'" spec))
297 (if (string-equal (car match) "z") 304 (if (string-equal (car match) "z")