(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 <jethrokuan95@gmail.com>
This commit is contained in:
Noboru Ota
2021-12-13 10:44:37 +01:00
committed by GitHub
parent 898295f4a0
commit 7068d63e96
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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