changeset 12677:1504d644c6bc

(perl-imenu-generic-expression) New variable. (perl-mode): Set imenu-generic-expression.
author Richard M. Stallman <rms@gnu.org>
date Wed, 26 Jul 1995 18:01:10 +0000
parents d97688032b10
children 8fc56d171ada
files lisp/progmodes/perl-mode.el
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/perl-mode.el	Wed Jul 26 18:00:24 1995 +0000
+++ b/lisp/progmodes/perl-mode.el	Wed Jul 26 18:01:10 1995 +0000
@@ -147,6 +147,15 @@
   (modify-syntax-entry ?| "." perl-mode-syntax-table)
 )
 
+(defvar perl-imenu-generic-expression
+  '(
+    ;; Functions
+    (nil "^sub\\s-+\\([-A-Za-z0-9+_:]+\\)\\(\\s-\\|\n\\)*{" 1 )
+    ;;Variables
+    ("Variables" "^\\([$@%][-A-Za-z0-9+_:]+\\)\\s-*=" 1 )
+    )
+  "Imenu generic expression for Perl mode.  See `imenu-generic-expression'.")
+
 (defvar perl-font-lock-keywords
   (list
 ;   ("if" "until" "while" "elsif" "else" "unless" "for" "foreach" "continue"
@@ -273,6 +282,9 @@
   (setq parse-sexp-ignore-comments t)
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(perl-font-lock-keywords))
+  ;; Tell imenu how to handle Perl.
+  (make-local-variable 'imenu-generic-expression)
+  (setq imenu-generic-expression perl-imenu-generic-expression)
   (run-hooks 'perl-mode-hook))
 
 ;; This is used by indent-for-comment