Function: eca-chat--fontify-region
eca-chat--fontify-region is a natively compiled function defined in
eca-chat.el.
Signature
(eca-chat--fontify-region BEG END &optional LOUDLY)
Documentation
Custom font-lock-fontify-region-function for chat buffers.
Walks BEG..END in eca-no-fontify property runs. For each
untagged sub-range delegates to font-lock-default-fontify-region
forwarding LOUDLY; tagged sub-ranges are skipped entirely, which
avoids running gfm/markdown matchers (the dominant CPU cost
reported in #234) over still-streaming tool-call argument bodies
that have not yet stabilized.
Cleanup is automatic: the toolCalled arm replaces the body with
fresh, un-tagged content, so on the next redisplay jit-lock asks
this function to refontify, the property is gone and the default
fontifier runs normally.
Returns (jit-lock-bounds BEG . END) so jit-lock's bookkeeping
matches the region we considered.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--fontify-region (beg end &optional loudly)
"Custom `font-lock-fontify-region-function' for chat buffers.
Walks BEG..END in `eca-no-fontify' property runs. For each
untagged sub-range delegates to `font-lock-default-fontify-region'
forwarding LOUDLY; tagged sub-ranges are skipped entirely, which
avoids running gfm/markdown matchers (the dominant CPU cost
reported in #234) over still-streaming tool-call argument bodies
that have not yet stabilized.
Cleanup is automatic: the `toolCalled' arm replaces the body with
fresh, un-tagged content, so on the next redisplay jit-lock asks
this function to refontify, the property is gone and the default
fontifier runs normally.
Returns `(jit-lock-bounds BEG . END)' so jit-lock's bookkeeping
matches the region we considered."
(let ((pos beg)
(fontify-end (eca-chat--fontification-history-end end)))
(while (< pos fontify-end)
(let ((skip (get-text-property pos 'eca-no-fontify))
(next (or (next-single-property-change
pos 'eca-no-fontify nil fontify-end)
fontify-end)))
(unless skip
(font-lock-default-fontify-region pos next loudly))
(setq pos next))))
`(jit-lock-bounds ,beg . ,end))