Function: eca-chat--render-image-content
eca-chat--render-image-content is a natively compiled function defined
in eca-chat-image.el.
Signature
(eca-chat--render-image-content IMAGE-CONTENT PARENT-TOOL-CALL-ID)
Documentation
Render IMAGE-CONTENT into the current chat buffer.
On a graphical frame with a supported media type the image is
inserted via an overlay so that font-lock-ensure (which manages
the display text-property in markdown-mode/gfm-mode) cannot
strip it. Otherwise a textual placeholder is shown.
When PARENT-TOOL-CALL-ID is non-nil the content is appended into that expandable tool-call block; expandable content stores its body as a plain string, so overlays would not survive — for that path we always use the textual fallback.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-image.el
;;;; Render entry point (called by eca-chat--render-content)
(defun eca-chat--render-image-content (image-content parent-tool-call-id)
"Render IMAGE-CONTENT into the current chat buffer.
On a graphical frame with a supported media type the image is
inserted via an overlay so that `font-lock-ensure' (which manages
the `display' text-property in `markdown-mode'/`gfm-mode') cannot
strip it. Otherwise a textual placeholder is shown.
When PARENT-TOOL-CALL-ID is non-nil the content is appended into
that expandable tool-call block; expandable content stores its body
as a plain string, so overlays would not survive — for that path we
always use the textual fallback."
(let ((image (and (not parent-tool-call-id)
(eca-chat--build-inline-image image-content))))
(cond
(image
(save-excursion
(goto-char (eca-chat--content-insertion-point))
(let ((start (point)))
(eca-chat--insert "\n \n")
(let ((ov (make-overlay (1+ start) (+ 2 start) (current-buffer))))
(overlay-put ov 'display image)
(overlay-put ov 'eca-chat-image t)
(overlay-put ov 'eca-chat-image-media-type
(plist-get image-content :mediaType))
(overlay-put ov 'mouse-face 'highlight)
(overlay-put
ov 'help-echo
(format "Image (%s, %d bytes) — RET or mouse-2 to save"
(or (plist-get image-content :mediaType) "?")
(length (image-property image :data))))
(let* ((save-fn (lambda ()
(interactive)
(eca-chat-save-image-at-point ov)))
(map (make-sparse-keymap)))
(define-key map (kbd "RET") save-fn)
(define-key map [mouse-2] save-fn)
(overlay-put ov 'keymap map))))))
(parent-tool-call-id
(eca-chat--update-expandable-content
parent-tool-call-id nil
(eca-chat--image-fallback-string image-content) t))
(t
(eca-chat--add-text-content
(eca-chat--image-fallback-string image-content))))))