unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Joel Reicher <joel.reicher@gmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: imenu rescan automatically
Date: Mon, 12 Aug 2024 12:14:08 +0000	[thread overview]
Message-ID: <fP1HGy46Jz10J0S3OPBP7qRG4ghkGXuUIlqH-VMkRgNBy8cpHdL18EDiQNADD50fn75oOfTp3KnaDHThiZoG3ulPNFp882i4GiFLOIWWqSA=@protonmail.com> (raw)
In-Reply-To: <86sevaymv3.fsf@gmail.com>

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	other threads:[~2024-08-12 12:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11 16:51 imenu rescan automatically Heime
2024-08-11 23:41 ` Joel Reicher
2024-08-12  9:34   ` Heime
2024-08-12 10:13     ` Joel Reicher
2024-08-12 10:21       ` Heime
2024-08-12 10:50         ` Joel Reicher
2024-08-12 11:27           ` Heime
2024-08-12 11:57             ` Joel Reicher
2024-08-12 12:14               ` Heime [this message]
2024-08-12 12:20                 ` Joel Reicher
2024-08-12 12:32                   ` Christopher Dimech
2024-08-12 13:02                     ` Joel Reicher

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='fP1HGy46Jz10J0S3OPBP7qRG4ghkGXuUIlqH-VMkRgNBy8cpHdL18EDiQNADD50fn75oOfTp3KnaDHThiZoG3ulPNFp882i4GiFLOIWWqSA=@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).