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
C-h v), I get a non-void value (
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