X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=emacs%2Fe2ctags.pl;h=34e3e14b54d5acc330d6fd2bdc0a0acd375aaa12;hb=92e830a9086d75f086574c378b1c63ff2e00edcf;hp=ef7a8d8539ad1605aa07922d02888681bade1170;hpb=01e22528c2c3f941ba946b303423dfa59ea39444;p=p5sagit%2Fp5-mst-13.2.git diff --git a/emacs/e2ctags.pl b/emacs/e2ctags.pl index ef7a8d8..34e3e14 100644 --- a/emacs/e2ctags.pl +++ b/emacs/e2ctags.pl @@ -16,6 +16,7 @@ use strict; my $filename; my ($tag,$line_no,$line); my %tags = (); +my %filetags = (); my %files = (); my @lines = (); @@ -34,21 +35,17 @@ while (<>) { next if /struct/; if (/\x01/) { ($tag,$line_no) = /\x7F(\w+)\x01(\d+)/; - next unless $tag; - ##Take only the first entry per tag - next if defined($tags{$tag}); - $tags{$tag}{FILE} = $filename; - $tags{$tag}{LINE_NO} = $line_no; } else { tr/(//d; ($tag,$line_no) = /(\w+)\s*\x7F(\d+),/; - next unless $tag; - ##Take only the first entry per tag - next if defined($tags{$tag}); - $tags{$tag}{FILE} = $filename; - $tags{$tag}{LINE_NO} = $line_no; } + next unless $tag; + ##Take only the first entry per tag + next if defined($tags{$tag}); + $tags{$tag}{FILE} = $filename; + $tags{$tag}{LINE_NO} = $line_no; + push @{$filetags{$filename}}, $tag; } foreach $filename (keys %files) { @@ -56,8 +53,7 @@ foreach $filename (keys %files) { @lines = ; close FILE; chomp @lines; - foreach $tag ( keys %tags ) { - next unless $filename eq $tags{$tag}{FILE}; + foreach $tag ( @{$filetags{$filename}} ) { $line = $lines[$tags{$tag}{LINE_NO}-1]; if (length($line) >= 50) { $line = substr($line,0,50);