diff options
author | Matthew Lemon <y@yulqen.org> | 2024-05-29 09:24:24 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-05-29 09:24:24 +0100 |
commit | 065c0eca62ebd40dac7ed26b1ae7e30a02a939b1 (patch) | |
tree | 96cfc3598761e655187b0255d1c21d4241b4cf5d | |
parent | 8aa0761bbf050c11077febb01eb8b413a5c49031 (diff) |
Adds new functions from denote docs to choose silo
3.7.1 in the docs https://protesilaos.com/emacs/denote as of today.
This allows you to call my-denote-pick-silo-then-command to create a
new file in a chosen silo. Great for working with home and work notes.
-rw-r--r-- | init.el | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -403,6 +403,37 @@ Restart works only on graphic display." (when (and day-match? year-match? month-match?) f))) + (defvar my-denote-silo-directories + `("/home/lemon/Documents/mod-denote" + ;; 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-directory silo)) + (call-interactively command))) + (defun mrl/denote-journal () "Create an entry tagged 'journal' with the date as its title." (defvar mrl/in-mod-denote nil) @@ -415,8 +446,8 @@ Restart works only on graphic display." (find-file (concat journal-dir "/" today-journal)) (if mrl/in-mod-denote ; this variable is from the .dir-locals.el file in the silo directory; we want to use a specific template (denote - (format-time-string "%A %e %B %Y") - '("journal") nil journal-dir nil 'modjournal) + (format-time-string "%A %e %B %Y") + '("journal") nil journal-dir nil 'modjournal) (denote (format-time-string "%A %e %B %Y") '("journal") nil journal-dir))))) |