Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs package-install inserting extra dash?

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)))
like image 420
Nick Avatar asked Nov 06 '13 02:11

Nick


1 Answers

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.

like image 159
Anthony Avatar answered Nov 05 '22 11:11

Anthony