[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: imenu framework
From: |
Heime |
Subject: |
Re: imenu framework |
Date: |
Sun, 28 Jul 2024 23:55:50 +0000 |
Sent with Proton Mail secure email.
On Monday, July 29th, 2024 at 10:02 AM, Heime <heimeborgia@protonmail.com>
wrote:
> On Monday, July 29th, 2024 at 5:18 AM, Heime heimeborgia@protonmail.com wrote:
>
> > On Sunday, July 28th, 2024 at 6:23 PM, Joel Reicher joel.reicher@gmail.com
> > wrote:
> >
> > > Heime heimeborgia@protonmail.com writes:
> > >
> > > > imenu is a framework for mode-specific buffer indexes
> > > >
> > > > Does this mean that it can list the function names depending on
> > > > the programming language mode ?
> > >
> > > That's what the language mode should provide, yes, but strictly
> > > speaking it depends on the mode.
> > >
> > > Do you have a particular mode in mind? Its code can be examined.
> > >
> > > For example, java-ts-mode contains
> > >
> > > (setq-local treesit-simple-imenu-settings
> > > '(("Class" "\\`class_declaration\\\\\\\\\\\\\\\\'" nil nil) ("Interface"
> > > "\\\\\\\\\\\\\\\\`interface_declaration\\'" nil
> > > nil)
> > > ("Enum" "\\`record_declaration\\\\\\\\\\\\\\\\'" nil nil) ("Method"
> > > "\\\\\\\\\\\\\\\\`method_declaration\\'" nil nil)))
> > >
> > > (and then there is glue in the generic treesitter code)
> > >
> > > Cheers,
> > >
> > > - Joel
Have split the regexp strings this way, but getting into problems when
using concat.
(setq imenu-generic-expression
`( ("Functions"
,(concat "^\\s-*"
"(defun\\s-+\\([[:word:]-]+\\)") 1)
("Variables"
,(concat "^\\s-*"
"(\\(defvar\\|defvar-local\\|defconst\\)"
"\\s-+\\([[:word:]-]+\\)") 2)))