Skip to content

Colorize gensyms in inline macro expansions - #3977

Merged
bbatsov merged 1 commit into
masterfrom
feat-macrostep-gensym-colors
Jun 19, 2026
Merged

Colorize gensyms in inline macro expansions#3977
bbatsov merged 1 commit into
masterfrom
feat-macrostep-gensym-colors

Conversation

@bbatsov

@bbatsov bbatsov commented Jun 19, 2026

Copy link
Copy Markdown
Member

Phase 3 of the inline macrostep work (#1850): color the gensyms a macro introduces so you can track them through the expansion.

Each distinct gensym (x__42__auto__, G__17) gets its own color from cider-macrostep-gensym-colors, shared across all its occurrences - so a single binding the macro introduced is easy to follow from its let/fn site to every use. Toggle with cider-macrostep-color-gensyms (on by default). Only the unambiguous gensym shapes are colored (auto-gensyms and (gensym) output); (gensym "prefix") results are indistinguishable from ordinary symbols and left alone.

While here, fixed a latent double-overlay bug the reviewer caught: nested expansions overlap (the outer overlay still spans the inner text), so each token was being scanned once per containing overlay and accumulating duplicate highlight overlays on every refresh. Both the gensym and the expandable-head (#3976) paths now dedupe by position.

Still on the macrostep Phase 3 list and deliberately not here: actually expanding inline functions (the classify op tags them, but that needs new backend support).

Each distinct gensym (`x__42__auto__', `G__17') in an expansion gets its
own color from `cider-macrostep-gensym-colors', shared across all its
occurrences, so a binding the macro introduced can be tracked through the
result.  Toggle with `cider-macrostep-color-gensyms'.

Also dedupe the highlight overlays in both the gensym and expandable-head
refresh paths: nested expansions overlap (the outer overlay still spans the
inner text), so each token was scanned once per containing overlay and got
a duplicate overlay every refresh.
@bbatsov
bbatsov merged commit ea364af into master Jun 19, 2026
13 checks passed
@bbatsov
bbatsov deleted the feat-macrostep-gensym-colors branch June 19, 2026 15:08
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

Successfully merging this pull request may close these issues.

1 participant