Function: eca-chat--toggle-image-thumbnail

eca-chat--toggle-image-thumbnail is a natively compiled function defined in eca-chat-image.el.

Signature

(eca-chat--toggle-image-thumbnail LINK)

Documentation

Toggle the thumbnail of LINK, a (START END PATH) image mention.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-image.el
(defun eca-chat--toggle-image-thumbnail (link)
  "Toggle the thumbnail of LINK, a (START END PATH) image mention."
  (pcase-let ((`(,start ,end ,path) link))
    (if-let* ((ov (eca-chat--image-thumbnail-at start end)))
        (delete-overlay ov)
      (let (image)
        (cond
         ((not (display-images-p))
          (eca-warn "Images can't be displayed in this frame"))
         ((not (file-readable-p path))
          (eca-warn "Image not found: %s" path))
         ((not (setq image (eca-chat--image-thumbnail path)))
          (eca-warn "Can't display image: %s" path))
         (t (eca-chat--show-image-thumbnail start end image)))))))