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

Bug#1036359: elpa-markdown-toc -- crashes with (wrong-type-argument consp nil)



Antoine Beaupré <anarcat@debian.org> writes:

> On 2023-06-11 14:45:19, Nicholas D. Steeves wrote:
>>
>> Here is a way to work around this bug (whether in Emacs or in markdown-toc).
[snip]
>
> Oh wow, thanks!

You're welcome!

> That said it doesn't actually work! I have tried both the `--eval` and
> the `setq` and neither fix the crash.
>
> I'm not sure this is related to native compilation, is it really?

When I 'rm -rf ~/.emacs.d/eln-cache, and restart Emacs,
markdown-toc-generate-toc works correctly, but will eventually break
again once various things are compiled again (sooner than later on a
fast machine!).

I'm not sure why the deny list hack works with an empty eln-cache, but
not after a 'rm ~/.emacs.d/eln-cache/*/markdown-toc*'.

> I thought it was some imenu thing, maybe it doesn't get autoloaded properly?

Based on your hunch, I tested removing each rdep from the eln-cache, and
I found that the (wrong-type-argument consp nil) bug occurs in
markdown-mode-toc when markdown-mode is native compiled.

markdown-toc-generate-toc succeeds for me when

  ~/.emacs.d/eln-cache/*/markdown-mode-*.eln and
  ~/.emacs.d/eln-cache/*/markdown-toc-*.eln and
  ~/.emacs.d/eln-cache/*/imenu-*.eln

are removed, and emacs is started with this minimal workaround:

  emacs --eval="(setq native-comp-deferred-compilation-deny-list '(\"markdown-mode\"))"

Yes, markdown-mode, no "toc".  For this hack to work long-term for most
users, it seems like imenu would probably need to be added to that
list...but here's the strange thing: Logically,
markdown-toc-generate-toc uses imenu, so it seems like it should trigger
native-comp of imenu at L261.  Neither markdown-mode, nor
markdown-mode-toc explicitly (require 'imenu), so yes, I think you're
right that one or both of them is depending on autoloads.  Markdown-toc
ends up native-compiled using this method, markdown-mode and imenu
don't, and for reasons that aren't yet clear, this allows markdown-toc
to function correctly.

I also wonder if there may be a dash.el+native comp bug in play.

'hope this band-aid does the trick until the root of the problem can be
identified.

Nicholas

Attachment: signature.asc
Description: PGP signature


Reply to: