Create a new note in any directory
The commands that create new files are designed to write to the denote-directory. The idea is that the linking mechanism can find any file by its identifier if it is in the denote-directory (searching the entire file system would be cumbersome).
However, these are cases where the user needs to create a new note in an arbitrary directory. The following command can do this. Put the code in your configuration file and evaluate it. Then call the command by its name with ‘M-x’.
emacs-lisp
(defun my-denote-create-note-in-any-directory ()
"Create new Denote note in any directory.
Prompt for the directory using minibuffer completion."
(declare (interactive-only t))
(interactive)
(let ((denote-directory (read-directory-name "New note in: " nil nil :must-match)))
(call-interactively 'denote)))