emacs - startup.el真的有用吗?

标签 emacs config

我在 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.")

之后,myloadmyload2 都没有定义。

更糟的是,如果我删除 startup.elstartup.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/

相关文章:

.htaccess - 共享主机帐户中的 php.ini 配置更改

configuration - 在我自己的自定义 appSettings 上使用 foreach 所需的代码

apache-spark - 如何在独立主机中并行运行多个Spark应用程序

xml - Elisp 解析 XML,然后搜索特定值

Emacs 口齿不清 : get RGB components of face?

emacs - 如何在发布时不让 Emacs Org 模式转换特定的外部链接?

emacs - 无法移动到 Emacs 中的上一个点

git - 动态 git 配置 user.name - 取决于主机名

java - Java 和 JavaScript 中的 'Go to definition' 如何使用 Emacs?

laravel-5 - 您的配置文件不可序列化