4

Instead of adding .org files using C-c [ I would like to add a directory to my .emacs file, as I read it is done here.

I only have one directory at the moment, so this is the line I put into my .emacs:

(setq org-agenda-files (quote ("~/Documents/Org")))

This path should be pointing to a directory I have, named "Org", where I have a few .org files.

However, when I call the Agenda with C-c a and subsequently try to gather all TODO items with key t, I get the following message:

Non-existent agenda file ~/Documents/Org. [R]emove from list or [A]bort?

I notice that there is a full stop mark in the message, which is not intended. Also, it looks like emacs is really asking for a file, not a directory.

Mike Anblips
  • 658
  • 6
  • 19
  • One solution might be to use `file-expand-wildcards` with parameter '~/Documents/Org/*' to get all files in the directory and add them to the org-agenda-files, please take a look at this (http://emacs.stackexchange.com/questions/5560/wildcard-in-org-agenda-files). – Iqbal Ansari Oct 01 '15 at 12:41
  • Thank you, this also works however it is not needed in this instance. I will update my own question as the mistake is much sillier.. – Mike Anblips Oct 01 '15 at 13:49
  • It looks like you figured out the problem. Could you please change your edit to a full-fledged answer (and accept it once the system allows you)? It's perfectly acceptable, and fairly common, to do so. – Dan Oct 01 '15 at 14:24
  • Oh right! I forgot that `org-agenda-files` can have directories – Iqbal Ansari Oct 01 '15 at 15:08

1 Answers1

5

The reason emacs was complaining is because - indeed - there is no file in the specified directory .

Working under Windows, I mistakenly took ~ for my home directory. This is not the case.

When meaningful directories are specified as entries in the org-agenda-files variable, emacs matches its contents towards the variable org-agenda-file-regexp in the org.el file, actually allowing for a much finer customization (for instance nested structures).

So the mechanism works just fine.

Source: org.el file

Mike Anblips
  • 658
  • 6
  • 19