如何在Emacs中加载“package-install”(elpa)安装的软件包?

时间:2014-04-26 02:57:02

标签: emacs emacs24 elpa

我已经在我的Emacs中使用elpa安装了一些软件包,但是在启动Emacs时它们是如何加载的?

1 个答案:

答案 0 :(得分:0)

package-installpackage.el的一部分 - 您可以使用describe-function查看。来自package.el文档:

;; At activation time we will set up the load-path and the info path,
;; and we will load the package's autoloads.  If a package's
;; dependencies are not available, we will not activate that package.

所以在每个包中都有一个文件

NAME-autoloads.el

并在启动时加载此文件。

整个软件包包含在package-user-dir

(setq package-user-dir "~/.emacs.d/site-lisp/package-install")
(require 'package)

每个包还包含NAME-pkg.el包版本和说明。例如,这里是与tabbar包相关的文件:

package-install             # that's my package-user-dir
└── tabbar-2.0.1            # each package dir is in the separate dir
    ├── tabbar-autoloads.el # this file is loaded at start up
    ├── tabbar.el           # the package itself. In this case it is just a single file
    └── tabbar-pkg.el       # information about the package for package managment

引用手册:39.1.1 Summary: Sequence of Actions at Startup

  

15。如果package-enable-at-startup为非nil,则调用函数package-initialize来激活已安装的任何可选Emacs Lisp软件包。

package-initialize然后调用package-activate,然后调用package-activate-1,以加载NAME-autoload.el结束:

(load (expand-file-name (concat name "-autoloads") pkg-dir) nil t)
相关问题