I'm trying to add support for imenu
in a major mode I currently writing.
Reading documentation I've found that its API looks simple and all I want to do is to write a function and bind it to imenu-create-index-function
.
Documentation for imenu--index-alist
also declares something called nested sub-alist
:
A nested sub-alist element looks like (INDEX-NAME . SUB-ALIST). The function ‘imenu--subalist-p’ tests an element and returns t if it is a sub-alist.
Does it mean that one could make imenu
have nested structure like?
- index 1
- sub-index
- ...
- index 2
I've tried to return following from funciton bound to imenu-create-index-function
:
'(("item 1" . '(("sub-item" . 1))) ("item 2" . 1))
And error says that it violates integer-or-marker-p
at '(("sub-item" . 1))
.
If nested structures are possible, how to form them?