[Dirvish] pattern matching hash on excludes

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Thu Oct 27 06:52:04 PDT 2005


On Thu, 2005-10-27 at 15:41 +0200, Paul Slootman wrote:
> On Thu 27 Oct 2005, mfaz001-foo at yahoo.com wrote:
> >  
> > > How about:
> > > 
> > > exclude:
> > >     [#]cvs.*
> > 
> > Alas not. There's this around line 1176 of the dirvish
> > script: 
> > -----------------------------------------    
> > while(<$CONFIG>)
> >         {
> >                 chomp;
> >                 s/\s*#.*$//;
> 
> This should probably be:
> 
>                 s/^\s*#.*$//;
> 
> This means that comments can only be on a line of their own (not at the
> end of "real" configuration lines), but I wonder how bad that would be

It would break existing config files, so it's probably not a good idea.

> Otherwise something like this, so that escaping the # would work:
> 
>                 if (/\\#/) {
>                     s/\\#/#/;
>                 }
>                 else {
>                     s/\s*#.*$//;
>                 }

I don't think that allows for both \# and # occuring on the same line or
more than one \#. How about something like:

  s/^#.*$//;
  s/\s*[^\\]#.*$//;
  s/\\#/#/g;

Cheers, Dave



More information about the Dirvish mailing list