Function: gptel--annotate-link
gptel--annotate-link is a byte-compiled function defined in gptel.el.
Signature
(gptel--annotate-link OV LINK-STATUS)
Documentation
Annotate link overlay OV according to LINK-STATUS.
LINK-STATUS is a list of link properties relevant to gptel queries, of
the form (valid . REST). See gptel-markdown--validate-link for
details. Indicate the (in)validity of the link for inclusion with gptel
queries via OV.
Source Code
;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel.el
(defsubst gptel--annotate-link (ov link-status)
"Annotate link overlay OV according to LINK-STATUS.
LINK-STATUS is a list of link properties relevant to gptel queries, of
the form (valid . REST). See `gptel-markdown--validate-link' for
details. Indicate the (in)validity of the link for inclusion with gptel
queries via OV."
(cl-destructuring-bind
(valid _ path resource-type user-check readablep mime-valid _mime)
link-status
(if valid
(progn
(overlay-put
ov 'before-string
(concat (propertize "SEND" 'face '(:inherit success :height 0.8))
(if (display-graphic-p)
(propertize " " 'display '(space :width 0.5)) " ")))
(overlay-put ov 'help-echo
(format "Sending %s %s with gptel requests" resource-type path)))
(overlay-put ov 'before-string
(concat (propertize "!" 'face '(:inherit error))
(propertize " " 'display '(space :width 0.3))))
(overlay-put
ov 'help-echo
(concat
"Sending only link text with gptel requests, "
"this link will not be followed to its source.\n\nReason: "
(cond
((not resource-type) "Not a supported link type\
(Only \"file\" and \"attachment\" are supported)")
((not user-check)
(concat
"\nNot a standalone link -- separate link from text around it. \n (OR)
Link failed to validate, see `gptel-markdown-validate-link' or `gptel-org-validate-link'."))
((not readablep) (format "File %s is not readable" path))
((not mime-valid)
(pcase resource-type
('file (format "%s does not support binary file %s" gptel-model path))
('url (format "%s does not support fetching non-image URLs" gptel-model))))))))))