From 7068d63e966c0ca8d098ac4f7a90434f4c9b6822 Mon Sep 17 00:00:00 2001 From: Noboru Ota Date: Mon, 13 Dec 2021 10:44:37 +0100 Subject: [PATCH] (docs) minor correction to #2002 (#2004) * (docs): fix examples for .dir-locals.el Two items: 1. The current example does not work; in order to call a function wihtin `.dir-locals.el`, you should use `eval`. - [StackExchange](https://emacs.stackexchange.com/questions/21955/calling-functions-in-dir-locals-in-emacs) - [Working example buried in an issue](https://github.com/org-roam/org-roam/issues/1527#issuecomment-933674233)) - `(info "(emacs)Directory Variables")` 2. Add clear instruction to use an absolute path to define `org-roam-directory` in this context (it's buried in this [issue](https://github.com/org-roam/org-roam/issues/1459#issuecomment-817259656). * (docs)Fix the `eval` example for subdirectories. Comment: https://github.com/org-roam/org-roam/pull/2002#issuecomment-991830879 The eval form that uses relative path sets the local variable *relative to the org file*. This means the eval form woudl need to locate the relevant `.dir-locals` file by traversing the directory tree upwards from the file (lightly tested to wrok) Using absolute path (the first example) should be fine without change (not tested) * update texi * (docs) minor correction to #2002 Correcting the example of .dir-locals using an absolute path to avoid confusion. Lightly tested with a real absolute path in my system; works on my end with a subdir. Co-authored-by: Jethro Kuan --- doc/org-roam.org | 2 +- doc/org-roam.texi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/org-roam.org b/doc/org-roam.org index a5566a7..05ad00b 100644 --- a/doc/org-roam.org +++ b/doc/org-roam.org @@ -1382,7 +1382,7 @@ variable using directory-local variables. This is what ~.dir-locals.el~ may contain: #+BEGIN_SRC emacs-lisp - ((nil . ((org-roam-directory . "/path/to/alt/org-roam/dir/org-roam-dir") + ((nil . ((org-roam-directory . "/path/to/alt/org-roam-dir") (org-roam-db-location . "/path/to/alt/org-roam-dir/org-roam.db")))) #+END_SRC diff --git a/doc/org-roam.texi b/doc/org-roam.texi index 8038226..0080e38 100644 --- a/doc/org-roam.texi +++ b/doc/org-roam.texi @@ -1935,7 +1935,7 @@ variable using directory-local variables. This is what @code{.dir-locals.el} may contain: @lisp -((nil . ((org-roam-directory . "/path/to/alt/org-roam/dir/org-roam-dir") +((nil . ((org-roam-directory . "/path/to/alt/org-roam-dir") (org-roam-db-location . "/path/to/alt/org-roam-dir/org-roam.db")))) @end lisp