I use the stable version of a package (0.7.0 of gptel) which is distributed on melpa-stable. I installed it via package.el and I configure it via a use-package. I want to be able to switch easily between this version and a local development version of this package, which is based on a git worktree on my machine. How do I do this?

I thought it would be as easy as adding the path to the development version in my load path, either in the use-package form, or else by manually requireing it before package initialization. However, this doesn't work, since the package needs to be installed by package-install-file to work properly, and installation writes outputs into the elpa/ directory, clobbering the stable installation.

So is there some other way to do this, ideally using just built-in facilities like package.el and use-package?

Here is what I am doing now to but it seems like a hack.

To update the development version:

  1. I git pull the latest version of the package into my local dev directory
  2. I modify its code so "Version" is set to "999.git", which I expect will always translate to a higher version number than any stable released using the usual major minor point versioning scheme.
  3. I evaluate the expression (package-install-file (expand-file-name "/path/to/local_dev_dir")), which installs the development version into elpa/.

To switch between to the stable version:

In init.el, in my use-package declaration for gptel, I add a keyword value pair which points explicitly to the stable version: :load-path "/path/to/elpa/stable/version/"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.