Subject: Re: bug#73530: [PATCH] Add imenu index function for Djvu files in doc-view

From: Tassilo Horn <[email-masked]>
Date: Sat, 28 Sep 2024 21:15:31 +0200

jao <[email-masked]> writes:

>>>>> doc-view-imenu-enabled
>
> If I recall correctly, that flag is there to save CPU cycles in case
> users of doc-view are not interested in imenu.
>
> The PDF's outline is scanned using mutool when doc-view-mode is
> activated if doc-view-imenu-enabled is true, and for big files that
> can take a second or two.
>
> I am not sure why I didn't delay creation of the index, but it's
> probably because there are menu entries to create and I didn't bother
> to investigate deeper. Also, because I didn't want to see a pause the
> first time imenu was invoked on a PDF.

Thanks for explaining!

> Admittedly, most of the time the pause is small enough to make all of
> the above moot.

I think I'd prefer to delay the creation of the index until imenu is
invoked the first time and get rid of doc-view-imenu-enabled.  If we
really wanted to and the requirements are met, we could also run the
index creation in an idle-timer.  Probably not by default but maybe by
adding and documenting a function one could add to doc-view-mode-hook
for that purpose.

Bye,
  Tassilo