Skip to content

Use denote-grep to search inside files

The command denote-grep searches for the given query across all readable files in the denote-directory. It puts the collected results in an Xref buffer (just like with our backlinks and query links functionality). In this buffer, users can do ‘M-x describe-mode’ (‘C-h m’ with default key bindings) to learn about all the actions they can perform and the keys they are bound to (Interact with the links buffer).

Think of denote-grep as the counterpart to the Unix grep command. While denote-sort-dired corresponds to the Unix find (Display filtered and sorted files with denote-sort-dired).

The command denote-grep-marked-dired-files is like denote-grep but operates on the files that are marked in a Dired buffer.

The command denote-grep-files-referenced-in-region is like denote-grep for any files referenced within the boundaries of the marked region. Files are referenced by their identifier. This includes links with just the identifier (as described in denote-link and related (Add a single direct link using a file name prompt)), links written by an Org dynamic block (see the denote-org package (Use Org dynamic blocks)), or even file listings such as those of dired and the command-line ls program.

The user option denote-grep-display-buffer-action controls where the buffer with the search results is displayed at. By default, they appear in the same window where the command denote-grep is called from.