emacs-devel
[Top][All Lists]
Advanced

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

[holidays.el] Holidays spanning an amount of time


From: Jorgen Schaefer
Subject: [holidays.el] Holidays spanning an amount of time
Date: 06 Nov 2002 17:21:31 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Hi there!
I had the problem that my holidays as a student aren't just
specific days, but spans of days, e.g. spring break and similar.
Currently, calendar/holidays.el doesn't offer a way to define
something like that. The following function adds that
functionality:

(defun holiday-block (m1 d1 y1 m2 d2 y2 descr)
  "Return a list of ((month day year) string) of visible holidays from
the span M1/D1/Y1 to M2/D2/Y2."
  (let ((start (calendar-absolute-from-gregorian (list m1 d1 y1)))
        (end (calendar-absolute-from-gregorian (list m2 d2 y2)))
        (lis '()))
    (while (<= start end)
      (setq lis (cons (list (calendar-gregorian-from-absolute end)
                            descr)
                      lis))
      (setq end (- end 1)))
    (filter-visible-calendar-holidays lis)))

It is used just as you might think:

(setq calendar-holidays
      '((holiday-block  2  8 2003  4  6 2003 "Vorlesungsfreie Zeit")
        ...))

I hope you find it useful.

Greetings,
        -- Jorgen

-- 
((email . "address@hidden") (www . "http://www.forcix.cx/";)
 (gpg   . "1024D/028AF63C")   (irc . "nick forcer on IRCnet"))




reply via email to

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