emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* a small contribution
@ 2011-03-07 19:17 Filippo A. Salustri
  2011-03-08 18:03 ` Marcelo de Moraes Serpa
  2011-03-17  9:59 ` Bastien
  0 siblings, 2 replies; 3+ messages in thread
From: Filippo A. Salustri @ 2011-03-07 19:17 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: a small contribution
  2011-03-07 19:17 a small contribution Filippo A. Salustri
@ 2011-03-08 18:03 ` Marcelo de Moraes Serpa
  2011-03-17  9:59 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-03-08 18:03 UTC (permalink / raw)
  To: Filippo A. Salustri; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: a small contribution
  2011-03-07 19:17 a small contribution Filippo A. Salustri
  2011-03-08 18:03 ` Marcelo de Moraes Serpa
@ 2011-03-17  9:59 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2011-03-17  9:59 UTC (permalink / raw)
  To: Filippo A. Salustri; +Cc: emacs-orgmode

Hi Filippo,

"Filippo A. Salustri" <salustri@ryerson.ca> writes:

> So I wrote a small perl program that digests every file in my org
> directory looking for todos.

Such a script could go on Worg -- perhaps here:

  http://orgmode.org/worg/org-tools/index.html

If you want to contribute to Worg, please read this:

  http://orgmode.org/worg/worg-about.html

Best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-17 11:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-07 19:17 a small contribution Filippo A. Salustri
2011-03-08 18:03 ` Marcelo de Moraes Serpa
2011-03-17  9:59 ` Bastien

Code repositories for project(s) associated with this public 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).