unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Exception dates in diary?
@ 2008-01-18 23:36 Ross A. Laird
  2008-01-19 12:51 ` Leo
  2008-01-19 17:38 ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Ross A. Laird @ 2008-01-18 23:36 UTC (permalink / raw)
  To: help-gnu-emacs


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exception dates in diary?
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Leo @ 2008-01-19 12:51 UTC (permalink / raw)
  To: help-gnu-emacs

On 2008-01-18 23:36 +0000, Ross A. Laird wrote:
> 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

Looks like you can't.

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exception dates in diary?
  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>
  1 sibling, 2 replies; 6+ messages in thread
From: Tom Tromey @ 2008-01-19 17:38 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> "Ross" == Ross A Laird <ross@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exception dates in diary?
  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>
  1 sibling, 0 replies; 6+ messages in thread
From: Ross A. Laird @ 2008-01-19 20:33 UTC (permalink / raw)
  To: help-gnu-emacs

Tom Tromey <tromey@redhat.com> writes:

>>>>>> "Ross" == Ross A Laird <ross@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.

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exception dates in diary?
       [not found] <mailman.6299.1200699610.18990.help-gnu-emacs@gnu.org>
@ 2008-01-20  0:17 ` Edward M. Reingold
  0 siblings, 0 replies; 6+ messages in thread
From: Edward M. Reingold @ 2008-01-20  0:17 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: ross

>>>>> "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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exception dates in diary?
       [not found]   ` <mailman.6326.1200774827.18990.help-gnu-emacs@gnu.org>
@ 2008-01-21 17:00     ` Edward M. Reingold
  0 siblings, 0 replies; 6+ messages in thread
From: Edward M. Reingold @ 2008-01-21 17:00 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: ross

>>>>> "RAL" == Ross A Laird <ross@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.


-- 

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-01-21 17:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
     [not found] <mailman.6299.1200699610.18990.help-gnu-emacs@gnu.org>
2008-01-20  0:17 ` Edward M. Reingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).