Hi,
I would like to suggest a slight clarification to the documentation for
denote, related to the configuration of separated directies as
'silos'. This is great feature, but I was slightly tripped-up by having
a subdirectory inside the `denote-directory`, referenced in the
`.dir-locals.el` file; links inside notes within the subdirectory are
unable to find the path to notes in the parent directory (or, you are
not able to create links to the parent at all) because I blindly copied
and pasted the suggested elisp in the docs into my config:
```
;;; Directory Local Variables. For more information evaluate:
;;;
;;; (info "(emacs) Directory Variables")
((nil . ((denote-directory . default-directory))))
```
Setting `denote-directory` to `default-directory` is unhelpful in this
case, because by default the prompt you get after calling `denote-link`
on a note inside the subdirectory will only allow you to link to
documents in the subdirectory, not the parent. In my case, I think I
created the link before creating the parent/child directory structure,
rendering the link in the note inside the subdirectory broken.
Using an absolute file path instead of `default-directory` solves the
problem. Might I suggest a slight change in the documentation to this
effect, making it more clear to a user who is less experienced with
elisp and doesn't necessarily understand that `default-directory` refers
to the directory of the current buffer?
Happy to submit a patch if you are interested.
Thank you.
--
Matthew
> From: Matthew Lemon <y@yulqen.org>> Date: Thu, 15 Dec 2022 14:29:06 +0000>> Hi,
Hello Matthew,
> [... 24 lines elided]> Using an absolute file path instead of `default-directory` solves the> problem. Might I suggest a slight change in the documentation to this> effect, making it more clear to a user who is less experienced with> elisp and doesn't necessarily understand that `default-directory` refers> to the directory of the current buffer?
If I understood your case correctly, what you got was the intended
behaviour. You had a subdirectory of 'denote-directory' and placed the
'.dir-locals.el' in the subdirectory. This turned it into a silo.
You mention that an absolute path fixes the problem for you, which makes
me think that I am missing something and did not understand what the
case is.
At any rate, I am happy to improve the documentation on this. Perhaps
it will help to explain how '.dir-locals.el' works and why the manual
suggests the 'default-directory'.
> Happy to submit a patch if you are interested.
Yes, please go ahead. Note that tomorrow I will prepare version 1.2.0
(unless I discover some last minute bug).
> Thank you.
You are welcome and thank you for doing this!
All the best,
Prot
--
Protesilaos Stavrou
https://protesilaos.com
> If I understood your case correctly, what you got was the intended> behaviour. You had a subdirectory of 'denote-directory' and placed the> '.dir-locals.el' in the subdirectory. This turned it into a silo.
My apologies - I wasn't clear enough! Perhaps this helps:
- my-default-denote-directory
|
|-- 20221201T090528--note-1__tag.org
|-- 20221201T192328--note-2__tag.org
...
...
- my-silo
|
|-- 20221201T090528--note-1__tag.org
|-- 20221201T192328--note-2__tag.org
|-- .dir-locals.el
|-- journals
|
|-- 20221209T090528--friday-9-december-2022__journal.org
|-- 20221210T090528--saturday-10-december-2022__journal.org
'my-default-denote-directory' is my main denote directory, referenced as:
(setq denote-directory (expand-file-name "~/Documents/my-default-denote-directory"))
in my emacs config.
'my-silo' is different directory in an entirely different part of the
file system. This directory has the .dir-locals.el file. However, there
is also a 'journals' subdirectory inside 'my-silo'.
Using the config as suggested in the documentation, when attempting to
add a link (with 'denote-link') in one of these journal files you are
prevented from linking to files in the parent, 'my-silo', directory,
because of the (denote-directory . default-directory) setting in
.dir-locals.el file, which sets 'denote-directory' at that time to
'my-silo/journals'.
> Yes, please go ahead. Note that tomorrow I will prepare version 1.2.0> (unless I discover some last minute bug).
I will submit a change over the weekend. No worries if it misses any
deadline.
All the best.
--
Matthew
>> Yes, please go ahead. Note that tomorrow I will prepare version 1.2.0>> (unless I discover some last minute bug).>> I will submit a change over the weekend. No worries if it misses any> deadline.
Please find attached a suggested patch.
Rather than disrupt your existing config examples, (which uses
default-directory) I have added a paragraph pointing out the possibility
to use an absolute path, and an associated example. I looked through the
documentation for similar "qualification" or "NB" style paragraphs and
found a mixture of paragraphs wrapped in square brackets or paragraphs
preceded by "NOTE" or "IMPORTANT". In this case, I have used "IMPORTANT"
as I think this merits the warning - I spent a bit of time debugging
this in my own case.
Happy to have feedback or make any adjustments.
Many thanks and all the best,
--
Matthew
> From: Matthew Lemon <y@yulqen.org>> Date: Mon, 19 Dec 2022 11:44:54 +0000>>>> Yes, please go ahead. Note that tomorrow I will prepare version 1.2.0>>>> (unless I discover some last minute bug).>>>> I will submit a change over the weekend. No worries if it misses any>> deadline.>> Please find attached a suggested patch.>> Rather than disrupt your existing config examples, (which uses> default-directory) I have added a paragraph pointing out the possibility> to use an absolute path, and an associated example. I looked through the> documentation for similar "qualification" or "NB" style paragraphs and> found a mixture of paragraphs wrapped in square brackets or paragraphs> preceded by "NOTE" or "IMPORTANT". In this case, I have used "IMPORTANT"> as I think this merits the warning - I spent a bit of time debugging> this in my own case.>> Happy to have feedback or make any adjustments.
Thank you, Matthew! I just installed your patch and pushed it to the
remote. Also updated the manual's "Acknowledgements" section to mention
your name there.
--
Protesilaos Stavrou
https://protesilaos.com