Forum OpenACS Q&A: Response to Tcl namespaces and Emacs etags

Posted by John Sequeira on

Is the following helpful?

My very-slowly progressing OpenACS sql server port is done on Windows (naturally), where I couldn't get the usual find/grep/etags magic to work. I wrote a small perl script using - it also will add tags for sql files (just 'create function'). It doesn't support namespaces, but I think it would if the 'w' below was tweaked to be (w|:)

use Tags;
use Data::Dumper;
use File::Find;
use vars qw/*name *dir *prune @files/;
*name   = *File::Find::name;
*dir    = *File::Find::dir;
*prune  = *File::Find::prune;

# Traverse desired filesystems
File::Find::find({wanted => &wanted}, 'k:/projects/ms_oacs/packages/');

sub wanted {
    return unless (/^.*.(tcl|sql)z/s && !(/foo/ || /^_/ || /,v$/));
    push @files, $File::Find::name;
      $tagparser=new Tags ('tcl',
  		     {pattern=>q{(?:ad_)?proc (?:-public|-private)? (w+)},
  		     {pattern=>q{create +function +(w+)},
  		      help=>'plpgsql functions'});

    $tagparser->parse(files=>@files, vi=>undef, emacs=>'TAGS',add=>['plpgsql']);

Also, the CPAN file had a bug in it. I don't remember what it was, but here's my modified file