From: Richard M. Stallman Date: Wed, 26 Jul 1995 18:01:10 +0000 (+0000) Subject: (perl-imenu-generic-expression) New variable. X-Git-Tag: emacs-19.34~3183 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f42484a2cd1826f60f946bba6f1ec222d8d19c3b;p=emacs.git (perl-imenu-generic-expression) New variable. (perl-mode): Set imenu-generic-expression. --- diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index d6c9d5802f9..4157554fdef 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -147,6 +147,15 @@ The expansion is entirely correct because it uses the C preprocessor." (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 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'." (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