emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alexis <flexibeast@gmail.com>
To: emacs-orgmode@gnu.org
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: org-calendar-holiday and local holidays
Date: Tue, 03 Mar 2015 09:54:43 +1100	[thread overview]
Message-ID: <87r3t72eoc.fsf@gmail.com> (raw)
In-Reply-To: <87sidn83k3.fsf@yale.edu>


On 2015-03-03T08:58:20+1100, Jorge A. Alfaro-Murillo 
<jorge.alfaro-murillo@yale.edu> 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!


Alexis.

  reply	other threads:[~2015-03-02 22:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-01 22:29 org-calendar-holiday and local holidays Melleus
2015-03-02  0:33 ` Alexis
2015-03-02 15:26   ` Jorge A. Alfaro-Murillo
2015-03-02 22:23     ` Alexis
2015-03-02 17:32   ` Melleus
2015-03-02 21:58     ` Jorge A. Alfaro-Murillo
2015-03-02 22:54       ` Alexis [this message]
2015-03-02 23:53         ` Jorge A. Alfaro-Murillo
2015-03-03 13:43       ` Melleus
2015-03-02  1:40 ` Nick Dokos
2015-03-02 15:34 ` Jorge A. Alfaro-Murillo
2015-03-02 17:30   ` Melleus

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87r3t72eoc.fsf@gmail.com \
    --to=flexibeast@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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/org-mode.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).