diff options
| author | James Cherti | 2024-11-24 12:09:33 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2024-11-30 12:31:56 +0200 |
| commit | 2ea0919550366babfea1de6468ef9e8b1857b478 (patch) | |
| tree | c739bb5845d4b3e8c47ef338048d44c72de497f6 | |
| parent | eec1a68b009961e74d08a57bdbba5b0851dbe42f (diff) | |
| download | emacs-2ea0919550366babfea1de6468ef9e8b1857b478.tar.gz emacs-2ea0919550366babfea1de6468ef9e8b1857b478.zip | |
Support hyphen in Bash function names
* lisp/progmodes/sh-script.el (sh-imenu-generic-expression): Add
hyphen to function-name regexp.
Copyright-paperwork-exempt: yes
| -rw-r--r-- | lisp/progmodes/sh-script.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 8ba64100203..04d995d0404 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -300,6 +300,18 @@ naming the shell." | |||
| 300 | (nil | 300 | (nil |
| 301 | "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()" | 301 | "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()" |
| 302 | 1))) | 302 | 1))) |
| 303 | ;; The difference between the Bash regular expression and the sh regular | ||
| 304 | ;; expression is that Bash also allows hyphens (-). | ||
| 305 | (bash | ||
| 306 | . ((nil | ||
| 307 | ;; function FOO | ||
| 308 | ;; function FOO() | ||
| 309 | "^\\s-*function\\s-+\\([[:alpha:]_][[:alnum:]_-]*\\)\\s-*\\(?:()\\)?" | ||
| 310 | 1) | ||
| 311 | ;; FOO() | ||
| 312 | (nil | ||
| 313 | "^\\s-*\\([[:alpha:]_][[:alnum:]_-]*\\)\\s-*()" | ||
| 314 | 1))) | ||
| 303 | (mksh | 315 | (mksh |
| 304 | . ((nil | 316 | . ((nil |
| 305 | ;; function FOO | 317 | ;; function FOO |