minad / consult

:mag: consult.el - Consulting completing-read
GNU General Public License v3.0
1.12k stars 98 forks source link

Sometimes `consult-line` throws a "Regular expression too big" error #932

Closed lassemaatta closed 3 months ago

lassemaatta commented 3 months ago

Every once in a while I get the following error when running consult-line. Sometimes re-running the same command twice (or thrice) in the same buffer works fine.

Debugger entered--Lisp error: (invalid-regexp "Regular expression too big")
  font-lock-fontify-keywords-region(4496 302636 nil)
  font-lock-default-fontify-region(6001 302636 nil)
  apply(font-lock-default-fontify-region 6001 302636 nil)
  #f(compiled-function (beg end &rest rest) #<bytecode 0xddfe72b7fb7cf22>)(6001 302636 nil)
  font-lock-fontify-region(6001 302636)
  #f(compiled-function (fun) #<bytecode 0x1f9e18c01ed206f4>)(font-lock-fontify-region)
  jit-lock--run-functions(6001 302636)
  jit-lock-fontify-now()
  consult--fontify-all()
  consult--line-candidates(nil 1)
  #f(compiled-function () #<bytecode -0x12c7235f1183fb7c>)()
  consult-line(nil nil)
  funcall-interactively(consult-line nil nil)
  command-execute(consult-line)

Elpaca reports my consult version as 1.2 42aaed5 and I'm running emacs 30 built from master.

Is this something that consult-fontify-max-size attempts to workaround? I have not customized that so it's 1048576.

Let me know if there's any additional information I can provide.

minad commented 3 months ago

This sounds like a fontification bug in some other package. See https://github.com/minad/consult?tab=readme-ov-file#bug-reports for bug reports. If this happens often for certain buffers/modes, I suggest you disable fontification buffer-locally by setting consult-fontify-max-size to 0 only in the affected buffers.