branch: externals/denote-silo commit 2ed2b11b37b51ce734d368e37f8b7558af4253a9 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Define denote-silo-dired and denote-silo-cd commands --- README.org | 22 +++++++++++++++++++++- denote-silo.el | 22 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index f1af85bd47..f26a19e81f 100644 --- a/README.org +++ b/README.org @@ -102,6 +102,24 @@ Once the user selects a silo, a second prompt asks for a Denote note-creation command to call from inside that silo (read about the "Points of entry" in the Denote manual). +** Switch to a silo directory +:PROPERTIES: +:CUSTOM_ID: h:switch-to-a-silo-directory +:END: + +#+findex: denote-silo-dired +The command ~denote-silo-dired~ prompts for a silo directory among +those specified in the user option ~denote-silo-directories~ and +switches to it using ~dired~. + +#+findex: denote-silo-cd +The command ~denote-silo-cd~ is the same as above, except it used the +~cd~ to perform the switch. This is more subtle because the current +buffer does not change, even though the "current directory" is +different. Such an action is useful to, for example, affect what a +shell or search command will consider as the current directory, +without necessarily changing context completely. + * Installation :PROPERTIES: :CUSTOM_ID: h:installation @@ -167,7 +185,9 @@ Everything is in place to set up the package. ;; Bind these commands to key bindings of your choice. :commands ( denote-silo-create-note denote-silo-open-or-create - denote-silo-select-silo-then-command )) + denote-silo-select-silo-then-command + denote-silo-dired + denote-silo-cd )) #+end_src * Acknowledgements diff --git a/denote-silo.el b/denote-silo.el index e6752bdcc5..dc507427d2 100644 --- a/denote-silo.el +++ b/denote-silo.el @@ -123,5 +123,27 @@ conforms with `denote-silo-path-is-silo-p'." (let ((denote-directory silo)) (call-interactively command)))) +;;;###autoload +(defun denote-silo-dired (silo) + "Switch to SILO directory using `dired'. +SILO is a file path from `denote-silo-directories'. + +When called from Lisp, SILO is a file system path to a directory that +conforms with `denote-silo-path-is-silo-p'." + (interactive (list (denote-silo-directory-prompt))) + (denote-silo-with-silo silo + (dired silo))) + +;;;###autoload +(defun denote-silo-cd (silo) + "Switch to SILO directory using `cd'. +SILO is a file path from `denote-silo-directories'. + +When called from Lisp, SILO is a file system path to a directory that +conforms with `denote-silo-path-is-silo-p'." + (interactive (list (denote-silo-directory-prompt))) + (denote-silo-with-silo silo + (cd silo))) + (provide 'denote-silo) ;;; denote-silo.el ends here