Function: eca-chat--mention-image-path

eca-chat--mention-image-path is a natively compiled function defined in eca-chat-image.el.

Signature

(eca-chat--mention-image-path TOKEN ROOTS)

Documentation

Return the local path of the image mentioned by TOKEN, or nil.

TOKEN is a mention path as sent to the server: absolute, maybe a remote one, or relative to one of ROOTS. Local paths must exist; remote ones are not checked, which would be slow.

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--mention-image-path (token roots)
  "Return the local path of the image mentioned by TOKEN, or nil.
TOKEN is a mention path as sent to the server: absolute, maybe a
remote one, or relative to one of ROOTS.  Local paths must exist;
remote ones are not checked, which would be slow."
  (when (eca-chat--image-file-p token)
    (let ((local (eca--path-remote-to-local token)))
      (cond
       ((file-remote-p local) local)
       ((file-name-absolute-p local)
        (let ((path (expand-file-name local)))
          (and (file-exists-p path) path)))
       (t (seq-some (lambda (root)
                      (let ((path (expand-file-name local root)))
                        (and (not (file-remote-p path))
                             (file-exists-p path)
                             path)))
                    roots))))))