Hello,
I want to tag all my emacs files. Here is my first version.
#!/usr/bin/perl use strict; use warnings; use File::Find; # tag "~/.emacs" system("etags \"C:/Documents and Settings/dirk/Application Data/.emacs +\""); # tag all .el files of "C:\Program Files\Emacs" find(\&tagEmacsFiles, "C:/Program Files/Emacs"); sub tagEmacsFiles() { if( -f $_ ) { if( $_ =~ m/\.[eE][lL]$/ ) { # option -a means append to TAGS file system("etags -a \"$File::Find::name\""); } } }
The tagging within the find function is not working. Why???
Here is the second version. This one is working.
#!/usr/bin/perl use strict; use warnings; use File::Find; my @file_list; # tag "~/.emacs" system("etags \"C:/Documents and Settings/dirk/Application Data/.emacs +\""); # tag all .el files of "C:\Program Files\Emacs" find(\&addEmacsFilesToList, "C:/Program Files/Emacs"); for my $file (@file_list) { system("etags -a $file"); } sub addEmacsFilesToList() { if( -f $_ ) { if( $_ =~ m/\.[eE][lL]$/ ) { push(@file_list, "\"$File::Find::name\""); } } }
Would be really interesting for my me why the first version is not working.
Thank you.
Greetings,
Dirk
In reply to etags not working within function called by find by Dirk80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |