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

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

Re: Diary question


From: Edward M. Reingold
Subject: Re: Diary question
Date: 27 Mar 2007 08:26:20 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

>>>>> "SB" == Steve Brown <steve.stevebrown@gmail.com> writes:

    SB> %%(diary-float t 4 -1)

    SB> and alls well, but I get paid on the last working day, and I'd like to
    SB> mark it. I would guess that I could change the 4 for a list, but it
    SB> didn't work, and now I'm lost.

For example:

&%%(let* ((month (extract-calendar-month date))
          (day (extract-calendar-day date))
          (year (extract-calendar-year date))
          (last (calendar-last-day-of-month month year))
          (dayname (calendar-day-of-week date)))
     (or (and (= day last) (memq dayname '(1 2 3 4 5)))
         (and (or (= day (1- last)) (= day (- last 2)))
              (= dayname 5)))) Payday!

Or, if it's the first work day of the month:

&%%(let ((dayname (calendar-day-of-week date))
         (day (car (cdr date))))
     (or (and (= day 1) (memq dayname '(1 2 3 4 5)))
         (and (memq day '(2 3)) (= dayname 1)))) Rent due

-- 

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


reply via email to

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