[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] a small contribution
From: |
Filippo A. Salustri |
Subject: |
[O] a small contribution |
Date: |
Mon, 7 Mar 2011 14:17:42 -0500 |
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@hiddenhttp://deseng.ryerson.ca/~fil/
- [O] a small contribution,
Filippo A. Salustri <=