Discussion:
[Orgmode] FAQ incorrect
W.Bentley MacLeod
2009-10-27 13:10:09 UTC
Permalink
FAQ on how to include all org files in a directory is incorrect (view 85).
Correct code is:
(setq org-agenda-files (file-expand-wildcards "~/org-files/*.org"))

best bm


____________________________

Professor W. Bentley MacLeod
Columbia University in the City of New York, NY 10027
http://www.columbia.edu/~wbm2103/
____________________________
Benjamin Andresen
2009-10-27 14:50:23 UTC
Permalink
Hey W.,
Post by W.Bentley MacLeod
FAQ on how to include all org files in a directory is incorrect (view 85).
(setq org-agenda-files (file-expand-wildcards "~/org-files/*.org"))
You are right.

This isn't valid: (setq org-agenda-files "~/my/special/path/org/")

M-x org-agenda RET will reply with: `org-agenda-files' cannot be a single directory

I propose the following for the FAQ:

(setq org-agenda-directory "~/Org/")
(setq org-agenda-files (directory-files (expand-file-name org-agenda-directory) t "^[^\.][^#][[:alnum:]]+\.org$"))

That will add every org file. I've had the problem of normal glob
expansion to include emacs lock files that are in this format:
.#todo.org

I was under the impression that org-agenda-directory set to
~/my/special/path/org/ would Just Work(tm) because if you do C-c a a v A
it pulls in the right files for me.
Post by W.Bentley MacLeod
best bm
br,
benny
W.Bentley MacLeod
2009-10-27 15:03:54 UTC
Permalink
perfect. b.

____________________________

Professor W. Bentley MacLeod
Columbia University in the City of New York, NY 10027
http://www.columbia.edu/~wbm2103/
____________________________
Post by Benjamin Andresen
Hey W.,
Post by W.Bentley MacLeod
FAQ on how to include all org files in a directory is incorrect (view 85).
(setq org-agenda-files (file-expand-wildcards "~/org-files/*.org"))
You are right.
This isn't valid: (setq org-agenda-files "~/my/special/path/org/")
M-x org-agenda RET will reply with: `org-agenda-files' cannot be a single directory
(setq org-agenda-directory "~/Org/")
(setq org-agenda-files (directory-files (expand-file-name org-agenda-directory) t "^[^\.][^#][[:alnum:]]+\.org$"))
That will add every org file. I've had the problem of normal glob
.#todo.org
I was under the impression that org-agenda-directory set to
~/my/special/path/org/ would Just Work(tm) because if you do C-c a a v A
it pulls in the right files for me.
Post by W.Bentley MacLeod
best bm
br,
benny
W.Bentley MacLeod
2009-10-27 15:05:30 UTC
Permalink
Yes, that is the error I got.
I like your solution.
____________________________

Professor W. Bentley MacLeod
Columbia University in the City of New York, NY 10027
http://www.columbia.edu/~wbm2103/
____________________________
Post by Benjamin Andresen
Hey W.,
Post by W.Bentley MacLeod
FAQ on how to include all org files in a directory is incorrect (view 85).
(setq org-agenda-files (file-expand-wildcards "~/org-files/*.org"))
You are right.
This isn't valid: (setq org-agenda-files "~/my/special/path/org/")
M-x org-agenda RET will reply with: `org-agenda-files' cannot be a single directory
(setq org-agenda-directory "~/Org/")
(setq org-agenda-files (directory-files (expand-file-name org-agenda-directory) t "^[^\.][^#][[:alnum:]]+\.org$"))
That will add every org file. I've had the problem of normal glob
.#todo.org
I was under the impression that org-agenda-directory set to
~/my/special/path/org/ would Just Work(tm) because if you do C-c a a v A
it pulls in the right files for me.
Post by W.Bentley MacLeod
best bm
br,
benny
Nick Dokos
2009-10-27 14:56:49 UTC
Permalink
Post by W.Bentley MacLeod
FAQ on how to include all org files in a directory is incorrect (view 85).
(setq org-agenda-files (file-expand-wildcards "~/org-files/*.org"))
If you are talking about this entry:

How can include all org files in a directory in my agenda?

You can simply set the value of org-agenda-files to a directory rather than a list of files:

(setq org-agenda-files "~/my/special/path/org/")

it is correct as it stands: unless you are using a really ancient
version, org figures out that it's a directory and sets org-agenda-files
to the contents of the directory (filtered by org-agenda-file-regexp,
which by default matches filenames ending in ".org").

HTH,
Nick
Carsten Dominik
2009-10-27 15:21:05 UTC
Permalink
Post by Nick Dokos
Post by W.Bentley MacLeod
FAQ on how to include all org files in a directory is incorrect (view 85).
(setq org-agenda-files (file-expand-wildcards "~/org-files/*.org"))
How can include all org files in a directory in my agenda?
You can simply set the value of org-agenda-files to a directory
(setq org-agenda-files "~/my/special/path/org/")
Does that really work? I believe it should be

(setq org-agenda-files '("~/my/special/path/org/"))

i.e. each member of this list can be a file or a
directory. If it is a directory, the org files in
it will be used.

- Carsten
Post by Nick Dokos
it is correct as it stands: unless you are using a really ancient
version, org figures out that it's a directory and sets org-agenda-
files
to the contents of the directory (filtered by org-agenda-file-regexp,
which by default matches filenames ending in ".org").
HTH,
Nick
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
Nick Dokos
2009-10-27 15:29:48 UTC
Permalink
Post by Carsten Dominik
Post by Benjamin Andresen
(setq org-agenda-files "~/my/special/path/org/")
Does that really work? I believe it should be
(setq org-agenda-files '("~/my/special/path/org/"))
i.e. each member of this list can be a file or a
directory. If it is a directory, the org files in
it will be used.
Yes, I was mistaken: it's got to be a list.

Thanks,
Nick
Matt Lundin
2009-10-27 17:02:39 UTC
Permalink
Post by Nick Dokos
Post by Carsten Dominik
Post by Benjamin Andresen
(setq org-agenda-files "~/my/special/path/org/")
Does that really work? I believe it should be
(setq org-agenda-files '("~/my/special/path/org/"))
i.e. each member of this list can be a file or a
directory. If it is a directory, the org files in
it will be used.
Yes, I was mistaken: it's got to be a list.
My mistake as well. I updated the FAQ accordingly.

- Matt
Matt Lundin
2009-10-27 15:00:51 UTC
Permalink
Post by W.Bentley MacLeod
FAQ on how to include all org files in a directory is incorrect (view 85).
(setq org-agenda-files (file-expand-wildcards "~/org-files/*.org"))
Thanks. Yes, that is one way to add all files in directory. But the
method suggested by the FAQ is also correct. According to the docstring
for the variable org-agenda-files:

,----
| 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.
`----

I'll update the FAQ to indicate that there are multiple ways of
accomplishing the same thing.

I also saw a typo in the fake path in the example, which I'll be sure to
change.

Best,
Matt
Continue reading on narkive:
Loading...