Closed seagle0128 closed 5 years ago
Well that's really weird. Try doing C-h f font-lock-fontify-keywords-region RET
, should bring up help for the function. The second paragraph should look something like this:
(font-lock-fontify-keywords-region START END &optional LOUDLY)
The function calls highlight-indent-guides--character-highlighter
, which reads from that START
parameter (which is possible because elisp is dynamically scoped). Your error is saying that START
doesn't exist, but font-lock-fontify-keywords-region
is in the stacktrace, so as long as it still has that parameter everything should be fine. If you check the help and see whether the parameter is gone or perhaps called something different, that'll tell you for sure. I seriously doubt that's the case though, since I'm running 26.1 in Linux and it's fine.
I doubt you're doing anything weird that changes the scoping rules, because that should only have per-file effects. I also don't think it's related to advice, because that would show up in the stacktrace. I really don't know what's going on.
You say this only happens when you use swiper? I don't see how that would be related, but I suppose it must be. I guess I'll have to look more into it.
Vincent Zhang writes:
While using
swiper
on GNU Emacs 26.1 with macOS, I got this error:
I also use swiper with 26.1 and highlight-indent-guides and I don't see this issue.
Maybe (somehow) lexical scope was forced on when this package was byte compiled? Can you reproduce this with a minimal config?
@jgkamat This issue doesn't occur always actually. I didn't encounter it on my macOS, while on Linux Mint in VM. Exact same configurations (https://github.com/seagle0128/.emacs.d). Don't know why...
I have the same problem since I updated my Emacs from master. I think this commit could be the problem: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=70926a3e8671034fd5cb1a546f9c107feda729a3
PS: highlight-indent-guides is not working for me at all, so I don't think it has anything to do with swiper. Invoking swiper shows the error message though, maybe I wouldn't even have realised otherwise.
@dakra Oh wow, you're probably right about that commit. Setting font-lock.el
to use lexical scope would definitely cause this issue. I guess I don't notice because I haven't updated my emacs in a couple months.
Assuming this is the issue, I'll need to find some alternate way to access the value in START
. I have a few ideas, but I'll need to try things out and see what's actually viable ...
Yes, it should be the root cause. I just realize it just happens with 27, while not 26. I updated the description above.
I also notice this issue on emacs 27.0.50 on archlinux
@seagle0128 @jgkamat @dakra @CSRaghunandan I pushed a fix. Please give it a try, as I can't properly test it right now; I'm reasonably certain it works equivalently in Emacs 26, but due to external factors I can't try it in 27 at the moment.
I switched it to using (match-beginning 0)
, which as far as I can tell will always have the same value as START
when this function is called, and it is also globally accessible. (point)
should also be equivalent, and usually is, but I found some situations where that approach would break, and I don't really know the reason for that at the moment.
If this doesn't work, I can add a global variable to contain this state, which the matcher function sets and the highlighter function reads from. That feels like a hacky solution, but it's technically equivalent to the current solution, except with a custom variable instead of the global match state. It may also be more future-proof.
I just tested it briefly and it seems to work. Thanks.
It works for me as well. Thanks!
Awesome, then I'm closing this. If the fix turns out not to work for someone, feel free to reopen.
While using
swiper
on GNU Emacs 27.0.50 with Ubuntu, I got this error: