emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emacs-wiki-discuss] questions from an enthusiastic novice


From: Ray Fix
Subject: Re: [emacs-wiki-discuss] questions from an enthusiastic novice
Date: Tue, 20 Apr 2004 00:57:21 -0400

On Apr 19, 2004, at 8:17 PM, Ray Fix wrote:
4)  Listing all of the Tasks

Is there a way to list all of the (open) tasks in all of the projects. I can probably come up with a perl one-liner for doing this but maybe there is a better way. ??


So, below is an example of what I mean. It is a perl script (more than one line ;-) that goes through the ProjectFiles and creates a link farm of open tasks in a file called Index. It sets the file to readonly since editing it would not be a good idea. (^_^);;

It seems pretty useful to me ... but there might be a better way .... I'm probably not be getting the big picture yet.

Ray

----

!/usr/bin/perl

# change this variable to where your planner files are
my $planDir = "/Users/fixra/Plans";

# read in wikiword style files only
opendir(DIR, $planDir);
my @files = grep { /^([A-Z][a-z]+){2,}$/ } readdir(DIR);
closedir(DIR);

# make the file writeable
chmod 0666, "$planDir/Index";

open OUT, ">$planDir/Index" or die("couldn't open $planDir/Index");

print OUT "* Open Tasks by Project\n";
print OUT "** THIS FILE WAS AUTOMATICALLY GENERATED -- DO NOT EDIT\n\n";

my $file;
foreach $file (@files)
{
# Print the File name... this will make a link that we can jump to and
    # change the tasks on that page
    print OUT "$file\n";

    open(IN, $planDir."/".$file) or die("can't process $planDir/$file");
    while( $line = <IN> )
    {
        print OUT $line if ($line =~ /^#[ABC]\d+\s+_\s+/)
    }
    close IN;
    print OUT "\n";
}

# make the file read only
chmod 0444, "$planDir/Index";





reply via email to

[Prev in Thread] Current Thread [Next in Thread]