From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: a small contribution Date: Mon, 7 Mar 2011 14:17:42 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e64c3efa8ded22049de95921 Return-path: Received: from [140.186.70.92] (port=42876 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwfwC-0002iD-Qh for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 14:17:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwfwA-0004Ck-IO for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 14:17:48 -0500 Received: from mail-ew0-f41.google.com ([209.85.215.41]:53584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwfwA-0004CY-43 for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 14:17:46 -0500 Received: by ewy10 with SMTP id 10so1678596ewy.0 for ; Mon, 07 Mar 2011 11:17:44 -0800 (PST) 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: emacs-orgmode@gnu.org --0016e64c3efa8ded22049de95921 Content-Type: text/plain; charset=ISO-8859-1 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 = ) { 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: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --0016e64c3efa8ded22049de95921 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi all,

I use geektool on my Mac to put useful things on= my desktop. =A0(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 c= ycles.
So I wrote a small perl program that digests every file in my org dire= ctory looking for todos. =A0It runs blindingly fast compared to emacs, and = it does what I need it to.

I've included the s= cript 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 ther= e's no category) for each task with a keyword matching one in $re.
It's not perfect, I know. =A0But it does work for me.
<= div>
Cheers.
Fil

#!/u= sr/bin/perl

$orgdir =3D '/Users/fil/Dropbox/or= g';
$re =3D 'ACTIVE|REVIEW';

@files =3D (= );
$line =3D '';
$category =3D '';

# get files
opendir D, $orgdir;
@f= iles =3D grep { /\.org$/ } readdir(D);
closedir D;

for my $file (@files) {
=A0=A0$category =3D $file;
=A0=A0$category =3D~ s/\.org$//;
=A0=A0open F, "$orgdir/$file";
=A0=A0while ($line= =3D <F>) {
=A0=A0 =A0if ( $line =3D~ m/:CATEGORY: *(.+)$/ ) { $category =3D $1; }=
=A0=A0 =A0if ( $line =3D~ m/^\*+ +($re) +(.+)$/ ) {
= =A0=A0 =A0 =A0printf "%-13s: %s\n", $category, $2;
=A0= =A0 =A0}
=A0=A0}
=A0=A0close F;
}


--
Filippo A. Salust= ri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson Unive= rsity
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-50= 00 ext 7749
Fax: 416/979-5265
Email: salustri= @ryerson.ca
http://deseng= .ryerson.ca/~fil/
--0016e64c3efa8ded22049de95921--