Org roam rebuilds database on every startup after switching to DOOM emacs

What happened?

I just switched over to DOOM emacs after using roam with GNU emacs for years. Everything works fine except org-roam-db-autosync-mode does not seem to work. The issue is that every time I try to use roam after restarting emacs, all of my roam files need to decrypt which takes forever. I assume that it is rebuilding the database every time. Please note that all of my roam files are encrypted using the same gpg secret. The exact same config works perfectly well in GNU emacs, but not DOOM emacs. Also note that my DOOM and GNU emacs are running the same version of roam. My understanding is that roam should keep the database consistent with the files by incrementally updating the db every time a file is changed. It may also be important to note that if I use emacs to change or add any nodes, the database does NOT update. I can’t even see the node I just created using org-roam-node-find I believe this means that it is not autosyncing. Also note that there are no details in the message buffer.

Here is my DOOM emacs config, which causes my described issue.

(after! org-roam
    (setq org-roam-directory "~/working/org/roam")
    (setq org-roam-completion-everywhere t)
    (org-roam-db-autosync-enable)            '<-------------------------------this is part of the issue
    (setq epa-file-encrypt-to '("gpgname"))                 
    (setq epa-file-select-keys 1)                                                      ;;don't prompt which key to use
    (setq org-roam-capture-templates '(("d" "default" plain "%?"    ;;encrypt all org roam files
        :target (file+head "${slug}.org.gpg"
            "#+title: ${title}\n")
        :unnarrowed t)))
    (setq org-roam-dailies-capture-templates
        '(("d" "default" entry
            "* %?"
            :target (file+head "%<%Y-%m-%d>.org.gpg"
                "#+title: %<%Y-%m-%d>\n")))))

Here is my GNU emacs config which works perfectly

(use-package org-roam
    :custom
    (org-roam-directory "~/working/org/roam")
    (org-roam-completion-everywhere t)
    :config
    (org-roam-setup)
    (setq epa-file-encrypt-to '("gpgname"))                 
    (setq epa-file-select-keys 1)                                ;;don't prompt which key to use
    (setq org-roam-capture-templates '(("d" "default" plain "%?" ;;encrypt all org roam files
        :target (file+head "${slug}.org.gpg"
                            "#+title: ${title}\n")
        :unnarrowed t)))
    (setq org-roam-dailies-capture-templates
        '(("d" "default" entry
            "* %?"
            :target (file+head "%<%Y-%m-%d>.org.gpg"
                                "#+title: %<%Y-%m-%d>\n")))))

As you can see, the configs are just about identical except the GNU one uses use-package and the depricated org-roam-setup instead of org-roam-db-autosync-enable. I tried using the GNU config in DOOM, but the issue persists. Please note that org-roam-db-autosync-mode is enabled as you would expect.

What did you expect to happen?

I expect to notice little to no overhead between emacs restarts despite to my encryption configuration.

Steps to reproduce

  1. Load DOOM emacs
  2. run org-roam-node-find (or any command that required db access)
  3. Notice that all of my MANY GPG files are being decrypted, which indicates that the database is being rebuilt. It takes forever

Please note that this is not an issue in vanilla emacs.

Roam Environment

  • Emacs: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-09-12
  • Framework: Doom
  • Org: Org mode version 9.6 (9.6-??-bed47b4 @ /home/marc/.emacs.d/.local/straight/build-28.2/org/)
  • Org-roam: f9228ce
  • sqlite-connector: sqlite

System information


Loading data dump...

If anyone else runs into this problem, the solution was to add +roam2 in the org block in init.el (I didn’t know that roam was supported by doom by default), delete ~/.emacs.d/.local/cache/org-roam.db, run org-roam-db-clear-all, run org-roam-db-sync.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.