all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-calendar-holiday and local holidays
@ 2015-03-01 22:29 Melleus
  2015-03-02  0:33   ` Alexis
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Melleus @ 2015-03-01 22:29 UTC (permalink / raw)
  To: emacs-orgmode

Hi to all.

I'm afraid to ask. But... Anyway. Does %%(org-calendar-holiday) know
about holiday-local-holidays? I'm not programmer, sorry. I've set up
those local holidays but cannot see them in my agenda.

Thanks in advance.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [O] org-calendar-holiday and local holidays
  2015-03-01 22:29 org-calendar-holiday and local holidays Melleus
@ 2015-03-02  0:33   ` Alexis
  2015-03-02  1:40 ` Nick Dokos
  2015-03-02 15:34 ` Jorge A. Alfaro-Murillo
  2 siblings, 0 replies; 16+ messages in thread
From: Alexis @ 2015-03-02  0:33 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs


[Crossposted to the help-gnu-emacs list, for possible advice on 
whether or not this involves a bug in GNU Emacs.]

On 2015-03-02T09:29:09+1100, Melleus said:

 M> I'm afraid to ask. But... Anyway. Does 
 %%(org-calendar-holiday) M> know about holiday-local-holidays? 
 I'm not programmer, sorry. I've M> set up those local holidays 
 but cannot see them in my agenda.

You can examine the definition of an ELisp function by:

1. typing C-h f whilst on a function;
2. typing RET to take you to the documentation for that function;
3. typing TAB then RET to take you to the function definition.

Starting with point on `org-calendar-holiday`, we find that:

- `org-calendar-holiday` calls (if available) 
  `calendar-check-holidays` or (otherwise) 
  `check-calendar-holidays`;

- `calendar-check-holidays` calls `calendar-holiday-list`;

- `calendar-holiday-list` makes use of the `calendar-holidays` 
  variable.

We can examine the documentation for the `calendar-holidays` 
variable by moving point onto and typing C-h v RET. On my setup 
(manually compiled Emacs 24.4.1 on Debian Wheezy(+updates) x86_64 
together with Org 20150223), the documentation suggests that 
`calendar-holidays` makes use of the `holiday-local-holidays` 
variable; and the documentation for `holiday-local-holidays` 
merely refers us back to the documentation for 
`calendar-holidays`.

When i scroll down to look at the current value of 
`calendar-holidays`, however, i see that neither the current value 
nor the original value makes any reference to the 
`holiday-local-holidays` variable. And indeed, when i examine my 
agenda for next Monday, which is a local holiday i've specified in 
`holiday-local-holidays`, i can't see that local holiday. To fix 
this, i use M-: to evaluate:

    (setq calendar-holidays (append calendar-holidays 
    holiday-local-holidays))

after which the local holiday next Monday appears in my Org 
agenda.

Given the documentation for the `calendar-holidays` variable, the 
fact that i need to manually add the value of the 
`holiday-local-holidays` variable to `calendar-holidays` seems to 
me like it might be a coding or documentation bug in Emacs .... ?


Alexis.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
@ 2015-03-02  0:33   ` Alexis
  0 siblings, 0 replies; 16+ messages in thread
From: Alexis @ 2015-03-02  0:33 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs


[Crossposted to the help-gnu-emacs list, for possible advice on 
whether or not this involves a bug in GNU Emacs.]

On 2015-03-02T09:29:09+1100, Melleus said:

 M> I'm afraid to ask. But... Anyway. Does 
 %%(org-calendar-holiday) M> know about holiday-local-holidays? 
 I'm not programmer, sorry. I've M> set up those local holidays 
 but cannot see them in my agenda.

You can examine the definition of an ELisp function by:

1. typing C-h f whilst on a function;
2. typing RET to take you to the documentation for that function;
3. typing TAB then RET to take you to the function definition.

Starting with point on `org-calendar-holiday`, we find that:

- `org-calendar-holiday` calls (if available) 
  `calendar-check-holidays` or (otherwise) 
  `check-calendar-holidays`;

- `calendar-check-holidays` calls `calendar-holiday-list`;

- `calendar-holiday-list` makes use of the `calendar-holidays` 
  variable.

We can examine the documentation for the `calendar-holidays` 
variable by moving point onto and typing C-h v RET. On my setup 
(manually compiled Emacs 24.4.1 on Debian Wheezy(+updates) x86_64 
together with Org 20150223), the documentation suggests that 
`calendar-holidays` makes use of the `holiday-local-holidays` 
variable; and the documentation for `holiday-local-holidays` 
merely refers us back to the documentation for 
`calendar-holidays`.

When i scroll down to look at the current value of 
`calendar-holidays`, however, i see that neither the current value 
nor the original value makes any reference to the 
`holiday-local-holidays` variable. And indeed, when i examine my 
agenda for next Monday, which is a local holiday i've specified in 
`holiday-local-holidays`, i can't see that local holiday. To fix 
this, i use M-: to evaluate:

    (setq calendar-holidays (append calendar-holidays 
    holiday-local-holidays))

after which the local holiday next Monday appears in my Org 
agenda.

Given the documentation for the `calendar-holidays` variable, the 
fact that i need to manually add the value of the 
`holiday-local-holidays` variable to `calendar-holidays` seems to 
me like it might be a coding or documentation bug in Emacs .... ?


Alexis.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
  2015-03-01 22:29 org-calendar-holiday and local holidays Melleus
  2015-03-02  0:33   ` Alexis
@ 2015-03-02  1:40 ` Nick Dokos
  2015-03-02 15:34 ` Jorge A. Alfaro-Murillo
  2 siblings, 0 replies; 16+ messages in thread
From: Nick Dokos @ 2015-03-02  1:40 UTC (permalink / raw)
  To: emacs-orgmode

Melleus <melleus@openmailbox.org> writes:

> Hi to all.
>
> I'm afraid to ask. But... Anyway. Does %%
> about holiday-local-holidays? I'm not programmer, sorry. I've set up
> those local holidays but cannot see them in my agenda.
>

Can you see them in the calendar? If so, I think you should
be able to see them in the agenda too. If you can't see them
in the calendar, then read the doc for calendar-holidays
carefully, in particular this paragraph:

,----
| ...
| They also initialize the default value of `calendar-holidays',
| which is the default list of holidays used by the function
| `holiday-list' in the non-interactive case.  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.
| ...
`----

-- 
Nick

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
  2015-03-02  0:33   ` Alexis
  (?)
@ 2015-03-02 15:26   ` Jorge A. Alfaro-Murillo
  2015-03-02 22:23       ` Alexis
  -1 siblings, 1 reply; 16+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-03-02 15:26 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs

Alexis writes:

> When i scroll down to look at the current value of 
> `calendar-holidays`, however, i see that neither the current 
> value nor the original value makes any reference to the 
> `holiday-local-holidays` variable. And indeed, when i examine my 
> agenda for next Monday, which is a local holiday i've specified 
> in `holiday-local-holidays`, i can't see that local holiday. To 
> fix this, i use M-: to evaluate: 
> 
>    (setq calendar-holidays (append calendar-holidays 
> holiday-local-holidays)) 
> 
> after which the local holiday next Monday appears in my Org 
> agenda.

You do not need to add that, calendar-holidays appends 
holiday-local-holidays when holidays.el is loaded, just restart 
emacs. 

> Given the documentation for the `calendar-holidays` variable, 
> the fact that i need to manually add the value of the 
> `holiday-local-holidays` variable to `calendar-holidays` seems 
> to me like it might be a coding or documentation bug in Emacs 
> .... ?

It is also not a documentation bug, at least in my emacs 
(25.0.50.1) the documentation of calendar-holidays says clearly:

"Note that these variables [`holiday-other-holidays', 
`holiday-general-holidays', `holiday-local-holidays', 
`holiday-christian-holidays', `holiday-hebrew-holidays', 
`holiday-islamic-holidays', `holiday-bahai-holidays', 
`holiday-oriental-holidays' and `holiday-solar-holidays'] 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."

Best,

-- 
Jorge.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
  2015-03-01 22:29 org-calendar-holiday and local holidays Melleus
  2015-03-02  0:33   ` Alexis
  2015-03-02  1:40 ` Nick Dokos
@ 2015-03-02 15:34 ` Jorge A. Alfaro-Murillo
  2015-03-02 17:30   ` Melleus
  2 siblings, 1 reply; 16+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-03-02 15:34 UTC (permalink / raw)
  To: emacs-orgmode

Hi Melleus.

Melleus writes:

> Does %%(org-calendar-holiday) know about holiday-local-holidays? 
> I'm not programmer, sorry. I've set up those local holidays but 
> cannot see them in my agenda.

They should show up after you restart emacs.

Best,
-- 
Jorge.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
  2015-03-02 15:34 ` Jorge A. Alfaro-Murillo
@ 2015-03-02 17:30   ` Melleus
  0 siblings, 0 replies; 16+ messages in thread
From: Melleus @ 2015-03-02 17:30 UTC (permalink / raw)
  To: emacs-orgmode

jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo) writes:

> They should show up after you restart emacs.

I supposed it should. But in fact in does not work.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
  2015-03-02  0:33   ` Alexis
  (?)
  (?)
@ 2015-03-02 17:32   ` Melleus
  2015-03-02 21:58     ` Jorge A. Alfaro-Murillo
  -1 siblings, 1 reply; 16+ messages in thread
From: Melleus @ 2015-03-02 17:32 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs

Alexis <flexibeast@gmail.com> writes:

> see that local holiday. To fix this, i use M-: to evaluate:
>
>    (setq calendar-holidays (append calendar-holidays
> holiday-local-holidays))
>
> after which the local holiday next Monday appears in my Org agenda.

Works perfectly this way, thank you.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
  2015-03-02 17:32   ` Melleus
@ 2015-03-02 21:58     ` Jorge A. Alfaro-Murillo
  2015-03-02 22:54         ` Alexis
  2015-03-03 13:43       ` Melleus
  0 siblings, 2 replies; 16+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-03-02 21:58 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs

Melleus  writes:

> Alexis <flexibeast@gmail.com> writes: 
> 
>> see that local holiday. To fix this, i use M-: to evaluate: 
>> 
>>    (setq calendar-holidays (append calendar-holidays 
>> holiday-local-holidays)) 
> 
> Works perfectly this way, thank you. 
> 
> jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo) writes: 
> 
>> They should show up after you restart emacs. 
> 
> I supposed it should. But in fact in does not work.

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

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

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

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

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

Best,
-- 
Jorge.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [O] org-calendar-holiday and local holidays
  2015-03-02 15:26   ` Jorge A. Alfaro-Murillo
@ 2015-03-02 22:23       ` Alexis
  0 siblings, 0 replies; 16+ messages in thread
From: Alexis @ 2015-03-02 22:23 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs


On 2015-03-03T02:26:37+1100, Jorge A. Alfaro-Murillo said:

 JAA> Alexis writes:

 >> When i scroll down to look at the current value of 
 >> `calendar-holidays`, however, i see that neither the current 
 >> value nor the original value makes any reference to the 
 >> `holiday-local-holidays` variable. And indeed, when i examine 
 >> my agenda for next Monday, which is a local holiday i've 
 >> specified in `holiday-local-holidays`, i can't see that local 
 >> holiday. To fix this, i use M-: to evaluate:
 >> 
 >> (setq calendar-holidays (append calendar-holidays 
 >> holiday-local-holidays))
 >> 
 >> after which the local holiday next Monday appears in my Org 
 >> agenda.

 JAA> You do not need to add that, calendar-holidays appends JAA> 
 holiday-local-holidays when holidays.el is loaded, just restart 
 JAA> emacs.

Not in my Emacs (manually compiled 24.4.1, the most recent 
official stable release). My `local-holidays` variable was set for 
years, such that only as part of trying to help the OP did i 
notice that it's been obsoleted; the documentation for it says:

      This variable is an alias for `holiday-local-holidays'. 
      This variable is obsolete since 23.1; use 
      `holiday-local-holidays' instead.

So i changed my init to refer to `holiday-local-holidays` instead 
of `local-holidays`, and restarted Emacs, and the issue persisted: 
the value of `holiday-local-holidays` is /not/ included in 
`calendar-holidays` by default. The `(setq calendar-holidays ...` 
line i described above is necessary to work around this.

 JAA> It is also not a documentation bug, at least in my emacs 
 JAA> (25.0.50.1) the documentation of calendar-holidays says 
 clearly:

 JAA> "Note that these variables [`holiday-other-holidays', JAA> 
 `holiday-general-holidays', `holiday-local-holidays', JAA> 
 `holiday-christian-holidays', `holiday-hebrew-holidays', JAA> 
 `holiday-islamic-holidays', `holiday-bahai-holidays', JAA> 
 `holiday-oriental-holidays' and `holiday-solar-holidays'] have 
 JAA> no effect on `calendar-holidays' after it has been set JAA> 
 (e.g. after the calendar is loaded). In that case, customize JAA> 
 `calendar-holidays' directly."

In 24.4.1, the documentation is phrased differently; it says:

    Additional holidays are easy to add to the list, just put them 
    in the list `holiday-other-holidays' in your init file. 
    Similarly, by setting any of `holiday-general-holidays', 
    `holiday-local-holidays', `holiday-christian-holidays', 
    `holiday-hebrew-holidays', `holiday-islamic-holidays', 
    `holiday-bahai-holidays', `holiday-oriental-holidays', or 
    `holiday-solar-holidays' to nil in your init file, you can 
    eliminate unwanted categories of holidays.

    The aforementioned variables control the holiday choices 
    offered by the function `holiday-list' when it is called 
    interactively.

    They also initialize the default value of `calendar-holidays', 
    which is the default list of holidays used by the function 
    `holiday-list' in the non-interactive case.  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.

    The intention is that (in the US) `holiday-local-holidays' be 
    set in site-init.el and `holiday-other-holidays' be set by the 
    user.

It's the fact that, despite the above docstring, and that, as i 
described above, setting the value of `holiday-local-holidays` has 
no direct effect on `calendar-holidays` /even after a restart of 
Emacs/, that led me to suggest there might be a code bug or a 
documentation bug (e.g. maybe some variable needed to be set to 
`t` to ensure the value of `holiday-local-holidays` gets included 
in `calendar-holidays`).

Since things work for you, and the phrasing for the documentation 
for `calendar-holidays` has changed between the most recent stable 
release and the development version of Emacs you're using, my 
guess is that there is indeed a bug in 24.4.1 and earlier that has 
subsequently been fixed. Later today i'll try building from the 
first 24.5 pretest and the master branch, and examine what happens 
with `holiday-local-holidays` / `calendar-holidays` in both 
instances.


Alexis.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
@ 2015-03-02 22:23       ` Alexis
  0 siblings, 0 replies; 16+ messages in thread
From: Alexis @ 2015-03-02 22:23 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs


On 2015-03-03T02:26:37+1100, Jorge A. Alfaro-Murillo said:

 JAA> Alexis writes:

 >> When i scroll down to look at the current value of 
 >> `calendar-holidays`, however, i see that neither the current 
 >> value nor the original value makes any reference to the 
 >> `holiday-local-holidays` variable. And indeed, when i examine 
 >> my agenda for next Monday, which is a local holiday i've 
 >> specified in `holiday-local-holidays`, i can't see that local 
 >> holiday. To fix this, i use M-: to evaluate:
 >> 
 >> (setq calendar-holidays (append calendar-holidays 
 >> holiday-local-holidays))
 >> 
 >> after which the local holiday next Monday appears in my Org 
 >> agenda.

 JAA> You do not need to add that, calendar-holidays appends JAA> 
 holiday-local-holidays when holidays.el is loaded, just restart 
 JAA> emacs.

Not in my Emacs (manually compiled 24.4.1, the most recent 
official stable release). My `local-holidays` variable was set for 
years, such that only as part of trying to help the OP did i 
notice that it's been obsoleted; the documentation for it says:

      This variable is an alias for `holiday-local-holidays'. 
      This variable is obsolete since 23.1; use 
      `holiday-local-holidays' instead.

So i changed my init to refer to `holiday-local-holidays` instead 
of `local-holidays`, and restarted Emacs, and the issue persisted: 
the value of `holiday-local-holidays` is /not/ included in 
`calendar-holidays` by default. The `(setq calendar-holidays ...` 
line i described above is necessary to work around this.

 JAA> It is also not a documentation bug, at least in my emacs 
 JAA> (25.0.50.1) the documentation of calendar-holidays says 
 clearly:

 JAA> "Note that these variables [`holiday-other-holidays', JAA> 
 `holiday-general-holidays', `holiday-local-holidays', JAA> 
 `holiday-christian-holidays', `holiday-hebrew-holidays', JAA> 
 `holiday-islamic-holidays', `holiday-bahai-holidays', JAA> 
 `holiday-oriental-holidays' and `holiday-solar-holidays'] have 
 JAA> no effect on `calendar-holidays' after it has been set JAA> 
 (e.g. after the calendar is loaded). In that case, customize JAA> 
 `calendar-holidays' directly."

In 24.4.1, the documentation is phrased differently; it says:

    Additional holidays are easy to add to the list, just put them 
    in the list `holiday-other-holidays' in your init file. 
    Similarly, by setting any of `holiday-general-holidays', 
    `holiday-local-holidays', `holiday-christian-holidays', 
    `holiday-hebrew-holidays', `holiday-islamic-holidays', 
    `holiday-bahai-holidays', `holiday-oriental-holidays', or 
    `holiday-solar-holidays' to nil in your init file, you can 
    eliminate unwanted categories of holidays.

    The aforementioned variables control the holiday choices 
    offered by the function `holiday-list' when it is called 
    interactively.

    They also initialize the default value of `calendar-holidays', 
    which is the default list of holidays used by the function 
    `holiday-list' in the non-interactive case.  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.

    The intention is that (in the US) `holiday-local-holidays' be 
    set in site-init.el and `holiday-other-holidays' be set by the 
    user.

It's the fact that, despite the above docstring, and that, as i 
described above, setting the value of `holiday-local-holidays` has 
no direct effect on `calendar-holidays` /even after a restart of 
Emacs/, that led me to suggest there might be a code bug or a 
documentation bug (e.g. maybe some variable needed to be set to 
`t` to ensure the value of `holiday-local-holidays` gets included 
in `calendar-holidays`).

Since things work for you, and the phrasing for the documentation 
for `calendar-holidays` has changed between the most recent stable 
release and the development version of Emacs you're using, my 
guess is that there is indeed a bug in 24.4.1 and earlier that has 
subsequently been fixed. Later today i'll try building from the 
first 24.5 pretest and the master branch, and examine what happens 
with `holiday-local-holidays` / `calendar-holidays` in both 
instances.


Alexis.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [O] org-calendar-holiday and local holidays
  2015-03-02 21:58     ` Jorge A. Alfaro-Murillo
@ 2015-03-02 22:54         ` Alexis
  2015-03-03 13:43       ` Melleus
  1 sibling, 0 replies; 16+ messages in thread
From: Alexis @ 2015-03-02 22:54 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs


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.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
@ 2015-03-02 22:54         ` Alexis
  0 siblings, 0 replies; 16+ messages in thread
From: Alexis @ 2015-03-02 22:54 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs


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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [O] org-calendar-holiday and local holidays
  2015-03-02 22:54         ` Alexis
@ 2015-03-02 23:53           ` Jorge A. Alfaro-Murillo
  -1 siblings, 0 replies; 16+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-03-02 23:53 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-orgmode

Alexis  writes:

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

I am glad it worked out for you.

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

That is definitely the way to go, I do the same:

http://alfaromurillo.bitbucket.org/dotemacs.html

> Thus [...] works better in my context, and is more robust, 
> longer-term, than my original suggestion [...] So, thank you!

You are welcome. However, I think that it would be better to check 
what exactly loads holidays.el in your configuration (I will 
venture a guess that it is a call to org-agenda), and wrap that 
part in a (eval-after-load 'holidays '(progn ...)), then you can 
get rid of unnecessary code and you do not need to move things 
around in your nicely organized org file ;-)

Best,
-- 
Jorge.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
@ 2015-03-02 23:53           ` Jorge A. Alfaro-Murillo
  0 siblings, 0 replies; 16+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-03-02 23:53 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-orgmode

Alexis  writes:

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

I am glad it worked out for you.

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

That is definitely the way to go, I do the same:

http://alfaromurillo.bitbucket.org/dotemacs.html

> Thus [...] works better in my context, and is more robust, 
> longer-term, than my original suggestion [...] So, thank you!

You are welcome. However, I think that it would be better to check 
what exactly loads holidays.el in your configuration (I will 
venture a guess that it is a call to org-agenda), and wrap that 
part in a (eval-after-load 'holidays '(progn ...)), then you can 
get rid of unnecessary code and you do not need to move things 
around in your nicely organized org file ;-)

Best,
-- 
Jorge.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: org-calendar-holiday and local holidays
  2015-03-02 21:58     ` Jorge A. Alfaro-Murillo
  2015-03-02 22:54         ` Alexis
@ 2015-03-03 13:43       ` Melleus
  1 sibling, 0 replies; 16+ messages in thread
From: Melleus @ 2015-03-03 13:43 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: help-gnu-emacs

jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo) writes:

> calendar-holidays, it is because you are calling something that 
> loads holidays.el before you set holiday-local-holidays.

You're right. Now I understand. Thank you for explaining.




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-03-03 13:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-01 22:29 org-calendar-holiday and local holidays Melleus
2015-03-02  0:33 ` [O] " Alexis
2015-03-02  0:33   ` Alexis
2015-03-02 15:26   ` Jorge A. Alfaro-Murillo
2015-03-02 22:23     ` [O] " Alexis
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       ` [O] " Alexis
2015-03-02 22:54         ` Alexis
2015-03-02 23:53         ` [O] " Jorge A. Alfaro-Murillo
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.