* Fast traversing directories
@ 2009-10-31 17:07 andrea Crotti
2009-10-31 17:15 ` Benjamin Andresen
0 siblings, 1 reply; 7+ messages in thread
From: andrea Crotti @ 2009-10-31 17:07 UTC (permalink / raw)
To: emacs-orgmode
Well I would like to have simply all the org files
I produce wherever in my agenda.
I started to write something like
(dolist (x (directory-files "~/uni/" t))
(if (file-directory-p x)
(dolist (subject (directory-files x t))
(if (file-directory-p subject)
(setq org-agenda-files
(append org-agenda-files (directory-files subject t ".org$" t)))))))
but the problem is that it only goes two levels
and I guess it could be very slow.
I didn't find any function in elisp, maybe it would be better
to get a list of org-files with an external command (python or shell script),
what do you think?
I don't like the solution of setting them by hand, I would like to set
the upper level directory and make it searches inside it automatically...
How do you manage your org files?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fast traversing directories
2009-10-31 17:07 Fast traversing directories andrea Crotti
@ 2009-10-31 17:15 ` Benjamin Andresen
2009-10-31 17:31 ` andrea Crotti
0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Andresen @ 2009-10-31 17:15 UTC (permalink / raw)
To: andrea Crotti; +Cc: emacs-orgmode
Hey Andrea,
andrea Crotti <andrea.crotti.0@gmail.com> writes:
> I didn't find any function in elisp, maybe it would be better
> to get a list of org-files with an external command (python or shell script),
> what do you think?
http://orgmode.org/worg/org-faq.php#set-agenda-files-recursively
br,
benny
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fast traversing directories
2009-10-31 17:15 ` Benjamin Andresen
@ 2009-10-31 17:31 ` andrea Crotti
2009-10-31 18:09 ` PT
2009-10-31 18:28 ` Nick Dokos
0 siblings, 2 replies; 7+ messages in thread
From: andrea Crotti @ 2009-10-31 17:31 UTC (permalink / raw)
To: emacs-orgmode
Benjamin Andresen <benny <at> in-ulm.de> writes:
>
> Hey Andrea,
>
> andrea Crotti <andrea.crotti.0 <at> gmail.com> writes:
>
> > I didn't find any function in elisp, maybe it would be better
> > to get a list of org-files with an external command (python or shell script),
> > what do you think?
>
> http://orgmode.org/worg/org-faq.php#set-agenda-files-recursively
>
> br,
> benny
>
>
That's really great!
I tried this because I have more base directories.
(setq org-directories '("~/org" "~/uni"))
(setq org-agenda-files ())
(dolist ((d org-directories))
(setq org-agenda-files
(append org-agenda-files (find-lisp-find-files d "\.org$"))))
But it sets org-agenda-files to nil...
Should I use maybe concat and some sort of mapping (for more elegance?)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fast traversing directories
2009-10-31 17:31 ` andrea Crotti
@ 2009-10-31 18:09 ` PT
2009-10-31 18:28 ` Nick Dokos
1 sibling, 0 replies; 7+ messages in thread
From: PT @ 2009-10-31 18:09 UTC (permalink / raw)
To: emacs-orgmode
andrea Crotti <andrea.crotti.0 <at> gmail.com> writes:
>
> (dolist ((d org-directories))
The loop is not run, because there are too many parens. Try this instead:
(dolist (d org-directories)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: Fast traversing directories
2009-10-31 17:31 ` andrea Crotti
2009-10-31 18:09 ` PT
@ 2009-10-31 18:28 ` Nick Dokos
2009-10-31 19:16 ` Thierry Volpiatto
1 sibling, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2009-10-31 18:28 UTC (permalink / raw)
To: andrea Crotti; +Cc: emacs-orgmode
andrea Crotti <andrea.crotti.0@gmail.com> wrote:
>
> I tried this because I have more base directories.
> (setq org-directories '("~/org" "~/uni"))
> (setq org-agenda-files ())
> (dolist ((d org-directories))
> (setq org-agenda-files
> (append org-agenda-files (find-lisp-find-files d "\.org$"))))
>
>
> But it sets org-agenda-files to nil...
Too many parens: try
(dolist (d org-directories)
(setq org-agenda-files
(append org-agenda-files (find-lisp-find-files d "\.org$"))))
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fast traversing directories
2009-10-31 18:28 ` Nick Dokos
@ 2009-10-31 19:16 ` Thierry Volpiatto
2009-11-20 20:43 ` Tim O'Callaghan
0 siblings, 1 reply; 7+ messages in thread
From: Thierry Volpiatto @ 2009-10-31 19:16 UTC (permalink / raw)
To: emacs-orgmode
Hi,
if you have traverselisp.el, you can use:
,----
| (dolist (d org-directories)
| (traverse-walk-directory d :file-fn #'(lambda (x)
| (when (string= (file-name-extension x) "org")
| (push x org-agenda-files)))))
`----
you can get traverselisp.el here:
http://www.emacswiki.org/cgi-bin/emacs/traverselisp.el
or here: (hg clone)
http://mercurial.intuxication.org/hg/traverselisp
Nick Dokos <nicholas.dokos@hp.com> writes:
> andrea Crotti <andrea.crotti.0@gmail.com> wrote:
>
>>
>> I tried this because I have more base directories.
>> (setq org-directories '("~/org" "~/uni"))
>> (setq org-agenda-files ())
>> (dolist ((d org-directories))
>> (setq org-agenda-files
>> (append org-agenda-files (find-lisp-find-files d "\.org$"))))
>>
>>
>> But it sets org-agenda-files to nil...
>
> Too many parens: try
>
> (dolist (d org-directories)
> (setq org-agenda-files
> (append org-agenda-files (find-lisp-find-files d "\.org$"))))
>
> Nick
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: Fast traversing directories
2009-10-31 19:16 ` Thierry Volpiatto
@ 2009-11-20 20:43 ` Tim O'Callaghan
0 siblings, 0 replies; 7+ messages in thread
From: Tim O'Callaghan @ 2009-11-20 20:43 UTC (permalink / raw)
To: org-mode
This version will accept wildcards and recurse one directory level level down
----
(setq org-agenda-directories '("~/org" "~/1_PROJECT/*"))
(setq org-agenda-files '())
(dolist (d1 org-agenda-directories)
(dolist (d2 (file-expand-wildcards (expand-file-name d1)))
(if (file-directory-p d2)
(dolist (f (directory-files d2 t ".org$" t))
(push f org-agenda-files)))))
----
Hope it helps.
Tim.
2009/10/31 Thierry Volpiatto <thierry.volpiatto@gmail.com>:
> Hi,
> if you have traverselisp.el, you can use:
>
> ,----
> | (dolist (d org-directories)
> | (traverse-walk-directory d :file-fn #'(lambda (x)
> | (when (string= (file-name-extension x) "org")
> | (push x org-agenda-files)))))
> `----
>
> you can get traverselisp.el here:
> http://www.emacswiki.org/cgi-bin/emacs/traverselisp.el
>
> or here: (hg clone)
> http://mercurial.intuxication.org/hg/traverselisp
>
> Nick Dokos <nicholas.dokos@hp.com> writes:
>
>> andrea Crotti <andrea.crotti.0@gmail.com> wrote:
>>
>>>
>>> I tried this because I have more base directories.
>>> (setq org-directories '("~/org" "~/uni"))
>>> (setq org-agenda-files ())
>>> (dolist ((d org-directories))
>>> (setq org-agenda-files
>>> (append org-agenda-files (find-lisp-find-files d "\.org$"))))
>>>
>>>
>>> But it sets org-agenda-files to nil...
>>
>> Too many parens: try
>>
>> (dolist (d org-directories)
>> (setq org-agenda-files
>> (append org-agenda-files (find-lisp-find-files d "\.org$"))))
>>
>> Nick
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>
> --
> A + Thierry Volpiatto
> Location: Saint-Cyr-Sur-Mer - France
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-11-20 20:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-31 17:07 Fast traversing directories andrea Crotti
2009-10-31 17:15 ` Benjamin Andresen
2009-10-31 17:31 ` andrea Crotti
2009-10-31 18:09 ` PT
2009-10-31 18:28 ` Nick Dokos
2009-10-31 19:16 ` Thierry Volpiatto
2009-11-20 20:43 ` Tim O'Callaghan
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).