36

I use melpa-stable as an additional package repository, but one of the packages I like to use (icicles) isn't available on melpa-stable. Is there any way to configure package.el to normally use melpa-stable, but use melpa for a specific subset of packages?

3
  • 1
    Upgrade to emacs 24.4 ;-)
    – Malabarba
    Nov 1, 2014 at 18:36
  • @Malabarba, that's definitely on the cards... Nov 1, 2014 at 18:49
  • I can't find icicles on melpa either.
    – user650654
    Aug 23, 2019 at 20:44

2 Answers 2

50

Use the option package-archive-priorities which was made for this very purpose. To prefer MELPA Stable over MELPA, add the following to your init file:

(setq package-archives
      '(("GNU ELPA"     . "https://elpa.gnu.org/packages/")
        ("MELPA Stable" . "https://stable.melpa.org/packages/")
        ("MELPA"        . "https://melpa.org/packages/"))
      package-archive-priorities
      '(("MELPA Stable" . 10)
        ("GNU ELPA"     . 5)
        ("MELPA"        . 0)))

The higher the number, the higher the priority of a package archive. For any package that exists in multiple archives Emacs' package manager picks the package from the archive with the highest priority, and ignores packages in other archives, even if the version number is higher. If the package exists in two archives of the same priority, the higher version number wins, and ultimately I think the order in package-archives.

I recommend to explicitly assign a priority to all archives, including the default GNU ELPA archive, to avoid any ambiguities. Although archives that are not in package-archive-priorities have a default priority of 0, it's all too easy to forget that.

package-archive-priorities was introduced in Emacs 25.1, for earlier releases see the old answer below:


In Emacs 24 it's not possible to default to MELPA Stable and use MELPA only for specific packages in a general way. Without any customization package.el defaults to the archive providing the highest version, which is MELPA. There is no interface to change that.

However, as of Emacs 24.4 the new option package-pinned-packages allows you to pin individual packages to archives, but this only lets you implement the inverse of your requirement: Default to MELPA, and use MELPA Stable for specific packages.

Hence, currently your only option is to fill package-pinned-packages with all packages that you'd like to use, either manually or with some piece of Emacs Lisp code. Note that package-pinned-packages must be set before calling package-refresh-contents because the pinning is evaluated while building the package index, and not when installing packages.

A long-term solution would be to M-x report-emacs-bug to ask the Emacs developers to implement some kind of “default archive” feature, or to ask the maintainer of icicles to make properly tagged releases so that MELPA Stable can build stable packages for it. Neither might turn out to be easy, though, since the former requires larger changes to package.el, and the latter that icicles is moved from EmacsWiki into some proper VCS repository with tags, which I presume its maintainer is not willing to do, for if they were, they would have done it long ago.

0

Here you a have a discussion about using both repositories in parallel, so this should be possible with 24.4; have you tried for example with a defun to update the list of repos, then paradox-require, and finally getting back to the original repo list ?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.