Function: eca-chat--linkify-image-mentions

eca-chat--linkify-image-mentions is a natively compiled function defined in eca-chat-image.el.

Signature

(eca-chat--linkify-image-mentions START END ROOTS)

Documentation

Make the image mentions between START and END toggle a thumbnail.

Mentions are the @path tokens of sent messages, resolved against ROOTS by eca-chat--mention-image-path. Their keymap is dropped so RET on them reaches eca-chat--key-pressed-return, and they show their thumbnail per 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-image.el
(defun eca-chat--linkify-image-mentions (start end roots)
  "Make the image mentions between START and END toggle a thumbnail.
Mentions are the @path tokens of sent messages, resolved against
ROOTS by `eca-chat--mention-image-path'.  Their `keymap' is dropped
so RET on them reaches `eca-chat--key-pressed-return', and they
show their thumbnail per `eca-chat-image-show-thumbnails'."
  (with-silent-modifications
    (save-excursion
      (goto-char start)
      (while (re-search-forward "\\(?:^\\|[^[:alnum:]]\\)@\\([^[:space:]]+\\)"
                                end t)
        (let* ((mention-start (1- (match-beginning 1)))
               ;; Punctuation right after a mention is not part of it.
               (token (replace-regexp-in-string
                       "[]),.;:!?'\"]+\\'" "" (match-string-no-properties 1)))
               (mention-end (+ mention-start 1 (length token))))
          (when-let* ((path (eca-chat--mention-image-path token roots)))
            (remove-text-properties mention-start mention-end '(keymap nil))
            (add-text-properties mention-start mention-end
                                 (list 'eca-chat-image-path path
                                       'help-echo "RET: toggle the thumbnail"))
            (eca-chat--auto-show-image-thumbnails mention-start mention-end)))))))