From: Karl Heuer Date: Thu, 4 Dec 1997 04:27:50 +0000 (+0000) Subject: (sh-imenu-generic-expression): New variable. X-Git-Tag: emacs-20.3~2678 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=aa2c242656c77824ca82aa43f96a20f1cef36806;p=emacs.git (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 --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index c0cfdfa8658..fa53fbca6d8 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -159,6 +159,19 @@ shell it really is." 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 @@ with your script for an edit-interpret-debug cycle." (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 @@ Calls the value of `sh-set-shell-hook' if set." 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