unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Heime <heimeborgia@protonmail.com>
Cc: Joel Reicher <joel.reicher@gmail.com>,
	Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: imenu framework
Date: Sun, 28 Jul 2024 22:02:41 +0000	[thread overview]
Message-ID: <7U1y4ZfDEPDy1EhmNhXap-Nyr43egKTVAHLTLB0D04GPqXCZJKNibj8op97CZlA42y0L4IniVZN4sH_vK-mxeEb9rQ9nYIrA_k07O2gqzlc=@protonmail.com> (raw)
In-Reply-To: <8jIXQcgOXFuqQTClt1GbKHohBS9BcyvEfxE8KvEHbOiIcaVIelxamMavez20OoZ5ZvDrse91U_mMh5-_3zUItLjPD8BT-IZ3DZpWxRCkeFo=@protonmail.com>

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





  reply	other threads:[~2024-07-28 22:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-07-28 23:55       ` Heime

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='7U1y4ZfDEPDy1EhmNhXap-Nyr43egKTVAHLTLB0D04GPqXCZJKNibj8op97CZlA42y0L4IniVZN4sH_vK-mxeEb9rQ9nYIrA_k07O2gqzlc=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=joel.reicher@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).