Commit 17b7580f authored by Karl Heuer's avatar Karl Heuer

(diary-remind): Rewritten to behave sensibly for

diary-block diary entries for which the reminders and the diary
entries can overlap.
parent 81af6e72
...@@ -1387,27 +1387,32 @@ occur on. If the current date is (one of) DAYS before the event indicated by ...@@ -1387,27 +1387,32 @@ 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 SEXP, then a suitable message (as specified by `diary-remind-message' is
returned. returned.
In addition to the reminders beforehand, the diary entry also appears on In addition to the reminders beforehand, the diary entry also appears on the
the date itself. date itself.
If optional parameter MARKING is non-nil then the reminders are marked on the A `diary-nonmarking-symbol' at the beginning of the line of the diary-remind
calendar. Marking of reminders is independent of whether the entry itself is entry specifies that the diary entry (not the reminder) is non-marking.
a marking or nonmarking one." Marking of reminders is independent of whether the entry itself is a marking
(let ((diary-entry)) or nonmarking; if optional parameter MARKING is non-nil then the reminders are
(if (or (not marking-diary-entries) marking) marked on the calendar."
(cond (let ((diary-entry (eval sexp)))
((integerp days) (cond
(let ((date (calendar-gregorian-from-absolute ;; Diary entry applies on date
(+ (calendar-absolute-from-gregorian date) days)))) ((and diary-entry
(if (setq diary-entry (eval sexp)) (or (not marking-diary-entries) marking-diary-entry))
(setq diary-entry (mapconcat 'eval diary-remind-message ""))))) diary-entry)
((and (listp days) days) ;; Diary entry may apply to `days' before date
(setq diary-entry (diary-remind sexp (car days) marking)) ((and (integerp days)
(if (not diary-entry) (not diary-entry); Diary entry does not apply to date
(setq diary-entry (diary-remind sexp (cdr days) marking)))))) (or (not marking-diary-entries) marking))
(or diary-entry (let ((date (calendar-gregorian-from-absolute
(and (or (not marking-diary-entries) marking-diary-entry) (+ (calendar-absolute-from-gregorian date) days))))
(eval sexp))))) (if (setq diary-entry (eval sexp))
(mapconcat 'eval diary-remind-message ""))))
;; Diary entry may apply to one of a list of days before date
((and (listp days) days)
(or (diary-remind sexp (car days) marking)
(diary-remind sexp (cdr days) marking))))))
(defun add-to-diary-list (date string specifier) (defun add-to-diary-list (date string specifier)
"Add the entry (DATE STRING SPECIFIER) to `diary-entries-list'. "Add the entry (DATE STRING SPECIFIER) to `diary-entries-list'.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment