[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More imenu questions
From: |
Kevin Rodgers |
Subject: |
Re: More imenu questions |
Date: |
Thu, 10 Nov 2005 15:00:14 -0700 |
User-agent: |
Mozilla Thunderbird 0.9 (X11/20041105) |
gamename wrote:
> I'm trying to add menu items in tcl like this:
> (setq tcl-imenu-generic-expression
> '((TestCases "^aetest::testcase -tc_id \\([_-A-Za-z0-9+]+\\)[
> ]+{" 1)))
,----[ C-h v imenu-generic-expression RET ]
| imenu-generic-expression's value is nil
|
| Documentation:
| The regex pattern to use for creating a buffer index.
|
| If non-nil this pattern is passed to `imenu--generic-function'
| to create a buffer index.
|
| The value should be an alist with elements that look like this:
| (MENU-TITLE REGEXP INDEX)
| or like this:
| (MENU-TITLE REGEXP INDEX FUNCTION ARGUMENTS...)
| with zero or more ARGUMENTS. The former format creates a simple
element in
| the index alist when it matches; the latter creates a special element
| of the form (NAME POSITION-MARKER FUNCTION ARGUMENTS...)
| with FUNCTION and ARGUMENTS copied from `imenu-generic-expression'.
|
| MENU-TITLE is a string used as the title for the submenu or nil if the
| entries are not nested.
|
| REGEXP is a regexp that should match a construct in the buffer that is
| to be displayed in the menu; i.e., function or variable definitions,
| etc. It contains a substring which is the name to appear in the
| menu. See the info section on Regexps for more information.
|
| INDEX points to the substring in REGEXP that contains the name (of the
| function, variable or type) that is to appear in the menu.
|
| The variable is buffer-local.
|
| The variable `imenu-case-fold-search' determines whether or not the
| regexp matches are case sensitive, and `imenu-syntax-alist' can be
| used to alter the syntax table for the search.
|
| For example, see the value of `lisp-imenu-generic-expression' used by
| `fortran-mode' with `imenu-syntax-alist' set locally to give the
| characters which normally have "symbol" syntax "word" syntax
| during matching.
|
| Defined in `imenu'.
`----
> When I turn on the major mode (tcl-mode), I get this error:
> "Wrong type argument: symbolp, ((TestCases "^aetest::testcase -tc_id
> \\([_-A-Za-z0-9+]+\\)[ ]+{" 1))"
>
> What am I doing wrong?
You've got an extra level of parentheses:
(setq tcl-imenu-generic-expression
'(TestCases "^aetest::testcase -tc_id \\([_-A-Za-z0-9+]+\\)[
]+{" 1))
Also, [\n]+ would be more readable than a literal newline.
--
Kevin Rodgers