Below is an example of the situation described in the question's title, using the variable prolog-mode-version
as test case.
If my Emacs init file consists of just the code shown below:
(defun show-pmv (hook-name)
(let ((pmv (if (boundp 'prolog-mode-version)
prolog-mode-version
"undefined")))
(message "%s: prolog-mode-version: %s" hook-name pmv)))
(add-hook 'after-init-hook (lambda () (show-pmv "after-init")))
(add-hook 'emacs-startup-hook (lambda () (show-pmv "emacs-startup")))
(add-hook 'window-setup-hook (lambda () (show-pmv "window-setup")))
(setq inhibit-startup-screen t)
(switch-to-buffer "*Messages*")
...and I start up Emacs, my *Messages*
buffer contains the following
after-init: prolog-mode-version: undefined
For information about GNU Emacs and the GNU system, type C-h C-a.
emacs-startup: prolog-mode-version: undefined
window-setup: prolog-mode-version: undefined
...but if, right after startup, I inspect the value of prolog-mode-version
(using C-h v
), I get a non-void value ("1.22"
).
The variable prolog-mode-version
is not an isolated case. In fact, many other symbols defined in prolog.el
seem to be available right after startup, even though my init file does not load/require this package.
I find this extremely confusing.
Why do symbols that were void during startup become suddenly defined right after startup?
Conversely, is there some way for my init file to access the value of prolog-mode-version
?
(Related.)
C-h v
might be triggering the load. See also Bug#25552. – npostavs Feb 27 '17 at 16:01#'add-hook
, you put(require 'prolog-mode)
? – zck Feb 27 '17 at 16:17