我已经在我的Emacs中使用elpa安装了一些软件包,但是在启动Emacs时它们是如何加载的?
答案 0 :(得分:0)
package-install
是package.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)