21

我正在尝试将 Marmalade 添加为包源,但是当我这样做时出现错误:Symbol's value as variable is void: package-archives.有人知道如何解决这个问题吗?下面是我的.emacs文件。

;;; 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)

安装 package.el

我运行了以下代码:

(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))))
4

1 回答 1

13

使用 package.el 包含在 emacs24 中,因为 ELPA 版本不包含package-archives和支持多个存储库。

它可以在这里找到(emacs24!):http ://bzr.savannah.gnu.org/lh/emacs/trunk/annotate/head:/lisp/emacs-lisp/package.el

最后一个emacs23兼容版本:http ://repo.or.cz/w/emacs.git/blob/ba08b24186711eaeb3748f3d1f23e2c2d9ed0d09:/lisp/emacs-lisp/package.el

将其放入您的加载路径并满足一种类型的加载(即删除注释后的行)。

于 2011-09-02T19:36:47.260 回答