Add a direct link to a file whose contents include the given query
The denote-link command that we covered before prompts to select a file among those in the denote-directory (Adding a single direct link using a file name prompt). The match is done against the file’s name. Users may, however, be interested to create a link to a file whose contents include some text, regardless of how the file name is called. To this end, the command denote-link-to-file-with-contents, (i) prompts for a query which is a plain string or regular expression, (ii) if there are matching files, asks to select one among them, and (iii) inserts the direct link at point.
When called with an optional prefix argument (‘C-u’ by default), the command denote-link-to-file-with-contents creates a link that does not include a description for the target file: it just has the file’s identifier (same as with denote-link).
The command denote-link-to-file-with-contents is the counterpart of denote-link-to-all-files-with-contents (Insert links to all files matching a query in their contents).