GNU bug report logs - #64516
[PATCH] docview: Only enable imenu when supported

Previous Next

Package: emacs;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Fri, 7 Jul 2023 15:30:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 64516 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>, 64516 <at> debbugs.gnu.org
Subject: Re: bug#64516: [PATCH] docview: Only enable imenu when supported
Date: Sun, 09 Jul 2023 10:13:41 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Morgan & Eli,

>> To re-create the error open up an EPUB file (or possibly any non-PDF
>> file in doc-view) and press 'M-g i' to run 'imenu'.  Doing that I get
>> the following error:
>> 
>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>   string-match("\\`PK\\'" nil)
>>   imenu-find-default("PK" (("*Rescan*" . -99) nil))
>>   imenu--completion-buffer((("*Rescan*" . -99) nil) nil)
>>   imenu-choose-buffer-index()
>>   byte-code("\300 C\207" [imenu-choose-buffer-index] 1)
>>   command-execute(imenu)
>
> Thanks.
>
> Tassilo, any comments to the problem and the proposed patch?

I couldn't test it because all epub files I found result in

  imenu unavailable: "No items suitable for an index found in this buffer"

and not the described error.  Anyhow, I've looked at the patch (V3)
which basically looks good to me.

However, I'm not sure if setting doc-view-imenu-enabled to nil if mutool
is there but the doc is not a PDF is the right thing.  I think the only
difference is the error you get when invoking imenu, i.e., if we'd skip
that hunk of the patch and cater for the possibility that "mutool show"
might eventually support epub files, you'd get

  "Unable to create imenu index using `mutool'"

right now.  With that hunk, you get

  "This buffer cannot use ‘imenu-default-create-index-function’"

which is not really better.

So I'd suggest leave the doc-view-imenu-enabled initialization as-is and
in the "mutool show exits non-zero case", we signal a
imenu-unavailable-error (rather than a plain error) with the message
that's already there in the patch.

Bye,
Tassilo




This bug report was last modified 1 year and 358 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.