[Catalyst-dev] Ignoring Emacs temp files
Dave Rolsky
autarch at urth.org
Tue Aug 28 18:27:28 GMT 2007
On Tue, 28 Aug 2007, Dave Rolsky wrote:
> On Tue, 28 Aug 2007, Jonathan Rockway wrote:
>
>>>> When you're editing a buffer in emacs, it will create a temporary symlink
>>>> in the same directory of the file in the form ".#<filename>".
>>
>> Thanks kd++ and autarch++ :) This has been an open issue for over a
>> year because we've been waiting for users to compile a list for every
>> editor and patch MPO accordingly. I only use emacs, so all I could
>> provide was similar to Dave's patch. With this applied, I am happy :)
>
> Ronald Kimball pointed out (off-list) that my patch for the helper script
> will also catch things like ".#dir/file.pm". That's not exactly what I
> intended, but on the other hand why would we want to include that?
>
> He suggested this:
>
> ^(?!\.#)[^/]*(?:/(?!\.#)[^/]*)*(?:\.yml$|\.yaml$|\.pm)$
>
> I think that's correct. This would all be much simpler if we could run the
> regex against just the file name.
Ok, further testing shows that my regex was way way off, and Ronald's is
right on.
use strict;
use warnings;
for my $re ( qr{(?:/|^)(?!\.#).+(?:\.yml$|\.yaml$|\.pm)$},
qr{^(?!\.#)[^/]*(?:/(?!\.#)[^/]*)*(?:\.yml$|\.yaml$|\.pm)$},
)
{
for my $path ( qw( Foo.pm
/Foo.pm
dir/Foo.pm
/.#Foo.pm
dir/.#Foo.pm
.#dir/Foo.pm
) )
{
print "$path =~ $re = ", $path =~ /$re/ ? 'yes' : 'no';
print "\n";
}
}
In fact, according to that test, my regex matches everything, so I'm
not sure why it seems to fix my problem. Regardless, I'd suggest using
his ;)
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
More information about the Catalyst-dev
mailing list