Doom Emacs : how to upgrade org-roam

What should I do to update org-roam from my Doom Emacs setup?
I’m struggling with the bug, solution for which is already merged to org-roam master

Running .emacs/bin/doom upgrade didn’t work
I guess that’s because org-roam wasn’t upgraded in doom repo

Can I somehow set org-roam to be downloaded from it’s own repo?

1 Like

In $DOOMDIR/packages.el unpin org-roam:

(unpin! org-roam company-org-roam)

Exit Emacs, run doom sync && doom upgrade

2 Likes

Related to this, should I enable the +roam plugging in $DOOMDIR/packages.el?
Currently, I have the following:
In $DOOMDIR/packages.el:
(unpin! org-roam company-org-roam)
(package! org-roam
:recipe (:host github :repo “jethrokuan/org-roam” :branch “develop”)
)
and in $DOOMDIR/init.el:
(org ; organize your plain life in plain text
+journal
+jupyter
+noter
+pandoc
+present
;; +pretty ; expensive!
+roam)

Is there any improvement to make for the above configuration ?

It’s up to you. The +roam flag adds some keybindings and a few other things. If you decide to use it, then you should remove package! org-roam. You also should not use use-package! org-roam, put your config in an after! form.

The following examples can be used interchangeably but not simultaneously!

;; packages.el
(unpin! org-roam company-org-roam)

;; init.el
;; use the +roam flag
(org +journal ... +roam)

;; config.el
;; configure Org Roam with after!
(after! org-roam 
  (setq org-roam-...))

or

;; packages.el 
;; Use master branch from org-roam/org-roam repository
;; instead of obsolete jethrokuan/org-roam repository! 
;; You don't need to unpin anything
(package! org-roam
  :recipe (:host github :repo “org-roam/org-roam” :branch “master”))
(package! company-org-roam
  :recipe (:host github :repo “org-roam/company-org-roam” :branch “master”))

;; init.el
(org +journal ...) ;; don't use the +roam flag!

;; config.el
;; configure Org Roam with use-package!
(use-package! org-roam
  :defer t
  :hook ...
  :config
  (setq org-roam-...))

(use-package! company-org-roam
  :defer t
  ...
  :config
  (setq ...))

It’s probably more convenient to use the first example with the +roam flag.

1 Like

Thanks for the detailed help.
By the context and web search, it seems that the semantics of unpin! is to use the latest development version of the package?

So
(unpin! org-roam company-org-roam)
is already equivalent to
(package! org-roam
:recipe (:host github :repo “org-roam/org-roam” :branch “master”))
(package! company-org-roam
:recipe (:host github :repo “org-roam/company-org-roam” :branch “master”))

?

You use unpin for a package that you load via a module, which always pins specific versions.

Since org-roam is part of a module …

2 Likes

No, it is not. It may give you the same result in this particular case, but this two macro do very different things and they are not equivalent nor interchangeable.

To use a package in Doom, you must must first declare this intent by writing the declaration (package! ...). There are a lot of different initialization files in Doom called modules that do this for you. You can inspect these files yourself and learn what they are doing. The modules, besides declaring the recipe and initializing and configuring the package with use-package!, also typically pin the package to a specific commit.

You can load all these pre-installed configuration files just by putting something like

:lang
module-name
:tools
(another-module-name +with-flag)

into your init.el. The above means that your Emacs instance will execute

(package! package1 
  :pin commit
  :recipe ...)

(use-package! package1 
...)

You can unpin! the package then in your config! file.

Instead of using the module, you are free to configure the package yourself by using package! and use-package!

1 Like

Thanks for the detailed explanation.

So in my context of wishing to try the latest released features of org-roam, while still taking advantage of the configuration of Doom’s configuration to org-roam, so I should do the following:

  1. Declare my interest in using Doom’s installation receipt and configuration for org-roam at init.el
  2. But in package.el do (unpin org-roam company-org-roam) and add the installation receipts of

(package! org-roam-server :recipe (:host github :repo “org-roam/org-roam-server” :files ("*")))
(package! company-org-roam :recipe (:host github :repo “org-roam/company-org-roam”))

  1. Do nothing special in terms of (use-package! org-roam ...) and (use-packages! company-org-roam)(in order to still using Doom’s configuration for org-roam and company-org-roam)

Is my above understanding more accurate than before?

Thanks again for your help!

NO! You do not need package! org-roam because it has already been defined in the module.

Use what I wrote earlier.

Sure, not at all!

I know this is an old thread, but since I am using doom, I followed the advice here and (after a few hours…) seem to have succeeded in getting emacs and doom to the latest version and org-roam to the master branch.
I am using the second method:

(package! org-roam
  :recipe (:host github :repo “org-roam/org-roam” :branch “master”))
(package! company-org-roam
  :recipe (:host github :repo “org-roam/company-org-roam” :branch “master”))

;; init.el
(org +journal ...) ;; don't use the +roam flag!

;; config.el
;; configure Org Roam with use-package!

Since my previous config for v1 of roam did not have any entries in config.el, I did not add anything here either. However, now I am missing the doom integration and the keystrokes to find and add roam notes. What do I have to do to get this back?

I suggest you might like to try the new +roam2 flag instead, perhaps?

Also…

company-org-roam has long been deprecated. I would remove it from package.el.

Thanks, great suggestion. Switched to +roam2 and am a happy camper now.

1 Like

I’m eager to migrate to v2 using Doom Emacs, but I’m not getting any of the above to work. I don’t know if things have changed since this thread went quiet, but nothing I see here upgrades my org-roam to v2. I’m still org-roam-version = 1.2.3 after trying all versions of the above. I can’t locate any suggestions that work for me in the Doom Emacs discord server, but things have gone pretty quiet there re: org-roam v2. I’ve tried a couple of Doom Emacs config.el/packages.el/init.el combinations I’ve found shared on GitHub. No dice. Has anyone here successfully migrated to org-roam v2 using Doom Emacs recently who could share their method?

I have spent much time yesterday on migrating to V2.
I still have some issues which I am not sure how to fix, but most things work now.

Let me try to list here some issues I had. I am running on a Mac, and I use doom emacs.
To update I followed the steps in here.

Installation stuff

I had an issue with sql not working. The problem was that my c-compiler was not working properly. I solved it by updating it. Then, even after updating it, the migration would not work, and the reason was that a backup folder (named org-roam-directory.bak) was already created which stopped the migration from working. It would be nice if there would be a warning telling this. So I removed the bak folder, and run the migration again, and the script ran fine.

Configuration stuff

Here I have the most issues.
Running on doom I think that one should use (after! org-roam ...) to config stuff, but that did not work for me. I had to use (use-package! org-roam... ) instead. I am not sure what is the effect of this, but now the configuration is loaded.
I had to define all of the keybinding myself, and it took me some time.
I had to modify the capture-templates to work well with V2. That also took some time. To do it successfully I followed the default value of the variable org-roam-capture-templates.

The org-roam-buffer is different on V2. I still could not make it work as I want. I would like to press RET on a link in the org-roam-buffer and that it would open the relevant note in the “main” buffer.
I am not sure how to accomplish that.
Moreover, I would like to modify the styling of the org-roam-buffer. Right now, the titles of the notes are not emphasized enough and it is hard to read.

Other than that, I was using before org-roam-server to view my graph.
Now I installed org-roam-ui and it went smoothly!
The only issue I have is that labels in my equations (i.e. \label{eq:1} in an equation environment) are also shown in the html rendering of the note. I opened an issue on that here.

I hope this helps.

BTW, my config for org-roam v2 can be found here.

Thank you, rio.holtzman. It did help. I was encouraged by your reply and success upgrading to v2 in Doom Emacs to give it another try.
While flailing around unsuccessfully again for a while, it dawned on me that I had not updated Doom Emacs for, let’s just say, too long (Hear the sound of egg splattering across my face?). So I did, and, lo, a lot of things work better now. Including being able to upgrade to org-roam v2.
I was also inspired by your success with org-roam-ui, which I’ve installed and love. I liked org-roam-server, and ouri seems like progress.
Moral of my story: “Never upgrade anything important,” a policy I adopted as a former Windows user, isn’t always the right approach.

1 Like