3

For my main package loading, I want to use melpa-stable. There's at least one package (dash) that I know breaks my config if I use the melpa version. That's fine - I've no problem using melpa-stable as my default archive.

But there are some packages I need to get from melpa - specifically sublime-themes. Obviously I could download that package manually and install it somewhere in my load-path, but I'd prefer to use the package manager (and I'd also like to do so from elisp, so I can have my init.el install it if it's not present, for when I go to a new machine).

Is it possible to say "use this archive for this package, but don't use it for other packages"?

2
  • You can add melpa to your list of archives but give it a priority of -100 so it will not be used automatically
    – YoungFrog
    May 15, 2016 at 11:53
  • Thanks. I just found this myself. I believe this is a new feature in Emacs 25.1, but that's fine for me as I don't expect to be using older versions with my config.
    – Paul Moore
    May 15, 2016 at 12:42

2 Answers 2

3

There is a feature in Emacs 25.1 that does what I want, by allowing you to set priorities for the archives you specify. So you can say

(setq package-archive-priorities
      '(("melpa-stable" . 20)
        ("marmalade" . 20)
        ("gnu" . 10)
        ("melpa" . 0)))

This will then install packages from the highest-priority archive they are available in. So with the above, melpa will only be used if a package can't be found in any of the other archives.

2

Yes you can! It is called pinning. If you use use-package its as easy as

(use-package sublime-themes
       :ensure t
       :pin melpa-stable)

otherwise you can set package-pinned-packages to ((sublime-themes . "melpa-stable")) more info can be found here

2
  • 1
    Isn't that the wrong way round? I want to use melpa (not stable) only for sublime-themes, but not for any other packages. With pinning, wouldn't I need melpa in my archive list and pin everything except sublime-themes? Or am I missing something?
    – Paul Moore
    May 13, 2016 at 21:45
  • Ooooh yes I had mis-read my bad. The reason that normally melpa is prioritized is that the package number is usually greater than the melpa-stable package number
    – Jules
    May 16, 2016 at 15:15

Your Answer

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

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