I have a problem with
org-mode's agenda view. While I've set
'("~/org/") invariably when I finally spin up M-x
org-agenda I find that
org-agenda-files just points to one org-file. Obviously something is deciding just to include the last org-file I viewed but I'm having trouble working out what. Is there any way to trap when this variable is changed and display or log some sort of backtrace?
I have a problem with
In this situation, I find that the best way to figure out what's going
on into is to visit my
~/.emacs.d/ and run
Searching your configs
The following snippet, taken from here, makes sure that
doesn't go into the
elpa/ subdir (since you're sure to find dozens
of useless hits in there).
(eval-after-load 'grep '(progn (add-to-list 'grep-find-ignored-directories "auto") (add-to-list 'grep-find-ignored-directories "elpa")))
Then I just run
M-x rgrep RET org-agenda-files RET *.el RET ~/.emacs.d/
which will find any reference to
org-agenda-files in my
configuration. If it's a problem with my configs, this will find it.
If the above doesn't find anything, it means there's an Elpa package causing trouble. So I do
M-x rgrep RET org-agenda-files RET *.el RET ~/.emacs.d/elpa/
This will usually yield a lot of results, but there are ways to go through them quickly. For instance, it's very unlikely that org-mode itself is causing this problem. So it's safe to ignore all hits that come from inside org-modes installation directory.
Another option you have is to track the value of this variable throughout the execution of
org-agenda, that has to tell you where the problem is.
Evaluate the following code:
(global-set-key [f1] (lambda () (interactive) (message "%s" org-agenda-files)))
Visit the function with
M-x find-function RET org-agenda.
- Edebug it with
- Call the function,
- Gradually step through it by pressing
n, and monitor the value of the variable by hitting
At some point inside the
org-agenda function, you'll hit
F1 and the value of
org-agenda-files will have changed. That will tell you where to look.
Are you ever using C-c [ (
org-agenda-file-to-front) or C-c ] (
org-remove-file) while in an
These overwrite the current
org-agenda-files with a hardcoded list of files that will no longer use your defined
~/org/ as a source.
Also if you are setting it to
~/org/ please ensure that the agenda files you want are in that folder with
.org for the extension. Otherwise they will not be detected.