0

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

4

1 回答 1

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 摘要:启动时的操作顺序

15. 如果 package-enable-at-startup 不为 nil,它会调用函数 package-initialize 来激活任何已安装的可选 Emacs Lisp 包。

package-initialize然后调用package-activate它,然后调用package-activate-1它以 loading 结束NAME-autoload.el

(load (expand-file-name (concat name "-autoloads") pkg-dir) nil t)
于 2014-04-26T04:55:42.910 回答