Org-roam-directory not respecting new filepath in configuration

I’m running org-roam in DOOM Emacs.
I’ve copied the generic config that can be found in the orgroam manual and am trying to change “/path/to/org-files/” to a specific filepath. However, everytime I run C-c n f it looks for nodes in “C:/User/username/org/”, which is the generic org path.

I’ve tried to unpin!, to use after!, etc. Either i’m not doing it right or i’m missing something.
Any help is appreciated.

I suspect either your config is not evaluated, or evaluated but overridden by the Doom config.

Doom Emacs has its specific way you need to follow to correctly put in own configuration.

Do you use roam2 option? Where do you add your own config, and how exactly?

If all is correct, I think you still need to run doom sync. Have you done this?

Yes, I run doom sync after changes.
Regarding the configs:
In init.el:
(org +roam2)

In config.el:
(after! org-roam
:ensure t
:after org
:custom
(org-roam-directory (file-truename “~/org/roamtest”))
(org-roam-completion-everywhere t)
:bind ((“C-c n l” . org-roam-buffer-toggle)
(“C-c n f” . org-roam-node-find)
(“C-c n g” . org-roam-graph)
(“C-c n i” . org-roam-node-insert)
(“C-c n c” . org-roam-capture)
;; Dailies
(“C-c n j” . org-roam-dailies-capture-today))
:config
;; If you’re using a vertical completion framework, you might want a more informative completion interface
(setq org-roam-node-display-template (concat "${title:*} " (propertize “${tags:10}” 'face 'org-tag)))
(org-roam-db-autosync-mode)
;; If using org-roam-protocol
(require 'org-roam-protocol))

Run

meta-X describe-variable
org-roam-directory

to inspect the actual value of org-roam-directory

Here’s the value information:

org-roam-directory is a variable defined in ‘org-roam.el’.

Its value is "c:/Users/user/org/roamtest/"
Original value was 
"c:/Users/user/org-roam/"

Default path to Org-roam files.
All Org files, at any level of nesting, are considered part of the Org-roam.

  You can customize this variable.

And yet when I C-c n f it still looks in C:/User/user/org/

This does not appear in the excerpt above. Perhaps it’s set elsewhere?

yes it’s what I use for my org-directory which is set at the beginning of config.el and is part of the boilerplate of DOOM. When I change it to let’s say C:/Users/user/xyz an then do C-c n f I get an error that directory “C:/Users/user/xyz” does not exist.

So it seems that controls where C-c n f looks for org-roam, but why are they related and how do I fix it?

org-directory and org-roam-directory are two different things. Org-roam looks at the latter, org-roam-directory.

Is this what you are asking about?

Does this “they” refer to org-directory and org-roam-directory? If so they are two different directories. If they appear to be “related”, that’s either how you set the value for each, or how Doom sets the value for each. I don’t use Doom any longer so I have no idea how it is done now. Perhaps the configuration of +roam2 does something like this?

(setq org-roam-directory org-directory)

Maybe I wasn’t clear, i’ll try again:

Based on what I understood (and also what you explained), org-directory and org-roam-directory are two different things.
org-directory is for general org files
org-roam-directory is for orgroam nodes that get stored

I tested changing the file location with org-directory and org-roam-directory in doom and in my case it appears that org-directory is the function that tells C-c n f where to look for nodes. org-roam-directory seems to be ignored (potentially a doom specific issue?)

I could try and delete the database and build it again, but I couldn’t really figure out where the database gets stored and how I can look for it.

(setq org-roam-directory org-directory)
The above setq function could be happening behind the scenes, but I don’t know where.

The database is stored in the directory found in org-roam-db-location

But the database is not the problem. The files table stores the entire path where the files are located. That makes the database independent of the org-roam-directory contents.

I suspect that when you call the template, the variable is reset.

Use the function debug-on-variable-change. Do this after you have set the variable. If the variaible is changed, emacs will enter the debugger and you will know what is changing it.

(debug-on-variable-change 'org-roam-directory)

It’s done here in the +roam2. org-roam-directory is not ignored in this code.

What’s problem for you seems to be this part.

(after! org-roam
:ensure t
:after org
:custom
(org-roam-directory (file-truename “~/org/roamtest”))

Are you sure this is the correct syntax of after!? It is a doom specific macro.

One thing I suggest you try is this below and replace all your config.el entry for Org-roam with the following.

Important

  • DO NOT use after! (unless you are sure the syntax you use above is correct) but use use-package! (doom specific) or use-package (Emacs built-in).
  • Use :config and not :custom within use-package or use-package!.
  • Be careful with the number and place of parentheses.
(use-package! org-roam
  :config
  (setq org-roam-directory "~/org/roamtest"))