emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Recursive org-agenda-files
@ 2011-10-03 15:48 Neilen Marais
  2011-10-03 17:38 ` netty hacky
  0 siblings, 1 reply; 12+ messages in thread
From: Neilen Marais @ 2011-10-03 15:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I like to have a directory per project, with an .org file in each
directory. Is there a way to set org-agenda-files such that it can
recursively scan my whole projects dir for all org files?

Thanks
Neilen

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-03 15:48 Recursive org-agenda-files Neilen Marais
@ 2011-10-03 17:38 ` netty hacky
  2011-10-04  7:19   ` Neilen Marais
  0 siblings, 1 reply; 12+ messages in thread
From: netty hacky @ 2011-10-03 17:38 UTC (permalink / raw)
  To: Neilen Marais; +Cc: emacs-orgmode

Hi Neilen,

I think you want these in your .emacs (from
http://orgmode.org/worg/org-faq.html, "Can I add files recursively to
my list of agenda files?"):
(load-library "find-lisp")
(setq org-agenda-files (find-lisp-find-files "~/org" "\.org$"))

Or you can add each project directory to org-agenda-files yourself,
however, this is not recursive, it only adds .org files under the
project directories, not their sub-directories (see docstring of
org-agenda-files: C-h v org-agenda-files):
(setq org-agenda-files '("~/org/projA" "~/org/projB" "~/org/projC"))

In my setup, I also use the following to exclude directory "exc" from the list:
(eval-when-compile (require 'cl))
(setq org-agenda-files
      (remove-if '(lambda (x)
                    (string-match
                     (concat "^" (regexp-quote (expand-file-name
"~/org/exc/")))
                     x))
                 org-agenda-files))

Net

On Mon, Oct 3, 2011 at 8:48 AM, Neilen Marais <nmarais@gmail.com> wrote:
> Hi,
>
> I like to have a directory per project, with an .org file in each
> directory. Is there a way to set org-agenda-files such that it can
> recursively scan my whole projects dir for all org files?
>
> Thanks
> Neilen
>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-03 17:38 ` netty hacky
@ 2011-10-04  7:19   ` Neilen Marais
  2011-10-04  7:32     ` Jambunathan K
  0 siblings, 1 reply; 12+ messages in thread
From: Neilen Marais @ 2011-10-04  7:19 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

netty hacky <netty.hacky <at> gmail.com> writes:

> 
> Hi Neilen,
> 
> I think you want these in your .emacs (from
> http://orgmode.org/worg/org-faq.html, "Can I add files recursively to
> my list of agenda files?"):
> (load-library "find-lisp")
> (setq org-agenda-files (find-lisp-find-files "~/org" "\.org$"))

Thanks. I tried this, but as far as I can tell it won't automatically see new
files or directories as they are added, so I have to re-evaluate te setq every
time I add new projects or files. Or am I wrong?

Thanks
Neilen

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-04  7:19   ` Neilen Marais
@ 2011-10-04  7:32     ` Jambunathan K
  2011-10-04  7:54       ` Jambunathan K
  0 siblings, 1 reply; 12+ messages in thread
From: Jambunathan K @ 2011-10-04  7:32 UTC (permalink / raw)
  To: Neilen Marais; +Cc: emacs-orgmode

Neilen Marais <nmarais@gmail.com> writes:

> Hi,
>
> netty hacky <netty.hacky <at> gmail.com> writes:
>
>> 
>> Hi Neilen,
>> 
>> I think you want these in your .emacs (from
>> http://orgmode.org/worg/org-faq.html, "Can I add files recursively to
>> my list of agenda files?"):
>> (load-library "find-lisp")
>> (setq org-agenda-files (find-lisp-find-files "~/org" "\.org$"))
>
> Thanks. I tried this, but as far as I can tell it won't automatically see new
> files or directories as they are added, so I have to re-evaluate te setq every
> time I add new projects or files. Or am I wrong?

Have you considered adding it to say org-mode-hook?

> Thanks
> Neilen
>
>
>
>
>

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-04  7:32     ` Jambunathan K
@ 2011-10-04  7:54       ` Jambunathan K
  2011-10-04 12:42         ` Neilen Marais
  0 siblings, 1 reply; 12+ messages in thread
From: Jambunathan K @ 2011-10-04  7:54 UTC (permalink / raw)
  To: Neilen Marais; +Cc: emacs-orgmode

Jambunathan K <kjambunathan@gmail.com> writes:

> Neilen Marais <nmarais@gmail.com> writes:
>
>> Hi,
>>
>> netty hacky <netty.hacky <at> gmail.com> writes:
>>
>>> 
>>> Hi Neilen,
>>> 
>>> I think you want these in your .emacs (from
>>> http://orgmode.org/worg/org-faq.html, "Can I add files recursively to
>>> my list of agenda files?"):
>>> (load-library "find-lisp")
>>> (setq org-agenda-files (find-lisp-find-files "~/org" "\.org$"))
>>
>> Thanks. I tried this, but as far as I can tell it won't automatically see new
>> files or directories as they are added, so I have to re-evaluate te setq every
>> time I add new projects or files. Or am I wrong?

> Have you considered adding it to say org-mode-hook?

Seems like a Wrong suggestion to me.

Try using `C-c [' to add the current org file. I am assuming that org
files are created by hand and not by some daemon that spits out agenda
files when you are away from emacs.


>> Thanks
>> Neilen
>>
>>
>>
>>
>>

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-04  7:54       ` Jambunathan K
@ 2011-10-04 12:42         ` Neilen Marais
  2011-10-04 14:12           ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: Neilen Marais @ 2011-10-04 12:42 UTC (permalink / raw)
  To: emacs-orgmode

Jambunatha,


> > Have you considered adding it to say org-mode-hook?
> 
> Seems like a Wrong suggestion to me.
> 
> Try using `C-c [' to add the current org file. I am assuming that org
> files are created by hand and not by some daemon that spits out agenda
> files when you are away from emacs.

Not a daemon, no, but I do tend to move files around. I.e. I'll move a project
file/dir from my "someday" folder to my "active" folder. I would like to avoid
any further manual steps to get it integrated in my agenda.

Is there a hook function that gets called every time an agenda view is opened or
refreshed? I could probably use that to update the agenda list.

Thanks
Neilen

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-04 12:42         ` Neilen Marais
@ 2011-10-04 14:12           ` Nick Dokos
  2011-10-05  2:33             ` Matthew Sauer
  2011-10-14 18:48             ` Neilen Marais
  0 siblings, 2 replies; 12+ messages in thread
From: Nick Dokos @ 2011-10-04 14:12 UTC (permalink / raw)
  To: Neilen Marais; +Cc: nicholas.dokos, emacs-orgmode

Neilen Marais <nmarais@gmail.com> wrote:

> Jambunatha,
> 
> 
> > > Have you considered adding it to say org-mode-hook?
> > 
> > Seems like a Wrong suggestion to me.
> > 
> > Try using `C-c [' to add the current org file. I am assuming that org
> > files are created by hand and not by some daemon that spits out agenda
> > files when you are away from emacs.
> 
> Not a daemon, no, but I do tend to move files around. I.e. I'll move a project
> file/dir from my "someday" folder to my "active" folder. I would like to avoid
> any further manual steps to get it integrated in my agenda.
> 
> Is there a hook function that gets called every time an agenda view is opened or
> refreshed? I could probably use that to update the agenda list.
> 

Seek and ye shall find:

C-h v org-agenda--hook RET

will list all the matching hooks. Which one to choose? I'll leave that up
to the interested reader :-) Or try

C-h v org--hook RET

to get a list of *all* the org hooks.

Nick

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-04 14:12           ` Nick Dokos
@ 2011-10-05  2:33             ` Matthew Sauer
  2011-10-14 18:53               ` Neilen Marais
  2011-10-14 18:48             ` Neilen Marais
  1 sibling, 1 reply; 12+ messages in thread
From: Matthew Sauer @ 2011-10-05  2:33 UTC (permalink / raw)
  To: nicholas.dokos, Org Mode Mailing List

My understanding is that you want a file that gets moved into the
active directory to be automatically included in the agenda?
From worg:
You can simply include the directory (as one of the items) in the
value of the variable org-agenda-files:

(setq org-agenda-files '("/my/special/path/org/active/"))
There is another way of accomplishing the same end:

(setq org-agenda-files (file-expand-wildcards
"/my/special/path/org/active/*.org"))

The other files/directories could be in the extended text search if
needed but not part of the automatic agenda.  Just my two cents.  Not
that playing with agenda hooks might have some advantages.

Matt Sauer
On Tue, Oct 4, 2011 at 9:12 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Neilen Marais <nmarais@gmail.com> wrote:
>
>> Jambunatha,
>>
>>
>> > > Have you considered adding it to say org-mode-hook?
>> >
>> > Seems like a Wrong suggestion to me.
>> >
>> > Try using `C-c [' to add the current org file. I am assuming that org
>> > files are created by hand and not by some daemon that spits out agenda
>> > files when you are away from emacs.
>>
>> Not a daemon, no, but I do tend to move files around. I.e. I'll move a project
>> file/dir from my "someday" folder to my "active" folder. I would like to avoid
>> any further manual steps to get it integrated in my agenda.
>>
>> Is there a hook function that gets called every time an agenda view is opened or
>> refreshed? I could probably use that to update the agenda list.
>>
>
> Seek and ye shall find:
>
> C-h v org-agenda--hook RET
>
> will list all the matching hooks. Which one to choose? I'll leave that up
> to the interested reader :-) Or try
>
> C-h v org--hook RET
>
> to get a list of *all* the org hooks.
>
> Nick
>
>
>
>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-04 14:12           ` Nick Dokos
  2011-10-05  2:33             ` Matthew Sauer
@ 2011-10-14 18:48             ` Neilen Marais
  1 sibling, 0 replies; 12+ messages in thread
From: Neilen Marais @ 2011-10-14 18:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi Nick,

Nick Dokos <nicholas.dokos <at> hp.com> writes:

> Seek and ye shall find:
> 
> C-h v org-agenda--hook RET
> 
> will list all the matching hooks. Which one to choose? I'll leave that up
> to the interested reader

Indeed, doing 

(load-library "find-lisp")

(add-hook 'org-agenda-mode-hook (lambda () 
(setq org-agenda-files 
      (find-lisp-find-files "~/Dropbox/GTD/ActiveProjects" "\.org$"))
))

fixes it good. Fantastic, thanks!

Cheers
Neilen

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2011-10-05  2:33             ` Matthew Sauer
@ 2011-10-14 18:53               ` Neilen Marais
  0 siblings, 0 replies; 12+ messages in thread
From: Neilen Marais @ 2011-10-14 18:53 UTC (permalink / raw)
  To: emacs-orgmode

Matthew,

Matthew Sauer <improv.philosophy <at> gmail.com> writes:

> 
> My understanding is that you want a file that gets moved into the
> active directory to be automatically included in the agenda?
> From worg:
> You can simply include the directory (as one of the items) in the
> value of the variable org-agenda-files:
> 
> (setq org-agenda-files '("/my/special/path/org/active/"))

Thanks for the suggestion. Tried it already and found that it is unfortunately 
not recursive. I tend to make directories with projects under the active 
directory, then put the org file and supporting files in the directory. E.g.

active/proj1/proj1.org
active/prof1/info.pdf 

etc

What's nice about this is that my project notes, todos and support files are 
close to each other. Also, I can simply use the dired listing of the active dir 
as my "active projects list" in GTD parlance :)
>  Not that playing with agenda hooks might have some advantages.

I have indeed cooked up a hooky solution that should have hit the list by the 
time you read this :)

Cheers
Neilen

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Recursive org-agenda-files
  2008-10-31 12:30 Sullivan, Gregory (US SSA)
@ 2008-10-31 14:32 ` mclundin
  0 siblings, 0 replies; 12+ messages in thread
From: mclundin @ 2008-10-31 14:32 UTC (permalink / raw)
  To: Sullivan, Gregory (US SSA); +Cc: Matthew Lundin, emacs-orgmode


"Sullivan, Gregory (US SSA)" <gregory.sullivan@baesystems.com> writes:

> The function find-lisp-find-files seems to work.
> To see it, do 
>    M-x find-function
>    find-lisp-find-files
>
> To use it, you'll probably have to do
>
> (load-library "find-lisp")
> (find-lisp-find-files "~/org" "\.org")

Works perfectly. Thanks!

Matt

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: Recursive org-agenda-files
@ 2008-10-31 12:30 Sullivan, Gregory (US SSA)
  2008-10-31 14:32 ` mclundin
  0 siblings, 1 reply; 12+ messages in thread
From: Sullivan, Gregory (US SSA) @ 2008-10-31 12:30 UTC (permalink / raw)
  To: Matthew Lundin, emacs-orgmode

The function find-lisp-find-files seems to work.
To see it, do 
   M-x find-function
   find-lisp-find-files

To use it, you'll probably have to do

(load-library "find-lisp")
(find-lisp-find-files "~/org" "\.org")

HTH.

--Greg

--
Gregory T. Sullivan, Ph.D.
BAE Systems Advanced Information Technologies
6 New England Executive Park, Burlington, MA 01803
781-262-4553 (office),  978-430-3461 (cell)
gregory.sullivan@baesystems.com 


-----Original Message-----
From: emacs-orgmode-bounces+gregory.sullivan=baesystems.com@gnu.org
[mailto:emacs-orgmode-bounces+gregory.sullivan=baesystems.com@gnu.org]
On Behalf Of Matthew Lundin
Sent: Wednesday, October 29, 2008 11:40 PM
To: emacs-orgmode@gnu.org
Subject: [Orgmode] Recursive org-agenda-files


Is it possible to set the org-agenda-files variable to include all org
files within a directory recursively?

I currently use:

(set org-agenda files (file-expand-wildcards "~/org/*.org"))

This, of course, includes all org files in ~/org. 

But how would I include all org files in both ~/org and
its subdirectories without having to enter them all by hand?

E.g.,

    org/
        (.org files here)
        professional/
            (.org files here)
            research/
                (.org files here)
            teaching/
                (.org files here)
        personal/
            (.org files here)
        computer/
            (.org files here)

Thanks!

Matt Lundin


_______________________________________________
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] 12+ messages in thread

end of thread, other threads:[~2011-10-14 18:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-03 15:48 Recursive org-agenda-files Neilen Marais
2011-10-03 17:38 ` netty hacky
2011-10-04  7:19   ` Neilen Marais
2011-10-04  7:32     ` Jambunathan K
2011-10-04  7:54       ` Jambunathan K
2011-10-04 12:42         ` Neilen Marais
2011-10-04 14:12           ` Nick Dokos
2011-10-05  2:33             ` Matthew Sauer
2011-10-14 18:53               ` Neilen Marais
2011-10-14 18:48             ` Neilen Marais
  -- strict thread matches above, loose matches on Subject: below --
2008-10-31 12:30 Sullivan, Gregory (US SSA)
2008-10-31 14:32 ` mclundin

Code repositories for project(s) associated with this 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).