Skip to content

Commit

Permalink
Make restarter ignore Emacs lock files
Browse files Browse the repository at this point in the history
which are being created when user modifies some file.

Emacs creates symbolic link in same directory as modified file and
prepends ".#" to the file name.

So when user edits /some/path/Foo.pm Emacs creates /some/path/.#Foo.pm

http://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html
  • Loading branch information
Marian Schubert committed Apr 25, 2013
1 parent 9495dee commit 1cfc7c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Plack/Loader/Restarter.pm
Expand Up @@ -52,7 +52,7 @@ sub valid_file {
if ( $file->{path} =~ m{(\d+)$} && $1 >= 4913 && $1 <= 5036) {
return 0;
}
$file->{path} !~ m!\.(?:git|svn)[/\\]|\.(?:bak|swp|swpx|swx)$|~$|_flymake\.p[lm]$!;
$file->{path} !~ m!\.(?:git|svn)[/\\]|\.(?:bak|swp|swpx|swx)$|~$|_flymake\.p[lm]$|\.#!;
}

sub run {
Expand Down
1 change: 1 addition & 0 deletions t/Plack-Loader/restarter_valid.t
Expand Up @@ -12,6 +12,7 @@ my @ignore = qw(
.git/123 .svn/abc Foo.pm~ _flymake.pl /Users/joe/foo.pl~ /foo/bar/x.txt.bak
/path/to/foo.swp /path/to/foo.swpx /path/to/foo.swx
/path/to/4913 /path/to/5036
/path/to/.#Foo.pm
);

ok $r->valid_file({ path => $_ }), "$_ is valid" for @match;
Expand Down

0 comments on commit 1cfc7c6

Please sign in to comment.