Emacs的启动顺序是什么?

14
我找到了 .emacs 和 ~/.emacs.d/init.el 这两个文件/目录。
这些文件/目录有什么作用? Emacs 的启动顺序是什么?是否有任何方法可以使 Emacs 不读取 ~/.emacs.d ?
4个回答

16

emacs -qemacs --no-init-file会导致Emacs不读取~/.emacs文件。如果存在~/.emacs文件,它不应该尝试读取~/.emacs.d。如果不存在~/.emacs文件,则它将读取~/.emacs.d/init.el。请参见Emacs Wiki获取更多信息。

有关启动信息,请参见Elisp手册


4

Emacs的启动过程在这里有详细解释。 Emacs lisp手册与emacs一起提供,因此您应该咨询它而不是Web上链接的手册,因为前者将完全匹配您的emacs版本。 要访问它,在emacs中输入C-h i m elisp RET m Starting Up RET


3

根据sanityinc的答案,我在~/.emacs.d/init.el、我的个人el文件(smcho.el)和.emacs.el的末尾添加了 (message "* MESSAGE *"),并打开了Messages缓冲区进行了一些实验。

这是Aquamacs的结果。

加载预启动插件文件...
...完成。
Shell: / bin / bash
加载`emulate-mac-keyboard-mode':检测到旧样式反引号!
加载/Users/smcho/Library/Preferences/Aquamacs Emacs/Recent Files.el(源)...完成
清理recentf列表...完成(已删除0个)
27个环境变量从登录shell(/ bin / bash)导入。
加载/Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/auctex.el(源)...完成
加载/Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/haskell-mode/haskell-site-file.el(源)...完成
加载插件...
加载/Library/Application Support/Aquamacs Emacs/SLIME/site-start.el(源)...完成
加载/Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/site-start.el(源)...完成
...完成。
***** 来自.emacs的Hello,并且我使用的是Aquamacs 
***** hello from smcho.el 
加载/Users/smcho/Library/Preferences/Aquamacs Emacs/customizations.el(源)...完成
加载/Users/smcho/Library/Preferences/Aquamacs Emacs/Preferences.el(源)...完成
标记设置
one-buffer-one-frame-mode禁用。
加载/Users/smcho/Library/Preferences/Aquamacs Emacs/frame-positions.el(源)...完成

它从.emacs和smcho.el读取,但不从~/.emacs.d/init.el读取。这是来自Aqua emacs。

加载/Users/smcho/.emacs.d/package.el(源)...完成
***** 来自.emacs的Hello,并且我使用的是Aqua emacs 
***** hello from smcho.el 
要了解GNU Emacs和GNU系统的信息,请键入C-h C-a。

同样没有从~/.emacs.d/init.el读取,但起始点是~/.emacs.d/package.el。


2
如果存在一个 .emacs 文件,那么 Emacs 将不会加载 ~/.emacs.d/init.el 文件。如果您想使用 .emacs.d/init.el 文件,您应该删除 ~/.emacs 文件。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接