emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Filippo A. Salustri" <salustri@ryerson.ca>
To: emacs-orgmode@gnu.org
Subject: a small contribution
Date: Mon, 7 Mar 2011 14:17:42 -0500	[thread overview]
Message-ID: <AANLkTimYty=EC_J_7HV8gB+ERJYyCbp7Y+D6JvLVKtE5@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]

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: salustri@ryerson.ca
http://deseng.ryerson.ca/~fil/

[-- Attachment #2: Type: text/html, Size: 2283 bytes --]

             reply	other threads:[~2011-03-07 19:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 19:17 Filippo A. Salustri [this message]
2011-03-08 18:03 ` Marcelo de Moraes Serpa
2011-03-17  9:59 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimYty=EC_J_7HV8gB+ERJYyCbp7Y+D6JvLVKtE5@mail.gmail.com' \
    --to=salustri@ryerson.ca \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: a small contribution' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).