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

Collapse
Posted by John Sequeira on
Lars,

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 Tags.pm - 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|:)


#!/usr/bin/perl
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+)},
  		      help=>'procs'},
  		     {pattern=>q{create +function +(w+)},
  		      option=>'plpgsql',
  		      help=>'plpgsql functions'});

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



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