[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Bug: clocktable error in org-agenda [9.2.2 (release_9.2.2-245-g9
From: |
Nathaniel Nicandro |
Subject: |
Re: [O] Bug: clocktable error in org-agenda [9.2.2 (release_9.2.2-245-g9d7b1e @ /home/dortmann/src/git-org-mode/lisp/)] |
Date: |
Sat, 09 Mar 2019 00:17:55 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) |
I am also experiencing this issue. I'm assuming =org-agenda-sticky= is set to
=t= in your configuration since that is what I have in mine.
I've tracked the problem down to (1) the handling of =org-agenda-sticky= in
=org-agenda-goto-date=, (2) how this affects what =org-agenda-mode= (called by
=org-agenda-redo=) does with =org-agenda-local-vars=, and (3) the subsequent
modification of variables in =org-agenda-local-vars= before another call to
=org-agenda-redo=.
1. =org-agenda-goto-date= temporarily sets =org-agenda-sticky= to =nil= before
it calls =org-agenda-redo=.
2. None of the variables in =org-agenda-local-vars= are made buffer local when
=org-agenda-redo= calls =org-agenda-mode= during the call to
=org-agenda-goto-date=.
3. Setting one of the variables in =org-agenda-local-vars= after (2) happens
actually sets its global value instead of its local value. So, for example,
calling =org-agenda-log-mode= will set the global value of
=org-agenda-show-log= to =t=. Once =org-agenda-redo= is called, it will
once again be a local variable, but now the default global value is =t=.
The main reason why log mode stays on when you try to toggle it off is because
the =reset-saved= function in =org-agenda-mode= (which restores the saved
values of =org-agenda-local-vars= after all local variables have been killed
and re-made as local variables) does not set the value of any local variable
whose saved value is =nil=.
Since the local value of =org-agenda-show-log= is =nil= when you try to
toggle log mode off, its buffer local value is not reset to =nil= by
=reset-saved=. This means that it keeps the default global value it had
when it was made into a local variable and this value is now =t= due to
(3).
So I think the main issue here is that =org-agenda-goto-date= does not
handle =org-agenda-sticky= correctly since none of the
=org-agenda-local-vars= are turned back into local variables during
=org-agenda-redo= when =org-agenda-sticky= is =t=.
Another possible issue is that the =reset-saved= function in
=org-agenda-mode= does not set the value of variables if they are =nil=, but
this is not an issue if the variables it resets are guaranteed to always
have a global default of =nil=.
I haven't looked into why =org-agenda-goto-date= needs to temporarily
set =org-agenda-sticky= to =nil. Maybe someone can answer that, but a
solution until that gets figured out is to allow =reset-saved= to set
=nil= values.
- Nathaniel