unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jorgen Schaefer <forcer@forcix.cx>
Subject: [holidays.el] Holidays spanning an amount of time
Date: 06 Nov 2002 17:21:31 +0100	[thread overview]
Message-ID: <hh65va7jp0.fsf@forcix.burse.uni-hamburg.de> (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"))

                 reply	other threads:[~2002-11-06 16:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=hh65va7jp0.fsf@forcix.burse.uni-hamburg.de \
    --to=forcer@forcix.cx \
    /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 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).