[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [appt] allow specifying warning time in diary
From: |
Leo |
Subject: |
Re: [appt] allow specifying warning time in diary |
Date: |
Wed, 08 Sep 2010 15:55:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.4) |
On 2010-09-08 15:34 +0100, Stefan Monnier wrote:
> Looks good, thank you; can someone install it?
>
>
> Stefan
Thanks for the interest. The previous patch doesn't take into account of
non-zero time-beg. This one fixes it and is simpler.
Modified lisp/calendar/appt.el
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index fd15093..af60d78 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -273,6 +273,12 @@ for a warning to be issued. The format of the time can be
either
Thursday
11:45am Lunch meeting.
+Optionally you can specify a warning time (in minutes) for an
+entry following the time, for example:
+
+ Thursday
+ 11:45am #20 Lunch meeting.
+
Appointments are checked every `appt-display-interval' minutes.
The following variables control appointment notification:
@@ -579,9 +585,19 @@ appointment package (if it is not already active)."
(calendar-current-date) (caar entry-list)))
(setq time-string (cadr (car entry-list)))
(while (string-match appt-time-regexp time-string)
- (let* ((beg (match-beginning 0))
+ (let* ((time-beg (match-beginning 0))
+ (time-end (match-end 0))
;; Get just the time for this appointment.
(only-time (match-string 0 time-string))
+ (warntime
+ (when (= time-end
+ (string-match
+ "[ \t]*#\\([-+]?[0-9]+\\)[ \t]*"
+ time-string time-end))
+ (prog1 (string-to-number
+ (match-string 1 time-string))
+ (setq time-string (replace-match
+ " " nil nil time-string)))))
;; Find the end of this appointment
;; (the start of the next).
(end (string-match
@@ -590,9 +606,10 @@ appointment package (if it is not already active)."
(match-end 0)))
;; Get the whole string for this appointment.
(appt-time-string
- (substring time-string beg end))
+ (substring time-string time-beg end))
(appt-time (list (appt-convert-time only-time)))
- (time-msg (list appt-time appt-time-string)))
+ (time-msg (list appt-time appt-time-string
+ nil warntime)))
;; Add this appointment to appt-time-msg-list.
(setq appt-time-msg-list
(nconc appt-time-msg-list (list time-msg))
Leo
- [appt] allow specifying warning time in diary, Leo, 2010/09/08
- Re: [appt] allow specifying warning time in diary, Andreas Schwab, 2010/09/08
- Re: [appt] allow specifying warning time in diary, Stefan Monnier, 2010/09/08
- Re: [appt] allow specifying warning time in diary,
Leo <=
- Re: [appt] allow specifying warning time in diary, Leo, 2010/09/08
- Re: [appt] allow specifying warning time in diary, Daniel Pittman, 2010/09/09
- Re: [appt] allow specifying warning time in diary, Leo, 2010/09/10
- Re: [appt] allow specifying warning time in diary, Glenn Morris, 2010/09/13
- Re: [appt] allow specifying warning time in diary, Leo, 2010/09/25