问题
I'm trying to have all of my dependencies install automatically for a new Emacs install. When I put the snippet below in my .emacs I keep getting: Package `smex-' is unavailable.
I was wondering if this is expected functionality? The Emacs starter-kit did something similar which I remember working before. Using Emacs 24.3.
(when (not package-archive-contents)
(package-refresh-contents))
(defvar my-packages
'(smex))
(dolist (p my-packages)
(let ((s (symbol-name p)))
(when (not (package-installed-p s))
(package-install s))))
EDIT
Apparently this was caused by a bug or something. I was able to get it to work now in latest Emacs 24.3.1. Apparently they've also changed it so that package names should be symbols.
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar my-packages
'(list of packages))
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
回答1:
See package-compute-transaction
:
(error "Package `%s-%s' is unavailable"
(symbol-name next-pkg)
(package-version-join next-version))
回答2:
I encountered this issue when I was using
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/"))
after calling (package-initialize)
. If I execute
(setq package-archives '(("melpa" . "http://melpa.milkbox.net/packages/")
("gnu" . "http://elpa.gnu.org/packages/")))
before (package-initialize)
, then the automated installation logic is able to install missing packages.
来源:https://stackoverflow.com/questions/19802757/emacs-package-install-inserting-extra-dash