3

I have one file that is my default file in org-agenda-files (which I set in my init.el file).

How can I add other files to the org-agenda-files list from within my default agenda file with paths relative to the default file?

Hypothetical example:

* One heading
  Some text
* Second heading (external)
  AGENDAFILE: ext/ext.org

2 Answers 2

3

You can use a file-local variable to evaluate a lisp form that will add another file to your org-agenda-files list.

For example, you could put the following at the end of your default agenda file to add the another-agenda-file.org file to the list.

## Local Variables:
## eval: (add-to-list 'org-agenda-files "another-agenda-file.org" 'append)
## End:

The append argument (or any non-nil value) in the call to add-to-list puts the file at the back of the list. Leaving it off will put the file at the front of the list.

1
  • Unfortunately it works only in the end of file (or in the first line using another syntax). But it's better than nothing. Thanks.
    – alexmkv
    Commented Feb 4, 2016 at 19:59
2

Another easy way is to set the org-agenda-files variable to a directory instead of a file. Thus, any file in the directory will be tracked.

I have not tested it yet but I am pretty sure that it also works with symlinks, so this would work in almost any scenario.

see this answer on SO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.