X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fgnus-delay.el;h=ac890118c80656eb9ce65be2e18db7d9c3cb6a92;hb=07efe5c831f8a3261dc5948cc890449c30e9507e;hp=92c0e2fd489135a88e04a1bf2e469a6469fa36c6;hpb=fb0cb1cd006ed00bb6b87151828850a12dec5858;p=elisp%2Fgnus.git- diff --git a/lisp/gnus-delay.el b/lisp/gnus-delay.el index 92c0e2f..ac89011 100644 --- a/lisp/gnus-delay.el +++ b/lisp/gnus-delay.el @@ -49,12 +49,15 @@ DELAY is a string, giving the length of the time. Possible values are: weeks (`w'), months (`M'), or years (`Y'); * YYYY-MM-DD for a specific date. The time of day is given by the - variable `gnus-delay-default-hour', minute and second are zero." + variable `gnus-delay-default-hour', minute and second are zero. + +* hh:mm for a specific time. Use 24h format. If it is later than this + time, then the deadline is tomorrow, else today." (interactive (list (read-string "Target date (YYYY-MM-DD) or length of delay (units in [mhdwMY]): " gnus-delay-default-delay))) - (let (num unit days year month day deadline) + (let (num unit days year month day hour minute deadline) (cond ((string-match "\\([0-9][0-9][0-9]?[0-9]?\\)-\\([0-9]+\\)-\\([0-9]+\\)" delay) @@ -66,6 +69,23 @@ DELAY is a string, giving the length of the time. Possible values are: (encode-time 0 0 ; second and minute gnus-delay-default-hour day month year)))) + ((string-match "\\([0-9]+\\):\\([0-9]+\\)" delay) + (setq hour (string-to-number (match-string 1 delay)) + minute (string-to-number (match-string 2 delay))) + ;; Use current time, except... + (setq deadline (apply 'vector (decode-time (current-time)))) + ;; ... for minute and hour. + (aset deadline 1 minute) + (aset deadline 2 hour) + ;; Convert to seconds. + (setq deadline (time-to-seconds (apply 'encode-time + (append deadline nil)))) + ;; If this time has passed already, add a day. + (when (< deadline (time-to-seconds (current-time))) + (setq deadline (+ 3600 deadline))) ;3600 secs/day + ;; Convert seconds to date header. + (setq deadline (message-make-date + (seconds-to-time deadline)))) ((string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay) (setq num (match-string 1 delay)) (setq unit (match-string 2 delay))