V2 and spacemacs

Thank you very much indeed gnohz!

I spent hours without success in the configuration until I came across your post. I configured org-roam totally manually with use-package instead of creating a private layer, but org-roam was mysteriously not loaded until I added this line of code:

I did not know that Spacemacs’ org layer includes the org-roam package, so we need to exclude it from org layer; maybe you discovered this by digging into the source code.

Also the suggested configuration for org-roam in the official Spacemacs documentation (4.16. Org-roam support ) was a disaster for me, I was even unable to run emacs in daemon mode. By the way, by configuring org-roam manually with use-package, everything is working fine so far.

For the benefit of other users, I share my .spacemacs conf, with org-roam-ui also already configured and working:

(defun dotspacemacs/layers ()
  "Layer configuration:
This function should only modify configuration layer settings."
  (setq-default
     (org :packages (not org-roam))
     )
   dotspacemacs-additional-packages '(
                                      (org-roam)
                                      ( simple-httpd )
                                      ( websocket )
                                      (org-roam-ui :location (recipe :fetcher github :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out")))
                                      )
))

(defun dotspacemacs/user-config ()

(require 'org)
(setq org-enable-roam-support t)

(use-package org-roam
  :after org
  :ensure t
  :init (setq org-roam-v2-ack t) ;; Acknowledge V2 upgrade
  :custom
  (org-roam-directory  (file-truename "~/orgRoam") )
  (org-roam-completion-everywhere t)
  :config
  (org-roam-db-autosync-mode)
  ;; If using org-roam-protocol
  ;;(require 'org-roam-protocol)
  (org-roam-setup)
  :bind (("C-c n f" . org-roam-node-find)
         ("C-c n g" . org-roam-graph)
         ("C-c n r" . org-roam-node-random)
         (:map org-mode-map
               (("C-c n i" . org-roam-node-insert)
                ("C-c n o" . org-id-get-create)
                ("C-c n t" . org-roam-tag-add)
                ("C-c n a" . org-roam-alias-add)
                ("C-c n l" . org-roam-buffer-toggle))))
  )
(use-package org-roam-ui
  :after org-roam
  ;;:hook (after-init . org-roam-ui-mode)
  :config
  (setq org-roam-ui-sync-theme t
        org-roam-ui-follow t
        org-roam-ui-update-on-save t
        org-roam-ui-open-on-start t))
)

PS: do not forget to check that you have the path to gcc.exe and git.exe in your emacs exe-path variable.

1 Like