[Top][All Lists]

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

Re: [O] org-calendar-holiday and local holidays

From: Alexis
Subject: Re: [O] org-calendar-holiday and local holidays
Date: Tue, 03 Mar 2015 09:54:43 +1100

On 2015-03-03T08:58:20+1100, Jorge A. Alfaro-Murillo <> said:

JAA> holidays.el appends holiday-local-holidays to calendar-holidays JAA> via a defcustom, so if you set holiday-local-holidays in your JAA> .emacs, restart emacs and the local holidays are not in JAA> calendar-holidays, it is because you are calling something that JAA> loads holidays.el before you set holiday-local-holidays.

JAA> If you add the code above to your .emacs and later modify your JAA> configuration and remove or move the part that loads JAA> holidays.el, then either your code will fail (because JAA> calendar-holidays is not yet defined) or calendar-holidays will JAA> have your local holidays twice and they will show twice in your JAA> agenda.

JAA> I think that you should look for whatever calls holidays.el and JAA> set holiday-local-holidays before that.

i just tried moving my `(setq holiday-local-holidays ...)` to the very first line of my config setup, and lo, that does result in local holidays appearing in my Org agenda. However, my config setup is a 3000+ line Org Babel file, in which i group together things that are related in my mind, and the setup for the calendar is about a third of the way through this. Thus ....

JAA> If not, then at least use eval-after-load so that JAA> calendar-holidays is already defined when the code is run, and JAA> add-to-list so that the entries do not get added twice if they are JAA> already there:

JAA> #+BEGIN_SRC emacs-lisp (eval-after-load 'holidays '(dolist JAA> (holiday holiday-local-holidays) (add-to-list 'calendar-holidays JAA> holiday)) #+END_SRC

.... works better in my context, and is more robust, longer-term, than my original suggestion to use

(setq calendar-holidays (append calendar-holidays holiday-local-holidays)) So, thank you! Although i do note that my suggestion was nevertheless within the guidelines of the documentation for `calendar-holidays`:

Note that these variables have no effect on `calendar-holidays' after it has been set (e.g. after the calendar is loaded). In that case, customize `calendar-holidays' directly.

i feel the above documentation could be improved by adding that `eval-after-load` should probably by used in this context, e.g.:

Note that these variables have no effect on `calendar-holidays' after it has been set (e.g. after the calendar is loaded). In that case, customize `calendar-holidays' directly, for example by using `eval-after-load':

       (eval-after-load 'holidays
                        '(dolist (holiday holiday-local-holidays)
(add-to-list 'calendar-holidays holiday)))

i'll open a GNU Emacs issue to that effect. :-)

Thanks again!


reply via email to

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