Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no match 4 in highlight (4 font-lock-variable-name-face) #59

Open
gernotk opened this issue Oct 18, 2022 · 7 comments
Open

no match 4 in highlight (4 font-lock-variable-name-face) #59

gernotk opened this issue Oct 18, 2022 · 7 comments

Comments

@gernotk
Copy link

gernotk commented Oct 18, 2022

It seems cperl-mode triggers this error whenever I hit C-s and swiper.el runs for the first time in a buffer. I am not sure this is actually caused by cperl or swiper.el but my backtrace looks like this:

  error("No match %d in highlight %S" 4 (4 font-lock-variable-name-face))
  font-lock-fontify-keywords-region(1545 95809 nil)
  font-lock-default-fontify-region(1545 95809 nil)
  cperl-font-lock-fontify-region-function(1545 95809 nil)
  font-lock-fontify-region(1545 95809)
  #f(compiled-function (fun) #<bytecode 0x19b684bedeca5dbd>)(font-lock-fontify-region)
  jit-lock--run-functions(1545 95809)
  jit-lock-fontify-now(1 95809)
  font-lock-ensure()
  swiper-font-lock-ensure()
  swiper--candidates()
  swiper()
  funcall-interactively(swiper)
  command-execute(swiper)

So the error is at least triggered downstream from "cperl-font-lock-fontify-region-function" which is why I am posting it here.

@gernotk
Copy link
Author

gernotk commented Oct 18, 2022

"GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-09-16"

Should I mention I am using native compilation? Sorry for being an ELISP noob.

@HaraldJoerg
Copy link
Contributor

Since you are using Emacs 28: May I ask you to try the version of cperl-mode.el which comes with Emacs? The Emacs maintainers have incorporated jrockway's code (but not from the mx-declare branch), and CPerl Mode's font-locking has been rewritten after that. There are chances that the behavior was fixed "by accident".

I'm asking because I can not reproduce the issue, with neither version of cperl-mode.el. If the error persists with the vanilla CPerl mode in your environment: Is there a Perl source you can share where this happens? Or can you provide a recipe how to reproduce when starting with emacs -Q?

@gernotk
Copy link
Author

gernotk commented Oct 20, 2022

Oh, I see, I am actually using the Vanilla CPerl mode. So maybe I should file a bug over there. But I'll still try to reproduce it with the least possible packages installed.

Earlier, I googled for this error message and I found a fix in a completely unrelated package:

ethereum/emacs-solidity#56

Perhaps it's a similar issue causing the problem?

@HaraldJoerg
Copy link
Contributor

Thanks for clarifying!

This is my fault. When I rewrote Perl font-locking (which is part of Emacs 28), I missed one place where I needed to change the match count. I have fixed this in Emacs git in Nov 2021, but failed to notice that the fix has not been applied to the Emacs 28 branch.

The fix is rather trivial: line 5949 of cperl-mode.el reads

      4 font-lock-variable-name-face)

This needs to be changed to:

      1 font-lock-variable-name-face)

...so if you don't want to wait for Emacs 28.3, you could patch if yourself.

Sorry for the inconveniences!

@gernotk
Copy link
Author

gernotk commented Oct 20, 2022

Cool, thanks so much for the update!

BTW: Been using CPerl for years already, so thanks for all the work you and others put into it!

@HaraldJoerg
Copy link
Contributor

The fix is now pushed to the Emacs release branch. So, with either Emacs 28.3 or 29.0 the problem will be officially solved.

Is it OK if we close the issue in this repository?

@gernotk
Copy link
Author

gernotk commented Oct 21, 2022

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants