Function: cider-refresh-dynamic-font-lock

cider-refresh-dynamic-font-lock is an interactive and byte-compiled function defined in cider-mode.el.

Signature

(cider-refresh-dynamic-font-lock &optional NS)

Documentation

Ensure that the current buffer has up-to-date font-lock rules.

NS defaults to cider-current-ns, and it can also be a dict describing the namespace itself.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-mode.el
(defun cider-refresh-dynamic-font-lock (&optional ns)
  "Ensure that the current buffer has up-to-date font-lock rules.
NS defaults to `cider-current-ns', and it can also be a dict describing the
namespace itself."
  (interactive)
  (when (and cider-font-lock-dynamically
             font-lock-mode)
    (if (cider-clojure-ts-mode-p)
        ;; clojure-ts-mode fontifies via tree-sitter, which ignores
        ;; `font-lock-keywords', so drive it through `treesit-font-lock'.
        (when-let* ((ns (or ns (cider-current-ns))))
          (cider--treesit-refresh-dynamic-font-lock
           (cider-resolve-ns-symbols ns)
           (cider-resolve-ns-symbols (cider-resolve-core-ns))))
      (font-lock-remove-keywords nil cider--dynamic-font-lock-keywords)
      (when-let* ((ns (or ns (cider-current-ns)))
                  (symbols (cider-resolve-ns-symbols ns)))
        (setq-local cider--dynamic-font-lock-keywords
                    (cider--compile-font-lock-keywords
                     symbols (cider-resolve-ns-symbols (cider-resolve-core-ns))))
        (font-lock-add-keywords nil cider--dynamic-font-lock-keywords 'end))
      (font-lock-flush))))