添加橘子酱作为包源

kin*_*in1 21 emacs emacs23 elpa

我正在尝试添加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)
Run Code Online (Sandbox Code Playgroud)

安装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))))
Run Code Online (Sandbox Code Playgroud)

Mic*_*ert 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

将它放入你的加载路径并解决一种类型的加载(即在评论后删除行).

  • 哦,我忘记了,几个月前向后兼容性被破坏,我在我的帖子中添加了最后一个emacs23兼容版本.至于drop:只是`when`并且如果你想保留路径,用`load`替换`require`. (2认同)