The right way of loading extensions (like org-roam-dailies.el)

So org-roam-dailies.el recently moved to the extensions/ subdirectory, which broke loading it for me. I was able to fix that by adding (add-to-list 'load-path "~/src/org-roam/extensions") to the :config section of use-package before the require. That seems a bit kludgy, though… what’s the cannonical way of doing this?

I don’t see anything wrong with this, if you are loading from a manually cloned local repo. I guess you could add to the load-path in the :init section – someone using use-package can correct me.

Arguably the most “canonical” way may be using the built-in package.el. It seems that I don’t need to do anything. MELPA recipe appears to bring all the .el files in the extensions directory up in the root of org-roam installation directory. I only have the root in my load-path: ~/.config/emacs/elpa/org-roam-20210810.602 – at least this is the latest I got in MELPA just a few minutes ago. Is this before directory reorg happened?

Yeah, you’re right… when loading from MELPA or installing using package.el the hierarchy of the repo gets all flattened out, so there’s no problem. So since loading from local git working copy is a special case it makes sense to manually add any subdirs to the load-path.

1 Like