[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] a small contribution
From: |
Marcelo de Moraes Serpa |
Subject: |
Re: [O] a small contribution |
Date: |
Tue, 8 Mar 2011 12:03:25 -0600 |
Nice Filippo. I think this kind of integration stuff is really
interesting. I was thinking about something similar as well. Thanks
for sharing.
On Mon, Mar 7, 2011 at 1:17 PM, Filippo A. Salustri <address@hidden> wrote:
> Hi all,
> I use geektool on my Mac to put useful things on my desktop. (Rainmeter is
> the equivalent program for windoze.)
> Anyways, I would like have some todo items show up in geektool, but emacs
> eats cpu, aquamacs doesn't do --batch stuff well, and I hate wasting cycles.
> So I wrote a small perl program that digests every file in my org directory
> looking for todos. It runs blindingly fast compared to emacs, and it does
> what I need it to.
> I've included the script at the end of this msg, should anyone else find it
> interesting.
> One should consider changing the values of $orgdir and $re.
> And (maybe) the location of perl.
> It parses :CATEGORY: properties and prints that out (or the file name if
> there's no category) for each task with a keyword matching one in $re.
> It's not perfect, I know. But it does work for me.
> Cheers.
> Fil
> #!/usr/bin/perl
> $orgdir = '/Users/fil/Dropbox/org';
> $re = 'ACTIVE|REVIEW';
> @files = ();
> $line = '';
> $category = '';
> # get files
> opendir D, $orgdir;
> @files = grep { /\.org$/ } readdir(D);
> closedir D;
> for my $file (@files) {
> $category = $file;
> $category =~ s/\.org$//;
> open F, "$orgdir/$file";
> while ($line = <F>) {
> if ( $line =~ m/:CATEGORY: *(.+)$/ ) { $category = $1; }
> if ( $line =~ m/^\*+ +($re) +(.+)$/ ) {
> printf "%-13s: %s\n", $category, $2;
> }
> }
> close F;
> }
>
> --
> Filippo A. Salustri, Ph.D., P.Eng.
> Mechanical and Industrial Engineering
> Ryerson University
> 350 Victoria St, Toronto, ON
> M5B 2K3, Canada
> Tel: 416/979-5000 ext 7749
> Fax: 416/979-5265
> Email: address@hidden
> http://deseng.ryerson.ca/~fil/
>