org-roam-server
org-roam-server copied to clipboard
Set a different org-roam-directory in the server
It would be cool if the server could read local variables, like org-roam does, by being launched in the browser from emacs or set a custom org-roam directory from the browser, if one has more than one org-roam-directory, for instance defined in .dir-locals.el
.
Yours is a wonderful addition to the nascent and expanding org-roam ecosystem. Thanks.
Yours is a wonderful addition to the nascent and expanding org-roam ecosystem. Thanks.
Thank you!
The server is using org-roam functions. Doesn't changing locals affect these functions?
For example; https://github.com/org-roam/org-roam-server/blob/5c830dd937c7904d53200dcb869f68e9d3790870/org-roam-server.el#L86
Yes, org-roam-db-query connects all the *.db
files. So they all become part of the same graph. While the current buffer-network
view allows looking only at the nodes and edges connected to a particular node, it would be nice having the capability to only see the nodes for a particular database. Sometimes I want to show others just this particular directory's graph. Kind of like the way file viewer
works.
What is your way of creating and setting the second db. So I can test it while developing it.
Inside the folder that will contain the second database, I make a file called .dir-locals.el
which contains the following local variable.
((nil . ((eval . (setq-local org-roam-directory (expand-file-name "./")))
)))
The rest is managed by org-roam, when I create new files or rebuild the database from dired or a file inside that directory.
👋 Is there a workaround for this?
👋 Is there a workaround for this?
You can use tags and then you can use filtering to only show one.
Inside the folder that will contain the second database, I make a file called
.dir-locals.el
which contains the following local variable.((nil . ((eval . (setq-local org-roam-directory (expand-file-name "./"))) )))
The rest is managed by org-roam, when I create new files or rebuild the database from dired or a file inside that directory.
The following settings achieve what you want:
- create another roam.db in the local directory
- setq org-roam settings globally instead of setq-local
((nil . (
(eval . (setq org-roam-directory "."))
(eval . (setq org-roam-db-location (expand-file-name "another-roam.db" (expand-file-name "./"))))
)))
Hello,
I applied your settings in one local directory. It works because I noticed org-roam.db
created under the directory.
Then, I wonder what becomes the init.el
settings :
(use-package org-roam
:ensure t
:hook
(after-init . org-roam-mode)
:custom
(org-roam-db-location "c:/Users/xxx/org-roam/org-roam.db")
(org-roam-directory "d:/xxx/Documents/org-roam/")
Thanks to your post, these initial settings seem no more relevant.
Should I keep these ? so that they make org-roam
point to the default settings ?
Also, because your post allows to have directory based settings for org-roam
. Is there an interactive function
which would let you choose the directory you want org-roam
to point to ? Currently, as far as I understood
the only way is to open a file in that directory.
Regards