Variable: sh-imenu-generic-expression

sh-imenu-generic-expression is a customizable variable defined in sh-script.el.gz.

Value

((sh
  (nil "^\\s-*function\\s-+\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*\\(?:()\\)?" 1)
  (nil "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()" 1))
 (mksh
  (nil "^\\s-*function\\s-+\\([^]�	\n \"-$&-*/;-?[\\`|]+\\)\\s-*\\(?:()\\)?" 1)
  (nil "^\\s-*\\([^]�	\n \"-$&-*/;-?[\\`|]+\\)\\s-*()" 1)))

Documentation

Alist of regular expressions for recognizing shell function definitions.

See sh-feature and imenu-generic-expression.

This variable was added, or its default value changed, in Emacs 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sh-script.el.gz
(defcustom sh-imenu-generic-expression
  `((sh
     . ((nil
	 ;; function FOO
	 ;; function FOO()
         "^\\s-*function\\s-+\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*\\(?:()\\)?"
         1)
	;; FOO()
	(nil
	 "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()"
	 1)))
    (mksh
     . ((nil
         ;; function FOO
         ;; function FOO()
         ,(rx bol (* (syntax whitespace)) "function" (+ (syntax whitespace))
              (group (1+ (not (any "\0\t\n \"$&'();<=>\\`|#*?[]/"))))
              (* (syntax whitespace)) (? "()"))
         1)
        (nil
         ;; FOO()
         ,(rx bol (* (syntax whitespace))
              (group (1+ (not (any "\0\t\n \"$&'();<=>\\`|#*?[]/"))))
              (* (syntax whitespace)) "()")
         1))))
  "Alist of regular expressions for recognizing shell function definitions.
See `sh-feature' and `imenu-generic-expression'."
  :type '(alist :key-type (symbol :tag "Shell")
		:value-type (alist :key-type (choice :tag "Title"
						     string
						     (const :tag "None" nil))
				   :value-type
				   (repeat :tag "Regexp, index..." sexp)))
  :group 'sh-script
  :version "29.1")