Closed suliveevil closed 1 year ago
I reboot my device, error remains.
I'm not sure if that's the root of the problem, but seems there's an issue with how the code is inferring relative paths. I have merged a PR (#10), let me know if it works now.
Also, could you please check if your org-similarity-directory
variable is indeed pointing to the wrong path? Make sure to (setq org-similarity-directory org-roam-directory)
after org-similarity
has been loaded as well, if you haven't done so.
org-roam-directory follows my .dic-locals.el
setting while org-similarity didn't.
https://github.com/suliveevil/test/blob/main/.dir-locals.el
((nil . ((eval . (setq-local
org-roam-directory (expand-file-name (locate-dominating-file
default-directory ".dir-locals.el"))))
(eval . (setq-local
org-roam-db-location (expand-file-name "org-roam.db"
org-roam-directory))))))
Now I see. If you set org-similarity-directory
's value with setq
, it will get the same value as org-directory
(or org-roam-directory
) at the moment you evaluated the command. Any changes to the latter will not be reflected onto the former indeed. Example:
(setq org-roam-directory "~/original/path")
(setq org-similarity-directory org-roam-directory)
(message org-similarity-directory) ;; "~/original/path"
(setq org-roam-directory "~/new/path")
(message org-similarity-directory) ;; "~/original/path"
If you wish that org-similarity-directory
have always the same value as org-directory
or org-roam-directory
, even after these have changed, you should use variable aliasing. Example:
(setq org-roam-directory "~/original/path")
(defvaralias 'org-similarity-directory 'org-roam-directory)
(setq org-roam-directory "~/new/path")
(message org-similarity-directory) ;; "~/new/path"
Wow, this is great, and how can I ignore the defvaralias warning? Thank you very much.
⛔ Warning (defvaralias): Overwriting value of ‘org-similarity-directory’ by aliasing to ‘org-roam-directory’
I opened a file and get another error 🤣:
ValueError: '/Users/suliveevil/org-roam/topics/go.org' is not in the subpath of '/Users/suliveevil/org-roam/Emacs/package' OR one path is relative and the other is absolute.
full output:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/suliveevil/.config/emacs/lib/org-similarity/venv/lib/python3.10/site-packages/orgsimilarity/__main__.py", line 257, in <module>
main()
File "/Users/suliveevil/.config/emacs/lib/org-similarity/venv/lib/python3.10/site-packages/orgsimilarity/__main__.py", line 243, in main
results = format_results(
File "/Users/suliveevil/.config/emacs/lib/org-similarity/venv/lib/python3.10/site-packages/orgsimilarity/__main__.py", line 214, in format_results
target_rel_path = target.relative_to(input_path.parent)
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 818, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/Users/suliveevil/org-roam/topics/go.org' is not in the subpath of '/Users/suliveevil/org-roam/Emacs/package' OR one path is relative and the other is absolute.
the latest commit fixed this issue. You are amazing!
I moved files to
~/test
folder, but org-similarity didn't followorg-roam-directory
https://github.com/suliveevil/test
full output