我正在使用This建议,试图让Emacs为我管理我的软件包。我无法让Emacs评估这段代码,它应该安装我的所有软件包,但目前它绝对没有。我的elisp中是否有一些我没有看到的错误?
;;; Emacs is not a package manager, and here we load its package manager!
(require 'package)
(dolist (source '(("marmalade" . "http://marmalade-repo.org/packages/")
("elpa" . "http://tromey.com/elpa/")
;; TODO: Maybe, use this after emacs24 is released
;; (development versions of packages)
("melpa" . "http://melpa.milkbox.net/packages/")
))
(add-to-list 'package-archives source t))
(package-initialize)
;;; Required packages
;;; everytime emacs starts, it will automatically check if those packages are
;;; missing, it will install them automatically
(when (not package-archive-contents)
(package-refresh-contents))
(defvar tmtxt/packages
'(evil git-gutter monokai-theme magit markdown-mode evil-leader jedi evil-surround arduino-mode evil-nerd-commenter zeal-at-point))
(dolist (p tmtxt/packages)
(lambda ()
(when (not (package-installed-p p))
(package-install p))
(require p)))
答案 0 :(得分:3)
dolist
的主体仅仅是“lambda-expression”,即它立即评估为立即丢弃的函数。由于您希望执行函数体,只需删除(lambda () ...)
包装器:
(dolist (p tmtxt/packages)
(when (not (package-installed-p p))
(package-install p))
(require p))