From: reingold@emr.cs.iit.edu (Edward M. Reingold)
To: help-gnu-emacs@gnu.org
Cc: ross@rosslaird.info
Subject: Re: Exception dates in diary?
Date: 19 Jan 2008 18:17:31 -0600 [thread overview]
Message-ID: <85ir1pnyec.fsf@emr.cs.iit.edu> (raw)
In-Reply-To: mailman.6299.1200699610.18990.help-gnu-emacs@gnu.org
>>>>> "RAL" == Ross A Laird <ross@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: 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.
next parent reply other threads:[~2008-01-20 0:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.6299.1200699610.18990.help-gnu-emacs@gnu.org>
2008-01-20 0:17 ` Edward M. Reingold [this message]
2008-01-18 23:36 Exception dates in diary? Ross A. Laird
2008-01-19 12:51 ` Leo
2008-01-19 17:38 ` Tom Tromey
2008-01-19 20:33 ` Ross A. Laird
[not found] ` <mailman.6326.1200774827.18990.help-gnu-emacs@gnu.org>
2008-01-21 17:00 ` Edward M. Reingold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85ir1pnyec.fsf@emr.cs.iit.edu \
--to=reingold@emr.cs.iit.edu \
--cc=help-gnu-emacs@gnu.org \
--cc=ross@rosslaird.info \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.