简体   繁体   English

emacs如何加载软件包?

[英]How does the emacs load the package?

I'm always curious about the loading process of the package in Emacs. 我一直对Emacs中软件包的加载过程感到好奇。 You know, Some packages are builtin packages, and some are third-party packages. 您知道,有些软件包是内置软件包,有些是第三方软件包。
For example, you can install the "auto-complete" package from MELPA or MELPA-STABLE, or you can get the source from github . 例如,您可以从MELPA或MELPA-STABLE安装“自动完成”软件包,也可以从github获取源代码。
If you install the package from MELPA, you will find the package files in "~/.emacs.d/elpa/auto-complete***". 如果从MELPA安装软件包,则可以在“〜/ .emacs.d / elpa / auto-complete ***”中找到软件包文件。

auto-complete-autoloads.el  
auto-complete-config.el  
auto-complete-config.elc  
auto-complete.el  
auto-complete.elc  
auto-complete-pkg.el  
dict;;it's a directory

What does the emacs do for us to install the package? emacs对我们安装软件包有什么作用? It just downloads all the files from MELPA and puts them in "~/.emacs.d/elpa/auto-complete***"? 它只是从MELPA下载所有文件,并将它们放在“〜/ .emacs.d / elpa / auto-complete ***”中? How does the emacs know the existense of the auto-complete-package and load them when you start emacs next time? 下次启动emacs时,emacs如何知道自动完成软件包的存在并加载它们?
I know I should add something to "~/.emacs.d/init.el" if get the source from github. 我知道如果从github获取源代码,我应该在“〜/ .emacs.d / init.el”中添加一些内容。 Maybe like this 也许是这样

(add-to-list 'load-path "path-to-download-folder/auto-complete")
(require 'auto-complete-config)
(ac-config-default)

But I can't see any changes in "init.el" if I install the package from MELPA. 但是,如果我从MELPA安装软件包,则在“ init.el”中看不到任何更改。 Maybe the emacs assign the path of the auto-complete to the variable load-path. 也许emacs将自动完成的路径分配给变量load-path。 But then? 但是之后?
How does the emacs load the package? emacs如何加载软件包? How does it know my "ALT-x + command"? 怎么知道我的“ ALT-x +命令”?
And I really don't know the relationship of these files the emacs downloaded from MELPA and their function. 我真的不知道从MELPA下载的emacs与这些文件的关系及其功能。 Could anyone tell me the whole loading process of a package? 谁能告诉我包裹的整个装载过程吗? What does the emacs do behind us to install the package from MELPA/MELPA-STABLE? emacs在我们身后做什么,以便从MELPA / MELPA-STABLE安装软件包?

Emacs (by default) automatically loads (almost) all the files of the form ~/.emacs.d/elpa/*/*-autoloads.el . Emacs(默认情况下)自动(几乎)加载~/.emacs.d/elpa/*/*-autoloads.el格式的所有文件。 The package's <pkg>-autoloads.el will contain more or less the equivalent of your "add-to-list + require + ...". 软件包的<pkg>-autoloads.el将或多或少地等同于您的“添加到列表+ require + ...”。

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

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