Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exception dates in diary?

10 views
Skip to first unread message

Ross A. Laird

unread,
Jan 18, 2008, 6:36:55 PM1/18/08
to help-gn...@gnu.org

I teach a class on Monday nights, and there are sometimes holiday Mondays when
we skip class. In my diary file, I have this for the class schedule
(eg):

%%(and (= 1 (calendar-day-of-week date))
(diary-block 01 07 2008 03 10 2008)) 18:30-21:30 Class

How do I modify this so that I can add the exception dates and have the
calendar not show a class on a holiday?

Ross

--
Ross A. Laird, PhD
www.rosslaird.info

Leo

unread,
Jan 19, 2008, 7:51:52 AM1/19/08
to help-gn...@gnu.org

Looks like you can't.

--
.: Leo :. [ sdl.web AT gmail.com ] .: [ GPG Key: 9283AA3F ] :.

Use the best OS -- http://www.fedoraproject.org/

Tom Tromey

unread,
Jan 19, 2008, 12:38:44 PM1/19/08
to help-gn...@gnu.org
>>>>> "Ross" == Ross A Laird <ro...@rosslaird.info> writes:

Ross> %%(and (= 1 (calendar-day-of-week date))
Ross> (diary-block 01 07 2008 03 10 2008)) 18:30-21:30 Class

Ross> How do I modify this so that I can add the exception dates and have the
Ross> calendar not show a class on a holiday?

Maybe add in (not (check-calendar-holidays date))?
I'm just going by (info "(emacs)Sexp Diary Entries") and a little
browsing of the calendar sources.

Tom

Ross A. Laird

unread,
Jan 19, 2008, 3:33:37 PM1/19/08
to help-gn...@gnu.org
Tom Tromey <tro...@redhat.com> writes:

Yes, I have seen this and other more complex options based on holiday
dates. But I'm in Canada, and the holidays are sometimes different, so I
need some way of specifying exact dates for exception. Also my calendar
shows me some holidays I don't even recognize...
Oh well, I suppose I can just do it manually.
Thanks for the input.

Ross


>
> Tom

Edward M. Reingold

unread,
Jan 19, 2008, 7:17:31 PM1/19/08
to ro...@rosslaird.info
>>>>> "RAL" == Ross A Laird <ro...@rosslaird.info> writes:

RAL> I teach a class on Monday nights, and there are sometimes holiday
RAL> Mondays when we skip class. In my diary file, I have this for the
RAL> class schedule (eg):

RAL> %%(and (= 1 (calendar-day-of-week date)) (diary-block 01 07 2008 03
RAL> 10 2008)) 18:30-21:30 Class

RAL> How do I modify this so that I can add the exception dates and have
RAL> the calendar not show a class on a holiday?

Here is what I use (to get the effect you want) for my recycling dates and
payroll deposits; my diary has the entries

&%%(recycling) Skokie recycling pickup
&%%(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)))) 8am Print IIT/NWU pay stubs


and I have the following defined in my .emacs (this stuff could be in the
diary file also, but then it would be redefined wach time the diary is
examined):

(defun h-days (year);; Holidays that defer recycling and paychecks
(list (calendar-absolute-from-gregorian (list 1 1 year));; New Year
(calendar-dayname-on-or-before 1;; Monday
(calendar-absolute-from-gregorian (list 5 31 year)));; Memorial Day
(calendar-absolute-from-gregorian (list 7 4 year));; July 4
(calendar-nth-named-absday 1 1 9 year);; Labor Day
(calendar-nth-named-absday 4 4 11 year);; Thanksgiving
(calendar-absolute-from-gregorian (list 12 31 year));; Christmas
))

(defun recycle-date (d)
;; True if absolute date d should be a recycling date
(let* ((diff (- d (calendar-absolute-from-gregorian
(list 6 30 2003)))));; first recycyling pickup
(and (>= diff 0) (zerop (% diff 14)))))

(defun recycling ()
(let* ((month (extract-calendar-month date))
(day (extract-calendar-day date))
(year (extract-calendar-year date))
(a (calendar-absolute-from-gregorian date))
(h (h-days year)))
(or (and (recycle-date a) (not (memq a h)))
(and (recycle-date (1- a)) (memq (1- a) h)))))

--

Professor Edward M. Reingold Email: rein...@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.

Edward M. Reingold

unread,
Jan 21, 2008, 12:00:55 PM1/21/08
to ro...@rosslaird.info
>>>>> "RAL" == Ross A Laird <ro...@rosslaird.info> writes:

RAL> Yes, I have seen this and other more complex options based on holiday
RAL> dates. But I'm in Canada, and the holidays are sometimes different,
RAL> so I need some way of specifying exact dates for exception. Also my
RAL> calendar shows me some holidays I don't even recognize... Oh well, I
RAL> suppose I can just do it manually. Thanks for the input.

You can easily redefine the holidays to reflect your locale--no need to see
lots of meaningless US holidays (the default) just redefine the variable
general-holidays. See the docs for details.

0 new messages