You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The native module writes inline `face' text-properties (:foreground /
:background per cell) via applyStyle in src/render.zig. If
`font-lock-mode' ends up active in a ghostel buffer, JIT-lock's fontify
pass calls `font-lock-unfontify-region' which strips all face props in
the region — output then renders in the buffer's default fg only.
`ghostel-mode' already runs `(font-lock-mode -1)' in its body, but that
executes before `after-change-major-mode-hook', and configurations that
force-enable font-lock later (Doom Emacs sets `font-lock-defaults = (nil
t)' globally, which makes `turn-on-font-lock-if-desired' activate it
even in modes that have no keywords) flip it back on. A subsequent
redraw or JIT-lock pass then wipes the face props.
Neutralise the unfontify pass with a buffer-local override. ghostel-mode
has no font-lock keywords to fontify, so skipping unfontify has no other
effect, and the face props the module writes survive even when font-lock
is re-enabled by user configuration.
Add regression test for face-prop preservation under font-lock
Writes a coloured SGR run into a ghostel-mode buffer, renders, then
force-enables `font-lock-mode' (with `font-lock-defaults' set the way
Doom Emacs sets it globally) and runs `font-lock-ensure'. The face
text-property applied by the native renderer must survive the
fontify pass — without the buffer-local `font-lock-unfontify-region-function'
override installed in `ghostel-mode', JIT-lock's unfontify strips it.
ghostel-compile-view-mode: preserve face props under font-lock
After ghostel-compile finalises, the buffer's major mode switches to
ghostel-compile-view-mode (derived from compilation-mode). The text
inherited from the ghostel run still carries the per-cell `face'
text-properties the native module wrote — but compilation-mode installs
font-lock keywords for error highlighting, and the default
`font-lock-unfontify-region-function' strips every `face' prop on the
first JIT-lock pass, wiping colour from the recorded output.
Neutralise unfontify in the view mode the same way ghostel-mode does.
The compilation keywords are applied once on a finalised, static buffer,
so there's nothing that needs refontifying.
Includes a regression test that finalises a buffer with a propertized
RED segment plus an error line, runs `font-lock-ensure', and checks both
that the ghostel face survived and that compilation error highlighting
still applied.
0 commit comments