Function: eca-chat--add-image-link-overlay

eca-chat--add-image-link-overlay is a natively compiled function defined in eca-chat-image.el.

Signature

(eca-chat--add-image-link-overlay START END)

Documentation

Make RET and a middle click toggle the thumbnail of a mention.

The mention goes from START to END and carries eca-chat-image-path. For buffers whose RET doesn't handle image mentions, like the compose one; the overlay goes away with the mention text.

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--add-image-link-overlay (start end)
  "Make RET and a middle click toggle the thumbnail of a mention.
The mention goes from START to END and carries `eca-chat-image-path'.
For buffers whose RET doesn't handle image mentions, like the
compose one; the overlay goes away with the mention text."
  (let* ((ov (make-overlay start end nil t nil))
         (toggle (lambda ()
                   (interactive)
                   (when-let* ((buffer (overlay-buffer ov)))
                     (with-current-buffer buffer
                       (when-let* ((link (eca-chat--image-link-at
                                          (overlay-start ov))))
                         (eca-chat--toggle-image-thumbnail link)))))))
    (overlay-put ov 'keymap (eca-chat--image-keymap toggle))
    (overlay-put ov 'mouse-face 'highlight)
    (overlay-put ov 'help-echo "RET or mouse-2: toggle the thumbnail")
    (overlay-put ov 'evaporate t)
    ov))