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?
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
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.