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

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

Re: imenu rescan automatically


From: Heime
Subject: Re: imenu rescan automatically
Date: Mon, 12 Aug 2024 12:14:08 +0000

On Monday, August 12th, 2024 at 11:57 PM, Joel Reicher <joel.reicher@gmail.com> 
wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> > On Monday, August 12th, 2024 at 10:50 PM, Joel Reicher
> > joel.reicher@gmail.com wrote:
> > 
> > > (imenu-flush-cache)
> > > 
> > > Flush the current imenu cache.
> > > This forces a full rescan of the buffer to recreate the index
> > > alist next time ‘imenu’ is invoked.
> > > 
> > > I think that will do what you want.
> > 
> > When exactly should I call it ? I want the imenu menubar to be
> > automatically updated. Currently I have to press rescan on the
> > imenu menubar to update it.
> 
> 
> I think for the kinds of things you are doing you need to get used
> to reading existing code. For example pressing rescan in the imenu
> does this...
> 
> ...
> (and (equal result imenu--rescan-item)
> (imenu--cleanup)
> (setq result t imenu--index-alist nil))
> ...
> 
> And to explain my suggestion above, imenu-flush-cache is defined
> like so
> 
> (defun imenu-flush-cache ()
> ...
> (imenu--cleanup)
> (setq imenu--index-alist nil))

Well, I could not get anywhere.  Not even this

   (when imenu-generic-expression

     (imenu-flush-cache)
     (setq imenu--index-alist nil)
     (imenu--make-index-alist t)
     (imenu--cleanup)

     (imenu-add-to-menubar "Lumi")) )




reply via email to

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