Skip to main content
deleted 488 characters in body
Source Link

After some experimenting, it seems to me that (as long as I've doneThere is a package-refresh-contentsfeature in Emacs 25.1 that does what I want, by allowing you to downloadset priorities for the melpa packages) Iarchives you specify. So you can dynamically modify package-archives:say

(defun install-from-melpa (&rest packages) "Install PACKAGES from melpa" (let ((orig-package-archivessetq package-archives)) (unwindarchive-protect (prognpriorities   '(add-to-list 'package-archives (assoc "melpa" package-archive"melpa-list)) (mapcstable" #'(lambda. (package20)   (unless"marmalade" (package-installed-p. package20)   (package-install package))) packages) "gnu" . 10) (setq"melpa" package-archives. orig-package-archives)0))) 

That's pretty complex elisp for my level of understanding, thoughThis will then install packages from the highest-priority archive they are available in. So with the above, somelpa will only be used if anyone could confirm that it works as I expect, that'da package can't be great (I've testedfound in any of the idea interactively, but that's all so far)other archives.

After some experimenting, it seems to me that (as long as I've done a package-refresh-contents to download the melpa packages) I can dynamically modify package-archives:

(defun install-from-melpa (&rest packages) "Install PACKAGES from melpa" (let ((orig-package-archives package-archives)) (unwind-protect (progn   (add-to-list 'package-archives (assoc "melpa" package-archive-list)) (mapc #'(lambda (package)   (unless (package-installed-p package)   (package-install package))) packages)  ) (setq package-archives orig-package-archives)))) 

That's pretty complex elisp for my level of understanding, though, so if anyone could confirm that it works as I expect, that'd be great (I've tested the idea interactively, but that's all so far).

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.

Source Link

After some experimenting, it seems to me that (as long as I've done a package-refresh-contents to download the melpa packages) I can dynamically modify package-archives:

(defun install-from-melpa (&rest packages) "Install PACKAGES from melpa" (let ((orig-package-archives package-archives)) (unwind-protect (progn (add-to-list 'package-archives (assoc "melpa" package-archive-list)) (mapc #'(lambda (package) (unless (package-installed-p package) (package-install package))) packages) ) (setq package-archives orig-package-archives)))) 

That's pretty complex elisp for my level of understanding, though, so if anyone could confirm that it works as I expect, that'd be great (I've tested the idea interactively, but that's all so far).