From: Karl Kleinpaste <karl@charcoal.com>
Subject: Re: gnus-delay.el: let Gnus remind you of action items
Date: Sun, 22 Jul 2001 00:41:48 -0400 [thread overview]
Message-ID: <vxk3d7pfucz.fsf@cinnamon.vanillaknot.com> (raw)
In-Reply-To: <vxk7kx1hc9t.fsf@cinnamon.vanillaknot.com> (Karl Kleinpaste's message of "Sat, 21 Jul 2001 23:29:34 -0400")
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
Karl Kleinpaste <karl@charcoal.com> writes:
> Having just checked on XEmacs 21.1.14, I see it lacks even the
> DEFAULT-VALUE parameter. Perhaps use INITIAL-CONTENTS instead?
> Also, I'd like the ability to specify minutes, hours, months, and
> years. (Yes, really.)
How about this?
I also wondered whether the string-match should be bounded in "^...$"
to ensure there's nothing "extra" added by the user.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: update gnus-delay.el: fix read-string, allow more units --]
[-- Type: text/x-patch, Size: 1970 bytes --]
--- gnus-delay.el.~1~ Sat Jul 21 17:08:24 2001
+++ gnus-delay.el Sun Jul 22 00:37:18 2001
@@ -41,22 +41,31 @@
(defun gnus-delay-article (delay)
"Delay this article by some time.
DELAY is a string, giving the length of the time. Possible values are
-like 3d (meaning 3 days) or 2w (meaning two weeks)."
+<digits><units> for <units> in minutes (`m'), hours (`h'), days (`d'),
+weeks (`w'), months (`M'), or years (`Y')."
(interactive
- (list (read-string (format "Length of delay (default `%s'): "
- gnus-delay-default-delay)
- nil nil gnus-delay-default-delay nil)))
+ (list (read-string "Length of delay (units in [mhdwMY]: " gnus-delay-default-delay)))
(let (num unit days deadline)
- (unless (string-match "\\([0-9]+\\)\\s-*\\([dw]\\)" delay)
+ (unless (string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay)
(error "Malformed delay `%s'" delay))
(setq num (match-string 1 delay))
(setq unit (match-string 2 delay))
- (if (string= unit "w")
- (setq delay (* 7 (string-to-number num)))
- (setq delay (string-to-number num)))
+ ;; Start from seconds, then multiply into needed units.
+ (setq num (string-to-number num))
+ (if (string= unit "Y")
+ (setq delay (* num 60 60 24 365))
+ (if (string= unit "M")
+ (setq delay (* num 60 60 24 30))
+ (if (string= unit "w")
+ (setq delay (* num 60 60 24 7))
+ (if (string= unit "d")
+ (setq delay (* num 60 60 24))
+ (if (string= unit "h")
+ (setq delay (* num 60 60))
+ (setq delay (* num 60)))))))
(setq deadline (message-make-date
(seconds-to-time (+ (time-to-seconds (current-time))
- (* delay 24 60 60)))))
+ delay))))
(message-add-header (format "%s: %s" gnus-delay-header deadline)))
(set-buffer-modified-p t)
(nndraft-request-create-group gnus-delay-group)
next prev parent reply other threads:[~2001-07-22 4:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-21 21:49 Kai Großjohann
2001-07-22 3:29 ` Karl Kleinpaste
2001-07-22 4:41 ` Karl Kleinpaste [this message]
2001-07-22 9:28 ` Kai Großjohann
2001-07-24 1:07 ` Benjamin Rutt
2001-07-30 10:34 ` Didier Verna
2001-07-30 11:14 ` Kai Großjohann
2001-07-30 11:46 ` Didier Verna
2001-07-30 12:50 ` Kai Großjohann
2001-08-01 9:35 ` Didier Verna
2001-08-01 10:23 ` Kai Großjohann
2001-07-31 4:23 ` Amos Gouaux
2001-07-31 8:45 ` Kai Großjohann
2001-07-31 9:17 ` Christoph Conrad
2001-08-14 19:12 ` Jason R. Mastaler
2001-08-15 17:30 ` Kai Großjohann
2001-08-15 18:48 ` Jason R. Mastaler
2001-08-15 17:50 ` Kai Großjohann
2001-08-19 18:41 ` Lars Magne Ingebrigtsen
2001-08-19 22:55 ` Kai Großjohann
2001-08-19 23:04 ` Lars Magne Ingebrigtsen
2001-08-19 23:35 ` Kai Großjohann
2001-08-24 15:18 ` Simon Josefsson
2001-08-24 15:34 ` Simon Josefsson
2001-08-24 15:37 ` Kai Großjohann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vxk3d7pfucz.fsf@cinnamon.vanillaknot.com \
--to=karl@charcoal.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).