Denote silo function
I have been reading some thing information about denote, and its powerful tools
that the good prots
give to us the mortals. I am starting this "post" thing, and
is good to have my notes apart from the posts that I'm going to write in the
future, so reading I find a interesting function that prots suggest to use
in the creation of notes.
Use custom commands to select a silo.
As you can read in the tittle, prots
creates this singular elsip function, that prompts
for a entry point directory and then a denote function.
The Silo funcitons:
First part of the function:
Define a list of directories. This is very convenient, because whit this I can separate my notes directory of my posts directory:
(defvar my-denote-silo-directories `("/home/prot/Videos/recordings" "/home/prot/Documents/books" ;; You don't actually need to include the `denote-directory' here ;; if you use the regular commands in their global context. I am ;; including it for completeness. ,denote-directory) "List of file paths pointing to my Denote silos. This is a list of strings.")
Then define a list of the denote commands that usually I use:
(defvar my-denote-commands-for-silos '(denote denote-date denote-subdirectory denote-template denote-type) "List of Denote commands to call after selecting a silo. This is a list of symbols that specify the note-creating interactive functions that Denote provides.")
The Silo Command in action:
(defun my-denote-pick-silo-then-command (silo command) "Select SILO and run Denote COMMAND in it. SILO is a file path from `my-denote-silo-directories', while COMMAND is one among `my-denote-commands-for-silos'." (interactive (list (completing-read "Select a silo: " my-denote-silo-directories nil t) (intern (completing-read "Run command in silo: " my-denote-commands-for-silos nil t)))) (let ((denote-user-enforced-denote-directory silo)) (call-interactively command)))
The complete functions:
(defvar my-denote-silo-directories `("/home/prot/Videos/recordings" "/home/prot/Documents/books" ;; You don't actually need to include the `denote-directory' here ;; if you use the regular commands in their global context. I am ;; including it for completeness. ,denote-directory) "List of file paths pointing to my Denote silos. This is a list of strings.") (defvar my-denote-commands-for-silos '(denote denote-date denote-subdirectory denote-template denote-type) "List of Denote commands to call after selecting a silo. This is a list of symbols that specify the note-creating interactive functions that Denote provides.") (defun my-denote-pick-silo-then-command (silo command) "Select SILO and run Denote COMMAND in it. SILO is a file path from `my-denote-silo-directories', while COMMAND is one among `my-denote-commands-for-silos'." (interactive (list (completing-read "Select a silo: " my-denote-silo-directories nil t) (intern (completing-read "Run command in silo: " my-denote-commands-for-silos nil t)))) (let ((denote-user-enforced-denote-directory silo)) (call-interactively command)))
Now whit these couple of functions we can have a better way to take our notes, posts, and other denote related things.
So, for now it's all, I was able to write this post within emacs and this silo function
that protesilaos
provide to us, so, Thank you prot
.
Reference:
- Protesilaos web page
- 3.5.1. Use custom commands to select a silo