25.3 Emacs Denote

20220714

Denote is an elisp package to support note taking utilising a simple but well considered file naming scheme.

See https://protesilaos.com/emacs/denote

To install:

cd .emacs.d/elisp
git clone git@git.sr.ht:~protesilaos/denote

For your .emacs file:

(require 'denote)
(require 'denote-retrieve)
(require 'ol) ; 20220628 gjw Required since denote-link needs org-link-set-parameters
(require 'denote-link)
(require 'denote-dired)

Keyboard shortcuts include:

C-c n l    List the files in the notes folder.
C-c n n    Create a new note prompting for title and keywords.
C-c n r    Rename a file according to the same scheme.

There is plenty of scope for tuning.

The default folder for notes can be changed:

(setq denote-directory (expand-file-name "~/homecloud/notes/"))

You can specify some initial keywords, alhtough they are also determined from the current files.

(setq denote-known-keywords '("anu", "sii", "yarrabah"))

I like to be prompted for a sub-directory of the notes folder into which the note will be filed, then the date, title, and keywords.

(setq denote-prompts '(subdirectory date title keywords))

For dired mode to highlight the different components of the filenames:

(setq denote-dired-directories
      (cons denote-directory
        (nthcdr 2 (directory-files denote-directory t))))
(add-hook 'dired-mode-hook #'denote-dired-mode-in-directories)

Add a shortcut to list the contents of the notes directory:

(defun gjw:denote-dired-open ()
  "Short cut to open the notes folder in dired."
    (interactive)
    (dired denote-directory))

There are no default keybindings so let’s add some:

(let ((map global-map))
  (define-key map (kbd "C-c n n") #'denote)
  (define-key map (kbd "C-c n l") #'gjw:denote-dired-open)
  (define-key map (kbd "C-c n r") #'denote-dired-rename-file))


Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0