GNU bug report logs - #11272
24.1.50; `holiday-sexp' not always sufficient

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: michael_heerdegen@HIDDEN; dated Wed, 18 Apr 2012 17:29:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Apr 2012 17:28:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 18 13:28:40 2012
Received: from localhost ([127.0.0.1]:40117 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SKYgG-0000iQ-GX
	for submit <at> debbugs.gnu.org; Wed, 18 Apr 2012 13:28:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43877)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SKYgA-0000iA-UB
	for submit <at> debbugs.gnu.org; Wed, 18 Apr 2012 13:28:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SKYfk-0003eW-38
	for submit <at> debbugs.gnu.org; Wed, 18 Apr 2012 13:28:11 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB,
	RCVD_IN_XBL autolearn=ham version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:59797)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SKYfj-0003e6-WF
	for submit <at> debbugs.gnu.org; Wed, 18 Apr 2012 13:28:04 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59926)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SKYff-0005tW-N0
	for bug-gnu-emacs@HIDDEN; Wed, 18 Apr 2012 13:28:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SKYfa-0003YP-JO
	for bug-gnu-emacs@HIDDEN; Wed, 18 Apr 2012 13:27:59 -0400
Received: from fmmailgate04.web.de ([217.72.192.242]:58657)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SKYfa-0003Xy-9F
	for bug-gnu-emacs@HIDDEN; Wed, 18 Apr 2012 13:27:54 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate04.web.de (Postfix) with ESMTP id 40B16763DA8E
	for <bug-gnu-emacs@HIDDEN>; Wed, 18 Apr 2012 19:26:55 +0200 (CEST)
Received: from snow.dragon ([89.204.154.74]) by smtp.web.de (mrweb002) with
	ESMTPA (Nemesis) id 0LopMx-1Rn7ht29xz-00glW9;
	Wed, 18 Apr 2012 19:26:55 +0200
Date: Wed, 18 Apr 2012 19:28:52 +0200
Message-Id: <87hawhkkyz.fsf@HIDDEN>
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.1.50; `holiday-sexp' not always sufficient
X-Provags-ID: V02:K0:giB9gThgpExWqG0eNJRmFM7QAE7tfiAiZr0dHxX3/a7
	9IxGGU5HQez2TvdHRm9YwKLiMtCxOvSmLyd6XUfUCGIMfLoZtJ
	5T8MxNQH4bjHfZImFMmFRTe6cQiu9FyLriYq5p12dRC2O64vGE
	Y7XteOBrBFA7MKkXHCfQA1NWBs/z1tPHoL9fGcY+KhJcW+JFOp
	BohqHyUS+RGtSGL2/y8xhlPj5dWrf7ikb9WjKW8zC0=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -6.1 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: michael_heerdegen@HIDDEN
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.1 (------)

Hello,

I wonder why it is currently not possible to have `holiday-sexp' or a
similar function return a _list_ of entries for a given year, instead of
only one (or nil).  Could we provide such a feature?

Some background (just an example): I have a function like this:

(defun sundays-after-trinitatis (year)
  "List of sundays after Trinitatis in year YEAR."
  (let ((i 1)
        (results ())
        (easterday (tagnummer-ostertag year))
        (3lSoKj (3lSoKj year)))
    (while (<= i 24)
      (let* ((day (+ easterday 56 (* 7 i))))
        (when (< day 3lSoKj)
          (push (list (calendar-gregorian-from-absolute
                       (+ (calendar-absolute-from-gregorian (list 1 1 year))
                          -1 day))
                      (format "%s. sunday after Trinitatis" i))
                results)))
      (setq i (+ i 1)))
    results))

For any year, according to certain rules, certain sundays are named "nth
sunday after Trinitatis", depending on `year'.  The above function
returns the list of them for any given year.  But I can't use it
directly with `holiday-sexp' - I have to write my own interface function
for the calendar:

(defun holiday-sundays-after-trinitatis ()
  "List of visible sundays after Trinitatis in `calendar'."
  (let ((year displayed-year))
    (holiday-filter-visible-calendar
     (append (sonntage-nach-trinitatis year)
             (sonntage-nach-trinitatis (+ 1 year))))))

(eval-after-load "holidays"
  '(add-to-list 'calendar-holidays '(holiday-sundays-after-trinitatis)))

I wonder if we could provide a function `holiday-list', so that it
would be possible to do this:

(add-to-list 'calendar-holidays '(holidays-list '(holiday-sundays-after-trinitatis)))

It would no doubt be useful for other cases as well.  It could look
similar to this:

(defun holiday-list (sexp)
  (let ((y displayed-year)
        year dates)
    (holiday-filter-visible-calendar
     (append
      (progn
        (setq year y)
        (eval sexp))
      (progn
        (setq year (1+ y))
        (eval sexp))))))

Please tell me what you think.

If you don't want to add something like that, maybe we could at least
improve the manual a bit.  Under "Holiday Customization", there is this
paragraph:

|    Some holidays just don't fit into any of these forms because special
| calculations are involved in their determination.  In such cases you
| must write a Lisp function to do the calculation.  To include eclipses,
| for example, add `(eclipses)' to `holiday-other-holidays' and write an
| Emacs Lisp function `eclipses' that returns a (possibly empty) list of
| the relevant Gregorian dates among the range visible in the calendar
| window, with descriptive strings, like this:
| 
|      (((6 4 2012) "Lunar Eclipse") ((11 13 2012) "Solar Eclipse") ... )

I think it would be good to add a simple example for how such a
function could look like.  No user not browsing the sources will know
about `holiday-filter-visible-calendar'.  At least that function
should be mentioned somewhere.


Thanks,

Michael.



In GNU Emacs 24.1.50.1 (i486-pc-linux-gnu, GTK+ Version 3.2.3)
 of 2012-04-10 on zelenka, modified by Debian
 (emacs-snapshot package, version 2:20120410-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11104000
Configured using:
 `configure '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.1.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1.50/site-lisp:/usr/share/emacs/site-lisp'
 '--without-compress-info' '--with-crt-dir=/usr/lib/i386-linux-gnu/'
 '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes'
 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu'
 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2''





Acknowledgement sent to michael_heerdegen@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#11272; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.