我在 Windows 上,根据 this startup.el
用于emacs 的启动。但是当我在这个文件中设置代码时(C:\Users\frountch\Progs\emacs24\share\emacs\24.3.50\lisp\startup.el
在我的例子中,在删除 .elc
文件),它不被执行。
例如,我将 defun normal-top-level
更改为:
(defun normal-top-level ()
"Emacs calls this function when it first starts up.
It sets `command-line-processed', processes the command-line,
reads the initialization files, etc.
It is the default value of the variable `top-level'."
(if command-line-processed
(message "Back to top level.")
到
(devar myload (load-path))
(devar myload2 nil)
(defun normal-top-level ()
"fuuuuuuu"
(setq myload2 (load-path))
(if command-line-processed
(message "Back to top level.")
之后,myload
和myload2
都没有定义。
更糟的是,如果我删除 startup.el
和 startup.elc
,emacs 仍然可以启动!
startup.el
真的用了吗?我该如何检查?
如果我定义
(defun normal-top-level ()
"fuuuuu"
(message "fuuu"
)
)
在 startup.el
中(startup.elc
仍然被删除),当我 C-h f
时,帮助窗口仍然显示
normal-top-level is a compiled Lisp function in `startup.el'.
(normal-top-level)
Emacs calls this function when it first starts up. It sets
command-line-processed', processes the command-line, reads the initialization files, etc. It is the default value of the variable
top-level'.
但是当我点击 'startup.el' 时。
它会打开我的 defun(带有 fuuu)!?
这是 Win$ 特有的问题吗?启动真的在二进制文件中吗?
版本是 24.3.50.1
最佳答案
startup.el
不用于标准 Emacs 二进制文件。注意 Startup Summary不建议这样做。没有说源库startup.el
实际上是在启动时加载的。它仅说明 startup.el
中定义的函数在启动时调用。
startup.el
是在编译期间“转储”到 Emacs 二进制文件中的重要核心库之一,以减少启动时间并提高性能。因此,编译后的 Emacs 二进制文件不会加载源库 startup.el
,而是从 Emacs 二进制文件的数据部分读取其编译后的字节码。
然而,startup.el
中的代码 是 Emacs 二进制文件的一部分,并在启动时进行评估。虽然您不能通过修改 startup.el
直接检查它在预编译的 Emacs 发行版中,您可以通过阅读 Emacs 的源代码或通过使用补丁 startup.el
从源代码构建 Emacs 来轻松验证这一点.
这不是 Windows 特有的。在这方面,Emacs 在所有受支持的操作系统上表现相同。
请注意startup.el
不打算由用户修改。使用 ~/.emacs.d/init.el
配置和自定义您的 Emacs。
关于emacs - startup.el真的有用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23103800/