clojure-emacs / clojure-emacs/cider

when enabling cider-font-lock-dynamically, regexp highlights are not displayed

Open
#3,787 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Emacs Lisp
Stars
3.7k
Forks
651
Avg merge
11h 6m
Merged PRs (30d)
33

Description

## Expected behavior

Using `highlight-regexp` to highlight a regexp, or highlighting with the [highlight-symbol](https://github.com/nschum) package, I expect the requested symbol to be highlighted with background colour.

## Actual behaviour

Sometimes the highlights are not displayed.

With `highlight-symbol`, the failure is accompanied by this error in `*Messages*`:

Error during redisplay: (jit-lock-function 6057) signaled (invalid-regexp "Regular expression too big")

## Steps to reproduce the problem

1. `(setq cider-font-lock-dynamically t)`
2. Load a Clojure or ClojureScript file.
3. Use `highlight-regexp` (M-s h r) to try to highlight a regexp
4. Nno highlight is displayed

Unfortunately I haven't worked out how to reliably trigger, it just happens on some files. `(setq cider-font-lock-dynamically nil)` and reloading fixes, and it doesn't happen if the file is not require'd by anything. It seems to happen more often with CLJS.

## Environment & Version information

clojure-mode (version 5.19.0)

### CIDER version information

```
;; CIDER 1.16.1 (Kherson), nREPL 1.0.0
;; Clojure 1.11.1, Java 14.0.2
```

### Lein / Clojure CLI version

Leiningen 2.9.5

### Emacs version

GNU Emacs 29.1 (build 1, aarch64-apple-darwin24.1.0, Carbon Version 170 AppKit 2575.2) of 2024-11-28

### Operating system

macOS 15.3.2

### JDK distribution

OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.2+12)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with cider-font-lock-dynamically enabled, a required Clojure or ClojureScript file, and highlight-regexp or highlight-symbol. Trace the dynamic font-lock and jit-lock-function path mentioned in the error. Done means regexp highlights display reliably while dynamic font locking is enabled without the “Regular expression too big” redisplay error.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs-lisp
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.