ELPA背后有什么魔力? [英] What's the magic behind the ELPA?
问题描述
这个ELPA有什么魔力?我的意思是,没有ELPA,我应该下载并安装包在特定的目录,并添加这两行.emacs。
add-to-list'load-pathPACKAGE_DIRECTORY)
(require'PACKAGE)
但是,使用ELPA,我没有看到任何添加到.emacs或/ Users / smcho / Library / Preferences / Aquamacs Emacs / {Preferences.el,customizations.el}中。这怎么可能?
添加
这是我用Aquamacs发现的。
$ b $ Aquamacs读取〜/ Preference / Aquamacs Emacs / Preference,它具有(add-to-list'load-path kitfiles-dir)(require'init),它读取开始
我猜初始化文件没有改变,但是包管理器读取〜/ .emacs.d / elpd / *可以自动初始化,因为我看到每个都有*** - autoloads.el。
已添加2
使用emacs 24,似乎该包是预先构建的。我只需要在.emacs或.emacs.d / init.el中使用这些行来获取ELPA的工作。来自本网站的提示。
(require'package)
(add-to-list'package-archives
'(marmaladehttp:
(package-initialize)
(当(不是包存档内容)
(package-refresh-contents))
(defvar my-packages'(clojure-mode
nrepl))
(dolist(p my-packages)
(when(not(package-installed-p p))
(package-install p)))
(package-initialize)
将通过所有安装的软件包(在〜/ .emacs.d / elpa /
或类似的,取决于配置),并将它们添加到加载路径。一个你运行它,看看 load-path
( Ch v load -path
),它将添加所有这些子目录。所以在这一点上,文件加载会使用正常的机制。
I use Aquamacs, and I use ELPA that installs files in ~/.emacs.d/elpa?
What's the magic behind this ELPA? I mean, without ELPA, I should download and install the packages in a specific directory, and add those two lines in .emacs.
(add-to-list 'load-path "PACKAGE_DIRECTORY")
(require 'PACKAGE)
But, with ELPA, I don't see anything added to .emacs or /Users/smcho/Library/Preferences/Aquamacs Emacs/{Preferences.el, customizations.el}. How is this possible?
Added
This is what I found with Aquamacs.
- Aquamacs reads ~/Preference/Aquamacs Emacs/Preference, and it has "(add-to-list 'load-path kitfiles-dir)(require 'init)", which reads start kit.
- The init.el of start kit has the "(require 'package)(package-initialize)"
- ~/Library/Preferences/Aquamacs Emacs/aquamacs-emacs-starter-kit/vendor has the package.el
I guess the initialization files are not changed, but the package manager reads the ~/.emacs.d/elpd/* to initialize automatically, as I see ***-autoloads.el in each of it.
Added2
With emacs 24, it seems that package is pre-built. I need only to have these lines in .emacs or .emacs.d/init.el to get ELPA working. Hints from this site.
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar my-packages '(clojure-mode
nrepl))
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
(package-initialize)
will go through all the installed packages (in ~/.emacs.d/elpa/
or similar, depending on configuration), and add them to the load path. One you have run it, take a look at load-path
(C-hvload-path
), it will have all those subdirectories added. So at this point, file loading will use the normal mechanisms.
这篇关于ELPA背后有什么魔力?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!