unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [holidays.el] Holidays spanning an amount of time
@ 2002-11-06 16:21 Jorgen Schaefer
  0 siblings, 0 replies; only message in thread
From: Jorgen Schaefer @ 2002-11-06 16:21 UTC (permalink / raw)


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 . "forcer@forcix.cx") (www . "http://www.forcix.cx/")
 (gpg   . "1024D/028AF63C")   (irc . "nick forcer on IRCnet"))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-06 16:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-06 16:21 [holidays.el] Holidays spanning an amount of time Jorgen Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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