(gnus-delay-article): Allow "01:23" time spec,
authorKai Grossjohann <kgrossjo@eu.uu.net>
Wed, 15 Aug 2001 17:49:30 +0000 (17:49 +0000)
committerKai Grossjohann <kgrossjo@eu.uu.net>
Wed, 15 Aug 2001 17:49:30 +0000 (17:49 +0000)
which specifies a time today or tomorrow.

lisp/ChangeLog
lisp/gnus-delay.el

index f9438f1..00e02e6 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-15  Kai Gro\e,A_\e(Bjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+       * gnus-delay.el (gnus-delay-article): Allow "01:23" time spec,
+       which specifies a time today or tomorrow.
+
 2001-08-15  Simon Josefsson  <jas@extundo.com>
        From Pavel@Janik.cz (Pavel Jan\e,Bm\e(Bk)
 
 2001-08-15  Simon Josefsson  <jas@extundo.com>
        From Pavel@Janik.cz (Pavel Jan\e,Bm\e(Bk)
 
index 8001e18..8232b9a 100644 (file)
@@ -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
   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)))
   (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)
     (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))))
                  (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))
          ((string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay)
           (setq num (match-string 1 delay))
           (setq unit (match-string 2 delay))