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

2015-03-03 Thread Melleus
jorge.alfaro-muri...@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.




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

2015-03-02 Thread Alexis


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!


Alexis.



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

2015-03-02 Thread Alexis


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.



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

2015-03-02 Thread Jorge A. Alfaro-Murillo

Melleus  writes:

Alexis  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-muri...@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.




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

2015-03-02 Thread Melleus
Alexis  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.




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

2015-03-02 Thread Melleus
jorge.alfaro-muri...@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.




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

2015-03-02 Thread Jorge A. Alfaro-Murillo

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.




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

2015-03-02 Thread Jorge A. Alfaro-Murillo

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.




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

2015-03-01 Thread Nick Dokos
Melleus  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




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

2015-03-01 Thread Alexis


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



[O] org-calendar-holiday and local holidays

2015-03-01 Thread Melleus
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.