Using the Org mode included with Emacs 24.3, from C-h v org-agenda-files RET
:
If an entry is a directory, all files in that directory that are matched by
`org-agenda-file-regexp' will be part of the file list.
And from C-h v org-agenda-file-regexp RET
:
org-agenda-file-regexp is a variable defined in 'org.el'.
Its value is "\\`[^.].*\\.org\\'"
[...]
You can customize this variable.
So, in short: evaluate (add-to-list 'org-agenda-files (expand-file-name "~/org"))
and, if your org-agenda-file-regexp
is at the default value, Org mode will read agenda items from any file in ~/org
whose name ends in .org
. (If your org-agenda-file-regexp
isn't at the default value, or if you need it to match more than just files whose names end in .org
, then customize it to your needs via M-x customize-variable RET org-agenda-file-regexp RET
.)
Thank you for the response @aaron-miller. I'm using GNU Emacs 23.4.1 with Org-mode version 8.0.7. I found the
org-agenda-files
command, andC-h v org-agenda-file-regexp
is defined as you mention. However I get a warning after adding the code line you suggest. Any thoughts? Should I still left my previous line or delete it? – Dox – 2013-08-19T17:27:41.180I solved it! Thx for your help. My solution was to include the line
(setq org-agenda-files (list "~/org/"))
into my.emacs
file. Cheers. – Dox – 2013-08-19T17:37:48.2802@Dox That's only half a solution, though, in that it will add to
org-agenda-files
only those files present in~/org
at the time the expression is evaluated -- that is, if you add a new file during your Emacs session, it won't be automatically picked up as a source of agenda items until the next time you start Emacs. Of course, if that suffices for your needs, then go for it, but it's worth mentioning thatorg-agenda-file-regexp
, and the special handling of directories inorg-agenda-files
, exist for a reason. :) – Aaron Miller – 2013-08-19T18:05:54.390Could you provide an example of the solution? I check and the
org-agenda-file-regexp
is set to the default value, but you are right about the loading. – Dox – 2013-08-19T18:16:19.1572@Dox That's good! Assuming that all your Org files are in
~/org
and end in.org
, all you need to do is add(add-to-list 'org-agenda-files (expand-file-name "~/org"))
to your init file somewhere, and new Emacs sessions will automatically scan all your Org files for agenda items. (You can get the same effect in your existing Emacs session by doingC-x C-e
while point is on the closing paren of the expression; then, to see the effect, do e.g.M-x org-agenda RET t
.) – Aaron Miller – 2013-08-19T20:06:03.9671@Dox BTW
expand-file-name
canonicalizes its argument, in this case by expanding the~
to your full home directory path; not every Emacs Lisp function which takes a path argument does its own canonicalization, so it's useful to do so by hand.C-x C-e
doeseval-last-sexp
, which evaluates the Lisp form immediately behind point -- useful when you're editing init files, for example, to test the effect of a change and to get the benefit without having to restart Emacs orM-x eval-buffer
. – Aaron Miller – 2013-08-19T20:08:32.553let us continue this discussion in chat
– Dox – 2013-08-19T20:20:44.750