Function: eca-chat--refresh-context

eca-chat--refresh-context is a natively compiled function defined in eca-chat-context.el.

Signature

(eca-chat--refresh-context)

Documentation

Refresh chat context.

Redrawn chips keep their thumbnail, or its absence when hidden with RET, while new ones follow eca-chat-image-show-thumbnails.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-context.el
(defun eca-chat--refresh-context ()
  "Refresh chat context.
Redrawn chips keep their thumbnail, or its absence when hidden with
RET, while new ones follow `eca-chat-image-show-thumbnails'."
  (save-excursion
    (-some-> (eca-chat--prompt-context-field-ov)
      (overlay-start)
      (goto-char))
    (let ((chips (eca-chat--context-chips (point) (line-end-position))))
      (delete-region (point) (line-end-position))
      (seq-doseq (context eca-chat--context)
        (let ((start (point))
              (chip (assoc context chips)))
          (let ((eca-chat--inhibit-auto-thumbnails t))
            (eca-chat--insert (eca-chat--context->str context)))
          (cond
           ((cdr chip) (eca-chat--show-image-thumbnail start (point) (cdr chip)))
           ((not chip) (eca-chat--auto-show-image-thumbnails start (point)))))
        (eca-chat--insert " ")))
    (eca-chat--insert (propertize eca-chat-context-prefix 'font-lock-face 'eca-chat-context-unlinked-face))))