From: Kai Grossjohann Date: Wed, 15 Aug 2001 17:49:30 +0000 (+0000) Subject: (gnus-delay-article): Allow "01:23" time spec, X-Git-Url: https://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=40f2bb15348edc6389c795cd6e053d9657355ace;ds=sidebyside (gnus-delay-article): Allow "01:23" time spec, which specifies a time today or tomorrow. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f9438f183..00e02e6da 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2001-08-15 Kai Gro,A_(Bjohann + + * gnus-delay.el (gnus-delay-article): Allow "01:23" time spec, + which specifies a time today or tomorrow. + 2001-08-15 Simon Josefsson From Pavel@Janik.cz (Pavel Jan,Bm(Bk) diff --git a/lisp/gnus-delay.el b/lisp/gnus-delay.el index 8001e185a..8232b9a35 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))