emacs-eldev / eldev

Elisp development tool
https://emacs-eldev.github.io/eldev/
GNU General Public License v3.0
227 stars 17 forks source link

Overriding built-in org #32

Closed publicimageltd closed 3 years ago

publicimageltd commented 3 years ago

I just switched to Eldev since it looks really nice, and I like it so far. Running the tests, however, I have encountered a weird error which had not been there before, when I had been using makem.sh So it looks like makem.sh seems to use the built-in internal packages, and I suspect that the failing tests are due to different versions of org mode.

I have org-mode version "9.4.4" installed (replacing the built-in version), but my emacs ships with "9.3." The newer org-mode-version is, I believe, a result from using org-mode-plus-contrib in my config file. There the package is pinned with use-package, and I have added org-mode.org/elpa to my package-archives. But still, the newer version is not recognized as a built-in by Eldev:

$ eldev eval 'org-version' 
"9.3"
$ eldev -X eval 'org-version'
"9.3" 

This is what I tried to teach Eldev that it should download org:

(eldev-use-package-archive '("org" . "https://orgmode.org/elpa/"))

Same result with adding a local dependency declaration to my local built.

I also tried to manually force a new version by setting up the requirement for the package testes. But then Eldev complains:

Dependency ‘org’ is built-in, but required version 9.4 is too new (only 9.3 available)

Well, I know that it is built-in, that's exactly the problem. Sigh.

Do you have any ideas what could be done?

doublep commented 3 years ago

As far as I understand it, this looks like a bug in Eldev. I.e. normally built-in packages can be overriden by installing external versions, but Eldev doesn't support this.

publicimageltd commented 3 years ago

AFAIK, it would be enough in the init file to (a) call package-initialize as early as possible, before the internal package is loaded, and (b) then to modify the load-path, setting the external package's path before the internal ones.

So how is Eldev triggering the loading of the package? Would it make sense to optionally pass an init file which explicitly sets some stuff and then requires the package we want to test?

doublep commented 3 years ago

Actually it sort of already worked, problem was in global cache functionality. Eldev dependency package management is quite complicated because of the support for local dependencies and so on. For these and other reasons I couldn't use standard package-compute-transaction for updating and rolled my own. But as said, in this case the bug was not related.

When I release bugfix version 0.8.1, you will be able to use (eldev-use-package-archive '("org" . "https://orgmode.org/elpa/")), provided you declare in your package that it depends on 9.4 or something, so that Eldev sees that the built-in version is not enough.

doublep commented 3 years ago

Fixed in 0.8.1 (you need to wait for MELPA update, unless you use a local copy of Eldev).

In 0.9 I will likely add Org ELPA as a built-in archive, so that you could use just sth. like (eldev-use-package-archive 'org).

publicimageltd commented 3 years ago

Wow, that was fast! I will try it out soon. Thanks for such a fast response!

doublep commented 3 years ago

By the way, Org appears to be available from GNU ELPA, so you could just use (eldev-use-package-archive 'gnu).