Open sandinmyjoints opened 3 years ago
I cannot reproduce this issue with both Emacs 28.0.50(2021/01/05 master branch) and 27.1.
I did
emacs -Q -l markdown-mode.el test.md
M-x imenu
Then no error happens. Could you tell us how to reproduce this issue in more detail ? cursor position, minimum configuration etc.
Are you by any change using the native-comp
branch from emacs 28? I had a similar issue with that branch (I don't recall how I fixed it at the moment, however)
I am, yes! Would definitely be interested in your fix.
I think that the following were among the steps that restored imenu
to an usable state for me (in the context of markdown-mode
):
(setq markdown-nested-imenu-heading-index nil)
to your init.elWhy this works, I don't know. Could be that I did more stuff to fix this.
Does this issue really have to do with emacs 28?
Yes, but only in so far emacs 28 introduced the native comp feature, which at one point broke some imenu stuff.
I still cannot reproduce this issue with emacs master branch(2021/04/30) with native comp build flag.
@syohex could be that this (or some underlying) issue has been fixed by now, especially since the native-comp branch is under heavy development. In any case, I can't reproduce this issue anymore either.
Thanks for information. Please reopen if this issue happens again
I found this issue because I ran into it, please reopen. I'll report any debugging info here when I have some time to dig into it.
yes, several days ago,the problem seems fixed by emacs28,but it appeared again after I update the native-comp branch...
@wyuenho please try to latest code. And this issue is not markdown-mode issue. If you still have problem, please report issue to emacs development mailing list.
I can confirm this issue exists in GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.7 (Build 19H1217)) of 2021-06-23
.
Setting markdown-nested-imenu-heading-index
to nil
can be a workaround.
@syohex @jrblevin Can you please reopen this? This is still happening.
Hmm, I cannot reproduce this issue latest emacs(enable native compile) version ? I think this is not markdown-mode issue as I said above. Could you report this issue emacs development mailing list ?
Just because you cannot reproduce it, it doesn't mean it's not a bug of this package.
The problem is you've created a circular list here.
This issue persists, despite 359347b:
Debugger entered--Lisp error: (wrong-type-argument consp nil)
markdown-imenu-create-nested-index()
imenu--make-index-alist()
imenu-choose-buffer-index()
byte-code("\300 C\207" [imenu-choose-buffer-index] 1)
command-execute(imenu record)
execute-extended-command(nil "imenu" "imenu")
funcall-interactively(execute-extended-command nil "imenu" "imenu")
command-execute(execute-extended-command)
I'm using the latest commit (359347b) and can reproduce this in vanilla Emacs 28.0.50 (native-comp) with the Doom Emacs README.md open.
Used the same method to reproduce this as @syohex:
emacs -Q -l markdown-mode.el README.md
M-x imenu
(setq markdown-nested-imenu-heading-index nil)
is still an effective workaround.
EDIT: I am unable to reproduce this error in 27.2. EDIT 2: I am unable to reproduce this error in 28.0.50 (without native-comp).
Are you able to disassemble markdown-imenu-create-nested-index
? I suspect this function might need to be rewritten.
Sure. Curiously I can't reproduce this without native-comp, and the issue goes away if I re-evaluate its definition, so something is certainly lost at compile time. It may very well be an upstream issue.
the issue goes away if I re-evaluate its definition
Yes, I have the same problem.
Thanks for the disassembly. Let me ask emacs-devel how to compare the disassembled native code and byte code.
Ok I've just reproduced this again, this problem still persists, and can be seen by opening a markdown file that contains this:
# hello
hello
-----
world
=====
If you remove the last title (world) the problem goes away. @syohex can you reopen this?
I've just confirmed that this issue still occurs with an Emacs I built from the main branch just now (up to commit 72b5b4194106d38432cd9892bc01e95d71bf75db "Don't overwrite variables set by callback in help--window-setup" by Lars Ingebrigtsen larsi@gnus.org dated Fri May 13 19:31:46 2022 +0200), with native-compilation.
As was reported by others, re-evaluating the function in markdown-mode.el
fixes it for that session.
However, the more permanent work-around I've done here is as follows:
(setq native-comp-deferred-compilation-deny-list '("markdown-mode\\.el$"))
to your init.el
, before markdown-mode
is loaded / used. Do see comment https://github.com/jrblevin/markdown-mode/issues/578#issuecomment-1442806105 by @uqix : On newer Emacsen, the variable is native-comp-jit-compilation-deny-list
.markdown-mode*.eln
from the relevant directory in your .emacs.d/eln-cache/
.This prevents markdown-mode.el from being native-compiled, and hence defun markdown-imenu-create-nested-index
works as it should.
I've just confirmed that this issue still occurs with an Emacs I built from the main branch just now (up to commit 72b5b4194106d38432cd9892bc01e95d71bf75db "Don't overwrite variables set by callback in help--window-setup" by Lars Ingebrigtsen larsi@gnus.org dated Fri May 13 19:31:46 2022 +0200), with native-compilation.
As was reported by others, re-evaluating the function in
markdown-mode.el
fixes it for that session.However, the more permanent work-around I've done here is as follows:
- Add
(setq native-comp-deferred-compilation-deny-list '("markdown-mode\\.el$"))
to yourinit.el
, beforemarkdown-mode
is loaded / used.- Exit Emacs
- remove
markdown-mode*.eln
from the relevant directory in your.emacs.d/eln-cache/
.- Start Emacs
This prevents markdown-mode.el from being native-compiled, and hence
defun markdown-imenu-create-nested-index
works as it should.
for GNU Emacs 29.0.60 (build 1, x86_64-apple-darwin22.3.0, NS appkit-2299.40 Version 13.2.1 (Build 22D68)) of 2023-02-24, I need to change (setq native-comp-deferred-compilation-deny-list '("markdown-mode\\.el$"))
to (setq native-comp-jit-compilation-deny-list '("markdown-mode\\.el$"))
.
I can confirm this issue persists with GNU Emacs 29.0.90 (build 1, aarch64-apple-darwin22.4.0, NS appkit-2299.50 Version 13.3.1 (a) (Build 22E772610a)) of 2023-05-03 with nativecomp. Reproduces with the Markdown file from this comment above.
The culprit seems to be (setcdr sibling-alist alist)
, as removing this form makes markdown-imenu-create-nested-index
not crash.
I have opened https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63564
@wyuenho thank you! as per Mattias' comment on your bugreport, I tried to reproduce with newest markdown-mode commit 1535b95
and with that can no longer reproduce the issue. I can still reproduce with markdown-mode cdac22a7
, so it seems this was indeed fixed with yesterdays 44f0e8953
That is wonderful news, would still be nice to know why the nativecomp code and byte compiled code execute differently tho
Expected Behavior
Actual Behavior
imenu--make-index-alist: Wrong type argument: consp, nil
Steps to Reproduce
imenu
on a markdown-mode buffer with the following content:Backtrace
Software Versions