GNU bug report logs -
#11856
24.0.97; Improve imenu expression of sh-script mode to handle "function FOO"
Previous Next
Reported by: Masatake YAMATO <yamato <at> redhat.com>
Date: Wed, 4 Jul 2012 17:53:02 UTC
Severity: minor
Tags: patch
Found in version 24.0.97
Done: Chong Yidong <cyd <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <at> 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")
This bug report was last modified 12 years and 308 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.