summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-04-23 03:06:11 +0000
committerGlenn Morris <rgm@gnu.org>2008-04-23 03:06:11 +0000
commit968560df8db6f67a05ef40a069445dc705405d1c (patch)
treef971ebc7425322ced08b4e59c05c814c544c9f58 /lisp/calendar
parent418c2f01e1900ba427e51e21c0782b3d8a0e6633 (diff)
downloademacs-968560df8db6f67a05ef40a069445dc705405d1c.tar.gz
(diary-list-sexp-entries): Doc fix.
(diary-remind): Allow negative DAYS to represent a range 1:DAYS. Suggested by Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/diary-lib.el39
1 files changed, 23 insertions, 16 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 54c99e30346..a62af9169ed 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -1635,8 +1635,9 @@ DAY MONTH YEAR in the European style).
%%(diary-remind SEXP DAYS &optional MARKING) text
Entry is a reminder for diary sexp SEXP. DAYS is either a
single number or a list of numbers indicating the number(s)
- of days before the event that the warning(s) should occur. If
- the current date is (one of) DAYS before the event indicated
+ of days before the event that the warning(s) should occur.
+ A negative number -DAYS has the same meaning as a list (1 2 ... DAYS).
+ If the current date is (one of) DAYS before the event indicated
by EXPR, then a suitable message (as specified by
`diary-remind-message') appears. In addition to the
reminders beforehand, the diary entry also appears on the
@@ -1915,21 +1916,27 @@ string to use when highlighting the day in the calendar."
(defun diary-remind (sexp days &optional marking)
"Provide a reminder of a diary entry.
-SEXP is a diary-sexp. DAYS is either a single number or a list of numbers
-indicating the number(s) of days before the event that the warning(s) should
-occur on. If the current date is (one of) DAYS before the event indicated by
-SEXP, then a suitable message (as specified by `diary-remind-message' is
-returned.
-
-In addition to the reminders beforehand, the diary entry also appears on the
-date itself.
-
-A `diary-nonmarking-symbol' at the beginning of the line of the `diary-remind'
-entry specifies that the diary entry (not the reminder) is non-marking.
-Marking of reminders is independent of whether the entry itself is a marking
-or nonmarking; if optional parameter MARKING is non-nil then the reminders are
-marked on the calendar."
+SEXP is a diary-sexp. DAYS is either a single number or a list
+of numbers indicating the number(s) of days before the event that
+the warning(s) should occur on. A negative number -DAYS has the
+same meaning as a list (1 2 ... DAYS). If the current date
+is (one of) DAYS before the event indicated by SEXP, then this function
+returns a suitable message (as specified by `diary-remind-message').
+
+In addition to the reminders beforehand, the diary entry also
+appears on the date itself.
+
+A `diary-nonmarking-symbol' at the beginning of the line of the
+`diary-remind' entry specifies that the diary entry (not the
+reminder) is non-marking. Marking of reminders is independent of
+whether the entry itself is a marking or nonmarking; if optional
+parameter MARKING is non-nil then the reminders are marked on the
+calendar."
;; `date' has a value at this point, from diary-sexp-entry.
+ ;; Convert a negative number to a list of days.
+ (and (integerp days)
+ (< days 0)
+ (setq days (number-sequence 1 (- days))))
(let ((diary-entry (eval sexp)))
(cond
;; Diary entry applies on date.