Discussion:
[O] Multiple Recursive Directories with org-agenda-files
Esben Stien
2014-04-14 23:00:36 UTC
Permalink
I'm trying to add a few recursive directories to org-agenda-files, but
can't really find any examples doing this

I got like 250 org files spread over a few directories.

I want to add:

~/foo/bar/
~/baz/quux/
~/hukarz/grault/

..which again includes multiple directories with .org files and a few
other files which I don't want included.

Anyone who does this?
--
Esben Stien is ***@e s a
http://www. s t n m
irc://irc. b - i . e/%23contact
sip:b0ef@ e e
jid:b0ef@ n n
Julian M. Burgos
2014-04-15 08:43:43 UTC
Permalink
Hi Esben,

I use find-lisp-find-files. I have the following in my .emacs file:

;;------------------------------------------------------------------------------
;; Load org agenda files
;;------------------------------------------------------------------------------
(load-library "find-lisp")

(add-hook 'org-agenda-mode-hook (lambda ()
(setq org-agenda-files
(find-lisp-find-files "/home/julian/Documents" "\.org$"))
))

With this when I do C-c a, all the *.org files in my Documents directory
get added into the agenda.

According to this
http://archive.today/7McXW#selection-9101.0-9101.4

If you are on a Linux machine you can use the find utility, which can be
faster that the lisp library:

(setq org-agenda-files
(mapcar 'abbreviate-file-name
(split-string
(shell-command-to-string "find ~/org -name \"*.org\"")
"\n")))

I have not tried it though... but I may do it now.

I hope this helps.

Julian
Post by Esben Stien
I'm trying to add a few recursive directories to org-agenda-files, but
can't really find any examples doing this
I got like 250 org files spread over a few directories.
~/foo/bar/
~/baz/quux/
~/hukarz/grault/
..which again includes multiple directories with .org files and a few
other files which I don't want included.
Anyone who does this?
--
Julian Mariano Burgos, PhD
Hafrannsóknastofnun/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax: +354-5752001
Netfang/Email: ***@hafro.is
Esben Stien
2014-04-15 18:54:10 UTC
Permalink
Post by Julian M. Burgos
(load-library "find-lisp")
(add-hook 'org-agenda-mode-hook (lambda ()
(setq org-agenda-files
(find-lisp-find-files "/home/julian/Documents" "\.org$"))
))
This is not a multiple directories examples, so I tried:

(add-hook 'org-agenda-mode-hook (lambda ()
(setq org-agenda-files
(find-lisp-find-files "~/foo/bar" "\.org$")
(find-lisp-find-files "~/hukarz/quux" "\.org$"))
))

, but that just threw a lisp error.
--
Esben Stien is ***@e s a
http://www. s t n m
irc://irc. b - i . e/%23contact
sip:b0ef@ e e
jid:b0ef@ n n
Nick Dokos
2014-04-15 20:01:22 UTC
Permalink
Post by Julian M. Burgos
Post by Julian M. Burgos
(load-library "find-lisp")
(add-hook 'org-agenda-mode-hook (lambda ()
(setq org-agenda-files
(find-lisp-find-files "/home/julian/Documents" "\.org$"))
))
(add-hook 'org-agenda-mode-hook (lambda ()
(setq org-agenda-files
(append
Post by Julian M. Burgos
(find-lisp-find-files "~/foo/bar" "\.org$")
(find-lisp-find-files "~/hukarz/quux" "\.org$")))))
, but that just threw a lisp error.
You need to append all the subsequent lists onto the first list,
creating a big list which can be setq'ed to org-agenda-files.

What you tried to do is the equivalent of

(setq foo '(1 2 3) '(4 5 6))

which is not legal lisp - do C-h f setq RET to find out why.

Nick

Loading...