# HG changeset patch # User Karl Heuer # Date 881209670 0 # Node ID 2bd6621697d5530b2fe678b2d6b13d8535dc9076 # Parent dad8223e709d28ac6c825b3db5f2e31f3bef4c81 (sh-imenu-generic-expression): New variable. (sh-mode): Make imenu-generic-expression local. (sh-set-shell): Set imenu-generic-expression based on which shell. diff -r dad8223e709d -r 2bd6621697d5 lisp/progmodes/sh-script.el --- a/lisp/progmodes/sh-script.el Thu Dec 04 04:20:34 1997 +0000 +++ b/lisp/progmodes/sh-script.el Thu Dec 04 04:27:50 1997 +0000 @@ -159,6 +159,19 @@ sexp)))) :group 'sh-script) +(defcustom sh-imenu-generic-expression + (list + (cons 'sh + (concat + "\\(^\\s-*function\\s-+[A-Za-z_][A-Za-z_0-9]*\\)" + "\\|" + "\\(^\\s-*[A-Za-z_][A-Za-z_0-9]*\\s-*()\\)"))) + "*Regular expression for recognizing shell function definitions. +See `sh-feature'." + :type '(repeat (cons (symbol :tag "Shell") + regexp)) + :group 'sh-script) + (defvar sh-shell-variables nil "Alist of shell variable names that should be included in completion. These are used for completion in addition to all the variables named @@ -690,6 +703,7 @@ (make-local-variable 'skeleton-newline-indent-rigidly) (make-local-variable 'sh-shell-variables) (make-local-variable 'sh-shell-variables-initialized) + (make-local-variable 'imenu-generic-expression) (setq major-mode 'sh-mode mode-name "Shell-script" indent-line-function 'sh-indent-line @@ -807,6 +821,7 @@ mode-line-process (format "[%s]" sh-shell) sh-shell-variables nil sh-shell-variables-initialized nil + imenu-generic-expression (sh-feature sh-imenu-generic-expression) shell (sh-feature sh-variables)) (set-syntax-table (sh-feature sh-mode-syntax-table)) (while shell