Maintain separate directory silos for notes
The user option denote-directory accepts a value that represents the path to a directory, such as ‘~/Documents/notes’. It may also be a list of related directories (The denote-directory option). Normally, the user will have one place where they store all their notes, in which case this arrangement shall suffice.
There is, however, the possibility to maintain separate and unrelated directories of notes. By “separate”, we mean that they do not communicate with each other: no linking between them, no common keywords, nothing. Think of the scenario where one set of notes is for private use and another is for an employer. We call these separate directories “silos”.
To create silos, the user must specify a local variable at the root of the desired directory. This is done by creating a ‘.dir-locals.el’ file, with the following contents:
;;; Directory Local Variables. For more information evaluate:
;;;
;;; (info "(emacs) Directory Variables")
((nil . ((denote-directory . "/path/to/silo/"))))When inside the directory that contains this ‘.dir-locals.el’ file, all Denote commands/functions for note creation, linking, the inference of available keywords, et cetera will use the silo as their point of reference (The denote-silo package which formerly was ‘denote-silo-extras.el’). They will not read the global value of denote-directory. The global value of denote-directory is read everywhere else except the silos.
In concrete terms, this is a representation of the directory structures (notice the ‘.dir-locals.el’ file is needed only for the silos):
;; This is the global value of 'denote-directory' (no need for a .dir-locals.el)
~/Documents/notes
|-- 20210303T120534--this-is-a-test__journal_philosophy.txt
|-- 20220303T120534--another-sample__journal_testing.md
`-- 20220620T181255--the-third-test__keyword.org
;; A silo with notes for the employer
~/different/path/to/notes-for-employer
|-- .dir-locals.el
|-- 20210303T120534--this-is-a-test__conference.txt
|-- 20220303T120534--another-sample__meeting.md
`-- 20220620T181255--the-third-test__keyword.org
;; Another silo with notes for my volunteering
~/different/path/to/notes-for-volunteering
|-- .dir-locals.el
|-- 20210303T120534--this-is-a-test__activism.txt
|-- 20220303T120534--another-sample__teambuilding.md
`-- 20220620T181255--the-third-test__keyword.orgIt is possible to configure other user options of Denote to have a silo-specific value. For example, this one changes the denote-known-keywords only for this particular silo:
;;; Directory Local Variables. For more information evaluate:
;;;
;;; (info "(emacs) Directory Variables")
((nil . ((denote-directory . "/path/to/silo/")
(denote-known-keywords . ("food" "drink")))))This one is like the above, but also disables denote-infer-keywords:
;;; Directory Local Variables. For more information evaluate:
;;;
;;; (info "(emacs) Directory Variables")
((nil . ((denote-directory . "/path/to/silo/")
(denote-known-keywords . ("food" "drink"))
(denote-infer-keywords . nil))))To expand the list of local variables to, say, cover specific major modes, we can do something like this:
;;; Directory Local Variables. For more information evaluate:
;;;
;;; (info "(emacs) Directory Variables")
((nil . ((denote-directory . "/path/to/silo/")
(denote-known-keywords . ("food" "drink"))
(denote-infer-keywords . nil)))
(org-mode . ((org-hide-emphasis-markers . t)
(org-hide-macro-markers . t)
(org-hide-leading-stars . t))))As not all user options have a “safe” local value, Emacs will ask the user to confirm their choice and to store it in the Custom code snippet that is normally appended to init file (or added to the file specified by the user option custom-file).
Finally, it is possible to have a ‘.dir-locals.el’ for subdirectories of any denote-directory. Perhaps to specify a different set of known keywords, while not making the subdirectory a silo in its own right. We shall not expand on such an example, as we trust the user to experiment with the best setup for their workflow.
Feel welcome to ask for help if the information provided herein is not sufficient. The manual shall be expanded accordingly.