emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4881ce7a74: Support mksh-specific function names in imenu


From: Lars Ingebrigtsen
Subject: master 4881ce7a74: Support mksh-specific function names in imenu
Date: Sat, 11 Jun 2022 07:06:04 -0400 (EDT)

branch: master
commit 4881ce7a746d95e702d7328689949b2ae4931692
Author: Visuwesh <visuweshm@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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).
---
 lisp/progmodes/sh-script.el | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 4d2554c087..04f65b8dca 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -286,7 +286,7 @@ naming the shell."
   :group 'sh-script)
 
 (defcustom sh-imenu-generic-expression
-  '((sh
+  `((sh
      . ((nil
         ;; function FOO
         ;; function FOO()
@@ -295,8 +295,21 @@ naming the shell."
        ;; FOO()
        (nil
         "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()"
-        1)
-       )))
+        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")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]