繁体   English   中英

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

[英]How are the packages installed with 'package-install'(elpa) in Emacs loaded?

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

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 ,最后以加载NAME-autoload.el结束:

(load (expand-file-name (concat name "-autoloads") pkg-dir) nil t)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM