Open kostafey opened 1 month ago
Hi!
Are you sure reproducing this bug doesn't require some specific code to be present in the buffer?
Are you sure reproducing this bug doesn't require some specific code to be present in the buffer?
Yes, you're right. Now I see that it fails only for some code. Here is a minimal js that reproduces this case:
document.addEventListener('DOMContentLoaded', function() {
var id = null;
});
Thank you. Any chance you're using an older version of js2-mode, maybe?
I'm testing with Emacs 31.0.50 built from the current master and the latest js2-mode, and I'm not seeing any error with these buffer contents.
Any chance you're using an older version of js2-mode, maybe?
No, it is an actual MELPA version: js2-mode-20240418.6
. But I figured out that the issue can't be reproduced if js2-mode
loaded from .el
or .elc
files. Only loading from native compiled version (.eln
) leads to this issue.
So, the actual workaround for me is:
(setq native-comp-jit-compilation-deny-list '("js2-mode"))
UPD: Not fully relevant to js2-mode
, but rjsx-mode
has a similar problem and a similar solution in the current version of Emacs. Although rjsx-mode
may be enabled in the buffer, it highlights all tags in red (as a syntax error). When loading from el/elc files, the problem goes away:
(setq native-comp-jit-compilation-deny-list
'("js2-mode" "rjsx-mode"))
All right, that makes sense. I also remember a couple of bugs in the similar vein that only happen with native compilation. Problem is, each has to be reported and fixed separately.
And like the last time, it doesn't reproduce on my machine if I just reconfigure --with-native-compilation
and rebuild. Maybe it's dependent on some special configuration, or the system details, or etc.
So if you could do a M-x report-emacs-bug
with the reproducer and the note that this happens with native-compilation only, that would help a lot. I can do it for you, but I won't be able to answer follow-up questions.
You can try deleting the existing native-compilation cache, BTW.
IIRC this helped in some instance of this problem in the past.
GNU Emacs 31.0.50
(build frommaster
, commit:d50c82f3e98e5418e5a42b48162bc26028309b89
)Steps to reproduce:
M-x js2-mode
Message:
Error running timer ‘js2-mode-idle-reparse’: (args-out-of-range #s(js2-keyword-node 44 253 5 nil nil) 6)
Full trace with
M-x toggle-debug-on-error
: