mmiri-ifuru · 2022-05-13 07:29
Hi,
I use `use-package` to install `org`. This obviously happens when `init.el` is run for the first time. On this first run, even after a newer version of `org` has been installed, emacs continues to use the old version of `org` packaged with `emacs` (from the second run onwards the newer version is used).
Is there any way to re-load `org` during that first run? It ends up causing errors and warning during `org-roam` installation as some of the functions introduced in newer versions of `org` (`org-roam` dependencies) do not load.
I have found [this](https://github.com/turbana/emacs-config/tree/e0ef851199564c65b5813a59bc64b94ab1945c63#initel), but it seems like a very ugly solution! Any suggestions how this can be better dealt with?
Cheers
Phil-Hudson · 2022-05-13 10:54
With some very simple packages, reloading after an upgrade *might* work. With something as huge and complex as Org, you can be 100% sure that loading a new version over an already-loaded older one will definitely fail in multiple ways. For me and I think for most experienced Emacs users, a restart of Emacs after upgrading one or more packages is simply taken for granted.
Illiamen · 2022-05-13 12:54
My understanding is that the `use-package` declaration for the newer version of Org needs to come before any features of Org (or packages which would use them) are declared/used. That's at least how it works in Straight.
I wouldn't expect loading a newer version of Org after loading an older version to work well, since function definitions can change between versions.
Emacs has the command `unload-feature`, which can unload features `provide`-ed by libraries. I would guess that you need to unload each of Org's features individually. I don't think that it would be worth the effort to find what is loaded on the first run, as that might change between versions of Emacs anyway.
If yow must load the built-in version before installing the newer version, maybe you could just install Org Roam after checking Org's version, if you do not load the newer version on the first run? There is the variable `org-version`.
kaushalmodi · 2022-05-13 15:31
I have this ~~old~~ post that explains how I install the Org devel version without creating any path shadowing: https://scripter.co/building-org-development-version/
You can extract the part related to `load-path` scrubbing from the elisp code in there for your usecase.
~~(I need to update that post by removing mentions of Org Elpa, replacing that with GNU ELPA, and so on ..)~~ **Updated**
---
_This might be another ugly solution :P_