help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: diary entry to count


From: Edward M. Reingold
Subject: Re: diary entry to count
Date: 09 Sep 2002 19:56:09 -0500

>>>>> "RK" == Raimund Kohl <Raimund.Kohl@freenet.de> writes:

   RK> that it would have been. I am looking for calender/diary telling me
    RK> (e.g.)

    RK>     1st of Sept - Discourse No 1

    RK> or later

    RK>     1st of Nov - Discourse No 3

Oh--I misunderstood.  use

   %%(diary-first-of-month 20 9 2002) Discourse No %d

for 20 months starting October 1, 2002, where you have the following in your
.emacs

(defun diary-first-of-month (n month year)
  "Cycle diary entry.
Entry applies on the first of the month for N months starting MONTH, DAY, YEAR.
ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of
months since MONTH 1, YEAR and the %s will be replaced by the ordinal ending
of that number (that is, `st', `nd', `rd' or `th', as appropriate."
  (let* ((cycle (+ 1 (* 12 (- (extract-calendar-year date) year))
                   (- (extract-calendar-month date) month))))
    (if (and (= (extract-calendar-day date) 1)
             (< 0 cycle)
             (<= cycle n))
        (format entry cycle (diary-ordinal-suffix cycle)))))


-- 

Professor Edward M. Reingold                Email: reingold@iit.edu
Chairman, Department of Computer Science    Voice: (312) 567-3309
Illinois Institute of Technology            Assistant: (312) 567-5152
Stuart Building                             Fax:   (312) 567-5067
10 West 31st Street, Suite 236
Chicago, IL  60616-3729  U.S.A.


reply via email to

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