* imenu framework
@ 2024-07-27 21:29 Heime
2024-07-28 6:23 ` Joel Reicher
0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2024-07-27 21:29 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
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 ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: imenu framework
2024-07-27 21:29 imenu framework Heime
@ 2024-07-28 6:23 ` Joel Reicher
2024-07-28 17:18 ` Heime
0 siblings, 1 reply; 5+ messages in thread
From: Joel Reicher @ 2024-07-28 6:23 UTC (permalink / raw)
To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: imenu framework
2024-07-28 6:23 ` Joel Reicher
@ 2024-07-28 17:18 ` Heime
2024-07-28 22:02 ` Heime
0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2024-07-28 17:18 UTC (permalink / raw)
To: Joel Reicher; +Cc: Heime via Users list for the GNU Emacs text editor
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
Am currently working on elisp code. imenu makes categorisation by variables
etc. Can one remove the categorisation, and make it list only the function
names, or the variables, or the consts ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: imenu framework
2024-07-28 17:18 ` Heime
@ 2024-07-28 22:02 ` Heime
2024-07-28 23:55 ` Heime
0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2024-07-28 22:02 UTC (permalink / raw)
To: Heime; +Cc: Joel Reicher, Heime via Users list for the GNU Emacs text editor
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
>
>
> Am currently working on elisp code. imenu makes categorisation by variables
> etc. Can one remove the categorisation, and make it list only the function
> names, or the variables, or the consts ?
Have done this function, but cannot get imenu to run and show the function names
It seems to require arguments, but I do not know what has to be done.
(defun vodil-imenu-function-list ()
"Set up `imenu` to show a list of functions in the current buffer."
(interactive)
(setq imenu-generic-expression
'((nil "^(defun\\s-+\\([^ \t\n]+\\)" 1)))
(imenu-add-to-menubar "Function List")
(imenu))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: imenu framework
2024-07-28 22:02 ` Heime
@ 2024-07-28 23:55 ` Heime
0 siblings, 0 replies; 5+ messages in thread
From: Heime @ 2024-07-28 23:55 UTC (permalink / raw)
To: Heime; +Cc: Joel Reicher, Heime via Users list for the GNU Emacs text editor
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)))
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-28 23:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-27 21:29 imenu framework Heime
2024-07-28 6:23 ` Joel Reicher
2024-07-28 17:18 ` Heime
2024-07-28 22:02 ` Heime
2024-07-28 23:55 ` Heime
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.