[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diary-lib.el how about adding diary-schedule

From: Gijs Hillenius
Subject: diary-lib.el how about adding diary-schedule
Date: Fri, 20 Aug 2021 11:57:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)


On the emacs wiki¹ I found a useful bit of code that allows adding an
weekly appointment in the diary file between two dates. Something that I
can't do with diary-block or diary-cyclic.

The code on the wiki seems out of date, so I reworked it a tiny bit.


%%(diary-schedule 15 7 2020 30 6 2021 3) 14:00 some weekly meeting

(defun diary-schedule (m1 d1 y1 m2 d2 y2 dayname)
  "Schedule diary entry.
Entry applies if date is between, or on one of, two dates on
DAYNAME.  The order of the input parameters changes according to
`calendar-date-style' \(e.g. to D1, M1, Y1, D2, M2, Y2 in the
European style)."
  (let ((date1 (calendar-absolute-from-gregorian
                  (diary-make-date m1 d1 y1)) )
        (date2 (calendar-absolute-from-gregorian
                  (diary-make-date m2 d2 y2)))
        (d (calendar-absolute-from-gregorian date)))
    (if (and 
         (<= date1 d) (<= d date2) (= (calendar-day-of-week date) dayname))

Would it be useful to add this to diary-lib.el?

1) https://www.emacswiki.org/emacs/DiaryMode

reply via email to

[Prev in Thread] Current Thread [Next in Thread]