Skip to content

Use the consult-notes package

[ Also check the consult-denote package by me (Protesilaos): Use the consult-denote package for enhanced minibuffer interactions. ]

If you are using Daniel Mendler’s consult (which is a brilliant package), you will most probably like its consult-notes extension, developed by Colin McLear. It uses the familiar mechanisms of Consult to preview the currently selected entry and to filter searches via a prefix key. For example:

emacs-lisp
(setq consult-notes-file-dir-sources
      `(("Denote Notes"  ?d ,(denote-directory))
        ("Books"  ?b "~/Documents/books/")))

With the above, ‘M-x consult-notes’ will list the files in those two directories. If you type ‘d’ and space, it narrows the list to just the notes, while ‘b’ does the same for books.

The other approach is to enable the consult-notes-denote-mode. It takes care to add the denote-directory to the sources that consult-notes reads from. Denote notes are then filtered by the ‘d’ prefix followed by a space.

The minor mode has the extra feature of reformatting the title of notes shown in the minibuffer. It isolates the ‘TITLE’ component of each note and shows it without hyphens, while presenting keywords in their own column. The user option consult-notes-denote-display-id can be set to nil to hide the identifier. Depending on how one searches through their notes, this refashioned presentation may be the best option (Features of the file-naming scheme for searching or filtering).