help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Listing headings in dedicated buffer with imenu.


From: Heime
Subject: Re: Listing headings in dedicated buffer with imenu.
Date: Mon, 29 Jul 2024 10:32:04 +0000





Sent with Proton Mail secure email.

On Monday, July 29th, 2024 at 10:26 PM, Heime <heimeborgia@protonmail.com> 
wrote:

> 
> 
> 
> 
> 
> Sent with Proton Mail secure email.
> 
> 
> On Monday, July 29th, 2024 at 9:33 PM, Stephen Berman stephen.berman@gmx.net 
> wrote:
> 
> > On Mon, 29 Jul 2024 08:48:38 +0000 Heime heimeborgia@protonmail.com wrote:
> > 
> > > I wish to list headings in a dedicated buffer with imenu.
> > > The listing should be in the order in which headings occur
> > > in the buffer.
> > > 
> > > Have done the following, but the buffer ends up empty.
> > > 
> > > (defun vodil-imenu-bfh ()
> > > "Insert imenu headings in order in a dedicated buffer."
> > > (interactive)
> > > 
> > > (let ((imenu-items (imenu--make-index-alist t))
> > > (buffer-name "Imenu Headings"))
> > > (with-current-buffer (get-buffer-create buffer-name)
> > > (erase-buffer)
> > > (dolist (item imenu-items)
> > > (let ((name (car item))
> > > (position (cdr item)))
> > > (when (and (stringp name) (number-or-marker-p position))
> > > (insert (format "%s\n" name)))))
> > > (goto-char (point-min)))
> > > (pop-to-buffer buffer-name)))
> > 
> > It works for me, as long as imenu.el is loaded.
> > 
> > Steve Berman
> 
> 
> What would I need to load it ?

I did put (require 'imenu)

But in the buffer I only get rescan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]