GNU bug report logs - #8261
Perl mode imenu index ignores my/our variables

Previous Next

Package: emacs;

Reported by: Ralph Schleicher <rs <at> ralph-schleicher.de>

Date: Tue, 15 Mar 2011 20:35:01 UTC

Severity: normal

Tags: patch

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ralph Schleicher <rs <at> ralph-schleicher.de>
To: 8261 <at> debbugs.gnu.org
Subject: bug#8261: Perl mode imenu index ignores my/our variables
Date: Tue, 15 Mar 2011 21:34:27 +0100
Hi,

in Perl mode the imenu index does not list variables declared via 'my'
and 'our'.  Below is a patch together with a change log entry to fix it.
Please note that the regular expression is "\\(?:my\\|our\\))\\s-+" and
not "\\(?:\\(?:my\\|our\\))\\s-+\\)?" (optional match).  Not declaring
global variables properly is generally considered bad Perl style.


2011-03-11  Ralph Schleicher  <rs <at> ralph-schleicher.de>

	* progmodes/perl-mode.el (perl-imenu-generic-expression): Only
	match variables declared via `my' or `our'.


--- emacs-23.3/lisp/progmodes/perl-mode.el.orig	2011-01-08 12:45:14 +0100
+++ emacs-23.3/lisp/progmodes/perl-mode.el	2011-03-11 11:39:42 +0100
@@ -167,7 +167,7 @@
   '(;; Functions
     (nil "^sub\\s-+\\([-A-Za-z0-9+_:]+\\)" 1)
     ;;Variables
-    ("Variables" "^\\([$@%][-A-Za-z0-9+_:]+\\)\\s-*=" 1)
+    ("Variables" "^\\(?:my\\|our\\)\\s-+\\([$@%][-A-Za-z0-9+_:]+\\)\\s-*=" 1)
     ("Packages" "^package\\s-+\\([-A-Za-z0-9+_:]+\\);" 1)
     ("Doc sections" "^=head[0-9][ \t]+\\(.*\\)" 1))
   "Imenu generic expression for Perl mode.  See `imenu-generic-expression'.")


-- 
Ralph




This bug report was last modified 14 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.