[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11856: 24.0.97; Improve imenu expression of sh-script mode to handle
From: |
Masatake YAMATO |
Subject: |
bug#11856: 24.0.97; Improve imenu expression of sh-script mode to handle "function FOO" |
Date: |
Thu, 05 Jul 2012 02:47:46 +0900 (JST) |
This is not a bug report. This is a request for reviwing and merging a
patch.
With this patch foo in following shell script can be captured
as an imenu entry.
function foo
{
...
(Even witohut this patch
function foo()
{
...
and
foo()
{
...
can be captured.)
2012-07-04 Masatake YAMATO <yamato@redhat.com>
* progmodes/sh-script.el (sh-imenu-generic-expression): Capture
a function with `function' keyword and without parentheses like
"function FOO".
=== modified file 'lisp/progmodes/sh-script.el'
--- lisp/progmodes/sh-script.el 2012-05-11 14:24:50 +0000
+++ lisp/progmodes/sh-script.el 2012-07-04 03:57:10 +0000
@@ -327,8 +327,15 @@
(defcustom sh-imenu-generic-expression
`((sh
. ((nil
- "^\\s-*\\(function\\s-+\\)?\\([[:alpha:]_][[:alnum:]_]+\\)\\s-*()"
- 2))))
+ ;; function FOO
+ ;; function FOO()
+ "^\\s-*function\\s-+\\\([[:alpha:]_][[:alnum:]_]+\\)\\s-*\\(?:()\\)?"
+ 1)
+ ;; FOO()
+ (nil
+ "^\\s-*\\([[:alpha:]_][[:alnum:]_]+\\)\\s-*()"
+ 1)
+ )))
"Alist of regular expressions for recognizing shell function definitions.
See `sh-feature' and `imenu-generic-expression'."
:type '(alist :key-type (symbol :tag "Shell")
- bug#11856: 24.0.97; Improve imenu expression of sh-script mode to handle "function FOO",
Masatake YAMATO <=