Function: eca-chat--context-bar-help
eca-chat--context-bar-help is a natively compiled function defined in
eca-chat.el.
Signature
(eca-chat--context-bar-help BREAKDOWN USED FREE LIMIT &optional COMPACT-PCT)
Documentation
Build the help-echo legend for the context bar from BREAKDOWN.
USED, FREE and LIMIT are the aggregate token counts. Each line is prefixed with a colored swatch matching the bar so the colors map to their category. COMPACT-PCT, when set, notes the auto-compaction threshold percentage.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--context-bar-help (breakdown used free limit &optional compact-pct)
"Build the help-echo legend for the context bar from BREAKDOWN.
USED, FREE and LIMIT are the aggregate token counts. Each line is
prefixed with a colored swatch matching the bar so the colors map to
their category. COMPACT-PCT, when set, notes the auto-compaction
threshold percentage."
(let* ((nf #'eca-chat--number->friendly-number)
;; Prefer the server-provided emoji swatch (consistent with the
;; /context text); fall back to a colored block for older servers.
(swatch (lambda (emoji spec)
(or emoji (propertize "█" 'face spec))))
(head (if (and limit (> limit 0))
(format "Context: %s / %s (%d%%)"
(funcall nf used) (funcall nf limit)
(round (* 100 (/ (float used) limit))))
(format "Context: %s used" (funcall nf used))))
(rows (mapconcat
(lambda (cat)
(format " %s %s: %s"
(funcall swatch (plist-get cat :emoji)
(eca-chat--context-category-face-spec cat))
(plist-get cat :name)
(funcall nf (or (plist-get cat :tokens) 0))))
(append (plist-get breakdown :categories) nil)
"\n")))
(concat head "\n" rows
(when (and free (> free 0))
(format "\n %s Free space: %s"
(funcall swatch (plist-get breakdown :freeEmoji)
(eca-chat--context-free-face-spec breakdown))
(funcall nf free)))
(when (and compact-pct (numberp compact-pct) (> compact-pct 0))
(format "\nAuto-compaction at %s%%"
(if (= compact-pct (round compact-pct))
(number-to-string (round compact-pct))
(format "%.1f" compact-pct))))
"\n\nClick to run /context")))