all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <yamato@redhat.com>
To: 11856@debbugs.gnu.org
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)	[thread overview]
Message-ID: <20120705.024746.486687518756828993.yamato@redhat.com> (raw)

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")






             reply	other threads:[~2012-07-04 17:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-04 17:47 Masatake YAMATO [this message]
2012-07-08 23:24 ` bug#11856: 24.0.97; Improve imenu expression of sh-script mode to handle "function FOO" Stefan Monnier
2012-07-11  5:45   ` Masatake YAMATO
2012-07-18 13:42     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120705.024746.486687518756828993.yamato@redhat.com \
    --to=yamato@redhat.com \
    --cc=11856@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.