changeset 20395:2bd6621697d5

(sh-imenu-generic-expression): New variable. (sh-mode): Make imenu-generic-expression local. (sh-set-shell): Set imenu-generic-expression based on which shell.
author Karl Heuer <kwzh@gnu.org>
date Thu, 04 Dec 1997 04:27:50 +0000
parents dad8223e709d
children ba46225fd687
files lisp/progmodes/sh-script.el
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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