Adding Marmalade as Package Source

kin1 picture kin1 · Sep 2, 2011 · Viewed 14.6k times · Source

I'm trying to add Marmalade as a package source, but when I do so I get the error:Symbol's value as variable is void: package-archives. Anyone know how to resolve this? Below is my .emacs file.

;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
    (load
     (expand-file-name "~/.emacs.d/elpa/package.el"))
  (package-initialize))

(add-to-list 'load-path (expand-file-name "~/.emacs.d"))
(add-to-list 'load-path  "~/.emacs.d/plugins")
(add-to-list 'load-path "~/.emacs.d/plugins/color-theme")
(add-to-list 'load-path "~/.emacs.d/plugins/groovy")

(require 'package)
(add-to-list 'package-archives
         '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)

To install package.el

I ran the following code:

(let ((buffer (url-retrieve-synchronously
           "http://tromey.com/elpa/package-install.el")))
  (save-excursion
    (set-buffer buffer)
    (goto-char (point-min))
    (re-search-forward "^$" nil 'move)
    (eval-region (point) (point-max))
    (kill-buffer (current-buffer))))

Answer

Michael Markert picture Michael Markert · Sep 2, 2011

Use the package.el to be included with emacs24, as the ELPA version doesn't include package-archives and support for multiple repositories.

It is found here (emacs24!): http://bzr.savannah.gnu.org/lh/emacs/trunk/annotate/head:/lisp/emacs-lisp/package.el

Last emacs23 compatible version: http://repo.or.cz/w/emacs.git/blob/ba08b24186711eaeb3748f3d1f23e2c2d9ed0d09:/lisp/emacs-lisp/package.el

Drop it into your loadpath and settle for one type of loading (that is drop the lines after the comment).