Function: denote-link-to-file-with-contents
denote-link-to-file-with-contents is an autoloaded, interactive and
byte-compiled function defined in denote.el.
Signature
(denote-link-to-file-with-contents QUERY &optional ID-ONLY)
Documentation
Link to a file whose contents match QUERY.
This is similar to denote-link, except that the file prompt is limited
to files matching QUERY. Optional ID-ONLY has the same meaning as in
denote-link.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
;;;;; Link to file with matching contents
;;;###autoload
(defun denote-link-to-file-with-contents (query &optional id-only)
"Link to a file whose contents match QUERY.
This is similar to `denote-link', except that the file prompt is limited
to files matching QUERY. Optional ID-ONLY has the same meaning as in
`denote-link'."
(interactive
(list (denote-query-link-prompt nil "Files whose contents include QUERY")))
(if-let* ((files (denote-retrieve-files-xref-query query))
;; NOTE 2025-03-29: Maybe we should have a named prompt
;; for this case, but I think we do not need it right now.
(file (completing-read
(format "Select FILE with contents `%s': "
(propertize query 'face 'denote-faces-prompt-current-name))
(denote-get-completion-table files '(category . file))
nil t nil 'denote-file-history)))
(denote-link file
(denote-filetype-heuristics buffer-file-name)
(denote-get-link-description file)
id-only)
(user-error "No files include the query `%s' in their contents" query)))