Pergunta

I'm on windows, and according to this startup.el is used at the startup of emacs. But when I set code in this file (C:\Users\frountch\Progs\emacs24\share\emacs\24.3.50\lisp\startup.el in my case, after deleting the .elc file), it is not executed.

For instance I change the defun normal-top-level from:

(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.")

to

(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.")

After that, myload and myload2 are not defined.

Worse, if I delete startup.el and startup.elc, emacs can still be launched!

Is startup.el really used? How can I check that?

If I define

(defun normal-top-level ()
"fuuuuu"
  (message "fuuu"
  )
  )

in startup.el (startup.elc still deleted), when I C-h f, the help windows still shows

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'.

But when I click on 'startup.el'. it opens my defun (with fuuu)!?

Is this a Win$ specific problem? is the startup really inside the binary?

version is 24.3.50.1

Foi útil?

Solução

startup.el isn't used in a standard Emacs binary. Note that Startup Summary doesn't suggest this. It doesn't say that the source library startup.el is actually loaded during startup. It merely states that a function defined in startup.el is called at startup.

startup.el is one of the essential core libraries that are “dumped” into the Emacs binary during compilation, to decrease startup time and increase performance. Hence, the compiled Emacs binary does not load the source library startup.el, but instead reads its compiled byte code from the data section of the Emacs binary.

Yet, the code in startup.el is part of an Emacs binary, and evaluated at startup. While you can't check this directly by modifying startup.el in a precompiled Emacs distribution, you can easily verify this by reading the source code of Emacs, or by building Emacs from source with a patched startup.el.

This is not specific to Windows. In this regard, Emacs behaves the same on all supported operating systems.

Please note that startup.el is not intended to be modified by the user. Use ~/.emacs.d/init.el to configure and customize your Emacs.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top