Function: cider--dynamic-font-lock-symbols

cider--dynamic-font-lock-symbols is a byte-compiled function defined in cider-mode.el.

Signature

(cider--dynamic-font-lock-symbols SYMBOLS-PLIST CORE-PLIST)

Documentation

Categorize SYMBOLS-PLIST and CORE-PLIST for dynamic font-locking.

Return a plist mapping :macros, :functions, :vars, :deprecated,
:enlightened, :instrumented and :traced to lists of symbol names,
honoring cider-font-lock-dynamically. Both plists map a symbol name to its nREPL metadata dict, as returned by cider-resolve-ns-symbols.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-mode.el
(defun cider--dynamic-font-lock-symbols (symbols-plist core-plist)
  "Categorize SYMBOLS-PLIST and CORE-PLIST for dynamic font-locking.
Return a plist mapping :macros, :functions, :vars, :deprecated,
:enlightened, :instrumented and :traced to lists of symbol names,
honoring `cider-font-lock-dynamically'.  Both plists map a symbol name to
its nREPL metadata dict, as returned by `cider-resolve-ns-symbols'."
  (let ((cider-font-lock-dynamically (if (eq cider-font-lock-dynamically t)
                                         '(function var macro core deprecated)
                                       cider-font-lock-dynamically))
        deprecated enlightened
        macros functions vars instrumented traced)
    (cl-flet ((handle-plist
                 (plist)
                 ;; Note that (memq 'function cider-font-lock-dynamically) and similar statements are evaluated differently
                 ;; for `core' - they're always truthy for `core' (see related core-handling code some lines below):
                 (let ((do-function (memq 'function cider-font-lock-dynamically))
                       (do-var (memq 'var cider-font-lock-dynamically))
                       (do-macro (memq 'macro cider-font-lock-dynamically))
                       (do-deprecated (memq 'deprecated cider-font-lock-dynamically)))
                   (while plist
                     (let ((sym (pop plist))
                           (meta (pop plist)))
                       (pcase (nrepl-dict-get meta "cider/instrumented")
                         (`nil nil)
                         (`"\"breakpoint-if-interesting\""
                          (push sym instrumented))
                         (`"\"light-form\""
                          (push sym enlightened)))
                       ;; FIXME: This matches values too, not just keys.
                       (when (or (nrepl-dict-get meta "orchard.trace/traced")
                                 (nrepl-dict-get meta "orchard.profile/profiled"))
                         (push sym traced))
                       (when (and do-deprecated (nrepl-dict-get meta "deprecated"))
                         (push sym deprecated))
                       (let ((is-macro (nrepl-dict-get meta "macro"))
                             (is-function (nrepl-dict-get meta "fn")))
                         (cond ((and do-macro is-macro)
                                (push sym macros))
                               ((and do-function is-function)
                                (push sym functions))
                               ((and do-var (not is-function) (not is-macro))
                                (push sym vars)))))))))
      ;; For core members, we override `cider-font-lock-dynamically', since all core members should get the same treatment:
      (when (memq 'core cider-font-lock-dynamically)
        (let ((cider-font-lock-dynamically '(function var macro core deprecated)))
          (handle-plist core-plist)))
      (handle-plist symbols-plist))
    (list :macros macros :functions functions :vars vars
          :deprecated deprecated :enlightened enlightened
          :instrumented instrumented :traced traced)))