From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael McAndrew Subject: Re: regex to find *.org in subdirectories for agenda Date: Thu, 21 May 2009 02:38:01 +0100 Message-ID: <4b58d51b0905201838j1b9f2ec6kc5df5515ca91a565@mail.gmail.com> References: <4b58d51b0905201657k5bd1916cpbed12feccb4ee459@mail.gmail.com> <87k54bp9tm.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0443664118==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M6xEY-0002OM-7r for emacs-orgmode@gnu.org; Wed, 20 May 2009 21:38:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M6xES-0002OA-Jo for emacs-orgmode@gnu.org; Wed, 20 May 2009 21:38:08 -0400 Received: from [199.232.76.173] (port=57034 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M6xES-0002O7-D0 for emacs-orgmode@gnu.org; Wed, 20 May 2009 21:38:04 -0400 Received: from mail-px0-f179.google.com ([209.85.216.179]:52637) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M6xER-0006sC-FZ for emacs-orgmode@gnu.org; Wed, 20 May 2009 21:38:04 -0400 Received: by pxi9 with SMTP id 9so839689pxi.14 for ; Wed, 20 May 2009 18:38:02 -0700 (PDT) In-Reply-To: <87k54bp9tm.fsf@gollum.intra.norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernt Hansen Cc: emacs-orgmode@gnu.org --===============0443664118== Content-Type: multipart/alternative; boundary=001636e90c9dc31b1b046a623193 --001636e90c9dc31b1b046a623193 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit yes it was. thanks, bernt, that was fantastic and helped me out of a big hole (that i dug for myself :) I decided to build a little hill to stand on next to the hole by adding the following two lines (setq org-agenda-files (find-lisp-find-files "~/Documents/Projects/Current" (rx (seq ".org" string-end)))) (add-to-list 'org-agenda-files "~/Documents") which dynamically fills my todo with all files from any subdirectory in projects and then adds todo files from my Documents directory and I can add other directories when the I feel like it. I guess I could try and rewrite that as one big regex, but life is short. thanks again! 2009/5/21 Bernt Hansen > Michael McAndrew writes: > > > Hi there, > > > > Hi Michael! > > > I'm just getting started with org mode after having watched the google > > tech talk. from my experiences so far, i think it is the tool i have > > been waiting for a long time! > > > > i've have transferred by entire huge nested todo list (which i was > > previously managing in a local mediawiki) and that has been great. > > but am now excited about being able to split up and recompile all my > > todos automatically - so i can keep everything contextually organised. > > > > I have my projects organised in directories and sub directories under > > two projects directories, "~/work" and "~/home". i want to keep *.org > > lists in each of these directories and have them automatically picked > > up by orgmode when i hit C-ca. so i might have ~/work/bbc/todo.org > > and ~/home/garden/todo.org > > I don't use org-mode like this myself but just did a quick minimal emacs > test and it seems to work fine. You can set org-agenda-files to the > directories you want to include in the agenda and all files matching the > org-agenda-file-regexp will be included in the agenda. > > > > > I found this post > > http://www.mail-archive.com/emacs-orgmode@gnu.org/msg08945.html > > > > so i presume that i need to use a regular expression in > > find-lisp-find-files to create this list of files to feed to some > > variable like org-agenda-files... > > > > and have tried a million regex inspired expressions in my emacs config > > like: > > > > (load-library "find-lisp") > > (set org-agenda files (find-lisp-find-files "~" (rx seq(string-start (or > "work" "home") ".org" string-end)))) > ^ > | > no space here. It should be org-agenda-files > > > > > but it isn't working. > > > > i'm kind of out of my depth with emacs (aquamacs actually - only have > > a few days experience) and have never got to grips with regex! but > > also loving it and would be grateful if someone could pull me out of > > this hole :) > > Here's my test setup -- I just added the directories to org-agenda-files: > > I just created files in /tmp/play/ /tmp/work/ and /tmp/foo and added > some tasks to some of these just to see if they show up in the agenda > (and they did). > > ,----[ My test directory layout ] > | bernt@gollum:~/git/org-mode$ tree /tmp/play /tmp/work /tmp/foo > | /tmp/play > | |-- a.org > | |-- b.org > | |-- c.org > | |-- d.org > | `-- e.org > | /tmp/work > | |-- w-g.org > | |-- w-h.org > | |-- w-i.org > | |-- w-j.org > | `-- w-l.org > | /tmp/foo > | |-- foo-r.org > | |-- foo-s.org > | `-- foo-t.org > | > | 0 directories, 13 files > `---- > > ,----[ /tmp/minimal.emacs ] > | (add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp")) > | (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . > org-mode)) > | (require 'org-install) > | > | (global-font-lock-mode t) > | (global-set-key "\C-cl" 'org-store-link) > | (global-set-key "\C-ca" 'org-agenda) > | (global-set-key "\C-cb" 'org-iswitchb) > | > | (setq org-agenda-files (list "/tmp/work" "/tmp/play" "/tmp/foo")) > `---- > > ,----[ /tmp/work/w-l.org ] > | #+STARTUP: > | * TODO Something for work > | SCHEDULED: <2009-05-19 Tue> > `---- > > ,----[ /tmp/foo/foo-s.org ] > | * Meeting > | DEADLINE: <2009-05-22 Fri 12:00> > `---- > > ,----[ /tmp/play/c.org ] > | #+STARTUP: > | * TODO Play with this > | SCHEDULED: <2009-05-21 Thu 15:00> > `---- > > Starting emacs with: > > emacs -q -l /tmp/minimal.emacs > > and hitting C-c a a shows the following agenda > > ,----[ /tmp/agenda.txt ] > | Week-agenda (W21): > | Monday 18 May 2009 W21 > | Tuesday 19 May 2009 > | w-l: Scheduled: TODO Something for work > | Wednesday 20 May 2009 > | w-l: Sched. 2x: TODO Something for work > | foo-s: In 2 d.: Meeting > | Thursday 21 May 2009 > | c: 15:00...... Scheduled: TODO Play with this > | Friday 22 May 2009 > | foo-s: 12:00...... Deadline: Meeting > | Saturday 23 May 2009 > | Sunday 24 May 2009 > `---- > > HTH, > Bernt > --001636e90c9dc31b1b046a623193 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable yes it was.=A0 thanks, bernt, that was fantastic and helped me out of a big= hole (that i dug for myself :)

I decided to build a little hill to = stand on next to the hole by adding the following two lines

(setq or= g-agenda-files (find-lisp-find-files "~/Documents/Projects/Current&quo= t; (rx (seq ".org" string-end))))
(add-to-list 'org-agenda-files "~/Documents")

which dy= namically fills my todo with all files from any subdirectory in projects an= d then adds todo files from my Documents directory and I can add other dire= ctories when the I feel like it.=A0 I guess I could try and rewrite that as= one big regex, but life is short.

thanks again!





2009/5/= 21 Bernt Hansen <be= rnt@norang.ca>
Michael McAndrew <michaelmc= andrew@gmail.com> writes:

> Hi there,
>

Hi Michael!

> I'm just getting started with org mode after having watched the go= ogle
> tech talk.=A0 from my experiences so far, i think it is the tool i hav= e
> been waiting for a long time!
>
> i've have transferred by entire huge nested todo list (which i was=
> previously managing in a local mediawiki) and that has been great.=A0<= br> > but am now excited about being able to split up and recompile all my > todos automatically - so i can keep everything contextually organised.=
>
> I have my projects organised in directories and sub directories under<= br> > two projects directories, "~/work" and "~/home".= =A0 i want to keep *.org
> lists in each of these directories and have them automatically picked<= br> > up by orgmode when i hit C-ca.=A0 so i might have=A0 ~/work/bbc/todo.org
> and ~/home/garden/todo.o= rg

I don't use org-mode like this myself but just did a quick minima= l emacs
test and it seems to work fine. =A0 You can set org-agenda-files to the
directories you want to include in the agenda and all files matching the org-agenda-file-regexp will be included in the agenda.

>
> I found this post
> http://www.mail-archive.com/emacs-orgmode@gnu.org/m= sg08945.html
>
> so i presume that i need to use a regular expression in
> find-lisp-find-files to create this list of files to feed to some
> variable like org-agenda-files...
>
> and have tried a million regex inspired expressions in my emacs config=
> like:
>
> (load-library "find-lisp")
> (set org-agenda files (find-lisp-find-files "~" (rx seq(stri= ng-start (or "work" "home") ".org" string-end= ))))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ^
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
=A0 =A0 =A0 =A0 =A0 =A0 =A0 no space here. =A0It should be org-agenda-file= s

>
> but it isn't working.
>
> i'm kind of out of my depth with emacs (aquamacs actually - only h= ave
> a few days experience) and have never got to grips with regex! but
> also loving it and would be grateful if someone could pull me out of > this hole :)

Here's my test setup -- I just added the directories to org-agend= a-files:

I just created files in /tmp/play/ /tmp/work/ and /tmp/foo and added
some tasks to some of these just to see if they show up in the agenda
(and they did).

,----[ My test directory layout ]
| bernt@gollum:~/git/org-mode$ tree /tmp/play /tmp/work /tmp/foo
| /tmp/play
| |-- a.org
| |-- b.org
| |-- c.org
| |-- d.org
| `-- e.org
| /tmp/work
| |-- w-g.org
| |-- w-h.org
| |-- w-i.org
| |-- w-j.org
| `-- w-l.org
| /tmp/foo
| |-- foo-r.org
| |-- foo-s.org
| `-- foo-t.org
|
| 0 directories, 13 files
`----

,----[ /tmp/minimal.emacs ]
| (add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp&q= uot;))
| (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|t= xt\\)$" . org-mode))
| (require 'org-install)
|
| (global-font-lock-mode t)
| (global-set-key "\C-cl" 'org-store-link)
| (global-set-key "\C-ca" 'org-agenda)
| (global-set-key "\C-cb" 'org-iswitchb)
|
| (setq org-agenda-files (list "/tmp/work" "/tmp/play" = "/tmp/foo"))
`----

,----[ /tmp/work/w-l.org ]=
| #+STARTUP:
| * TODO Something for work
| =A0 SCHEDULED: <2009-05-19 Tue>
`----

,----[ /tmp/foo/foo-s.org ]
| * Meeting
| =A0 DEADLINE: <2009-05-22 Fri 12:00>
`----

,----[ /tmp/play/
c.org ]
| #+STARTUP:
| * TODO Play with this
| =A0 SCHEDULED: <2009-05-21 Thu 15:00>
`----

Starting emacs with:

emacs -q -l /tmp/minimal.emacs

and hitting C-c a a shows the following agenda

,----[ /tmp/agenda.txt ]
| Week-agenda (W21):
| Monday =A0 =A0 18 May 2009 W21
| Tuesday =A0 =A019 May 2009
| =A0 w-l: =A0 =A0 =A0 =A0Scheduled: =A0TODO Something for work
| Wednesday =A020 May 2009
| =A0 w-l: =A0 =A0 =A0 =A0Sched. 2x: =A0TODO Something for work
| =A0 foo-s: =A0 =A0 =A0In =A0 2 d.: =A0Meeting
| Thursday =A0 21 May 2009
| =A0 c: =A0 =A0 =A0 =A0 =A015:00...... Scheduled: =A0TODO Play with this | Friday =A0 =A0 22 May 2009
| =A0 foo-s: =A0 =A0 =A012:00...... Deadline: =A0 Meeting
| Saturday =A0 23 May 2009
| Sunday =A0 =A0 24 May 2009
`----

HTH,
Bernt

--001636e90c9dc31b1b046a623193-- --===============0443664118== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0443664118==--