aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVisuwesh2022-06-11 13:05:17 +0200
committerLars Ingebrigtsen2022-06-11 13:05:17 +0200
commit4881ce7a746d95e702d7328689949b2ae4931692 (patch)
tree59c155920bb62f20323ded4299ab26dc8bb29c53
parenta6b8bcad58246ed8dcf4674f9df4a6a6859212f3 (diff)
downloademacs-4881ce7a746d95e702d7328689949b2ae4931692.tar.gz
emacs-4881ce7a746d95e702d7328689949b2ae4931692.zip
Support mksh-specific function names in imenu
* lisp/progmodes/sh-script.el (sh-imenu-generic-expression): Add mksh-specific function names to imenu-generic-expression (bug#55889).
-rw-r--r--lisp/progmodes/sh-script.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 4d2554c0870..04f65b8dcad 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -286,7 +286,7 @@ naming the shell."
286 :group 'sh-script) 286 :group 'sh-script)
287 287
288(defcustom sh-imenu-generic-expression 288(defcustom sh-imenu-generic-expression
289 '((sh 289 `((sh
290 . ((nil 290 . ((nil
291 ;; function FOO 291 ;; function FOO
292 ;; function FOO() 292 ;; function FOO()
@@ -295,8 +295,21 @@ naming the shell."
295 ;; FOO() 295 ;; FOO()
296 (nil 296 (nil
297 "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()" 297 "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()"
298 1) 298 1)))
299 ))) 299 (mksh
300 . ((nil
301 ;; function FOO
302 ;; function FOO()
303 ,(rx bol (* (syntax whitespace)) "function" (+ (syntax whitespace))
304 (group (1+ (not (any "\0\t\n \"$&'();<=>\\`|#*?[]/"))))
305 (* (syntax whitespace)) (? "()"))
306 1)
307 (nil
308 ;; FOO()
309 ,(rx bol (* (syntax whitespace))
310 (group (1+ (not (any "\0\t\n \"$&'();<=>\\`|#*?[]/"))))
311 (* (syntax whitespace)) "()")
312 1))))
300 "Alist of regular expressions for recognizing shell function definitions. 313 "Alist of regular expressions for recognizing shell function definitions.
301See `sh-feature' and `imenu-generic-expression'." 314See `sh-feature' and `imenu-generic-expression'."
302 :type '(alist :key-type (symbol :tag "Shell") 315 :type '(alist :key-type (symbol :tag "Shell")