Bug Report: All *-autoloads.el FORM[0] fail with (wrong-type-argument stringp nil) on startup
Environment
- neomacs built from latest commit (macOS aarch64)
- Run command:
RUST_LOG=info ./neomacs > launch.log
Description
During startup, neomacs fails to load every *-autoloads.el file with the same error:
!! popup-autoloads.el FORM[0] FAILED: ;;; popup-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'loa => (wrong-type-argument (stringp nil))
Error message: Error loading autoloads: (wrong-type-argument stringp nil)
Root Cause Analysis
Standard Emacs autoloads files begin with this form:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
Here #$ is the reader macro for load-file-name — the path of the file currently being loaded. In standard Emacs, this is bound to the filename during load/eval-buffer. In neomacs, #$ / load-file-name appears to be nil when autoloads files are loaded via package-activate-1, causing (file-name-directory nil) to signal (wrong-type-argument stringp nil).
Affected files (from log)
All *-autoloads.el in ~/.emacs.d/elpa/ fail, including:
popup-autoloads.el
pos-tip-autoloads.el
chinese-word-at-point-autoloads.el
names-autoloads.el
youdao-dictionary-autoloads.el
yasnippet-autoloads.el
yaml-mode-autoloads.el
which-key-autoloads.el
use-package-autoloads.el
ivy-autoloads.el
slime-autoloads.el
- ... (all installed ELPA packages)
Call Stack (from log)
0: (eval-buffer #<buffer 158> nil "/Users/geekinney/.emacs.d/elpa/popup..." nil ...)
1: (load-with-code-conversion "/Users/geekinney/.emacs.d/elpa/popup..." ...)
2: (load "/Users/geekinney/.emacs.d/elpa/popup..." nil t)
3: (package-activate-1 #s(package-desc popup ...) ...)
4: (package-activate popup)
5: (package-activate-1 #s(package-desc youdao-dictionary ...) ...)
6: (package-activate youdao-dictionary)
7: (package--activate-all)
...
12: (package-activate-all)
13: (command-line)
14: (normal-top-level)
Expected Behavior
load-file-name (i.e. #$) should be bound to the absolute path of the file being loaded during load/load-with-code-conversion/eval-buffer, just as standard Emacs does. This allows (file-name-directory #$) in autoloads files to correctly return the package directory.
Suggested Fix
In neomacs's implementation of load / load-with-code-conversion / eval-buffer, ensure load-file-name is dynamically bound to the filename being loaded before evaluating forms. In standard Emacs C source (lread.c), Vload_file_name is set to the filename at the start of load_internal.
Impact
This causes all third-party ELPA packages to fail loading their autoloads, effectively breaking all user-installed packages at startup.
Bug Report: All
*-autoloads.elFORM[0] fail with(wrong-type-argument stringp nil)on startupEnvironment
RUST_LOG=info ./neomacs > launch.logDescription
During startup, neomacs fails to load every
*-autoloads.elfile with the same error:Error message:
Error loading autoloads: (wrong-type-argument stringp nil)Root Cause Analysis
Standard Emacs autoloads files begin with this form:
Here
#$is the reader macro forload-file-name— the path of the file currently being loaded. In standard Emacs, this is bound to the filename duringload/eval-buffer. In neomacs,#$/load-file-nameappears to benilwhen autoloads files are loaded viapackage-activate-1, causing(file-name-directory nil)to signal(wrong-type-argument stringp nil).Affected files (from log)
All
*-autoloads.elin~/.emacs.d/elpa/fail, including:popup-autoloads.elpos-tip-autoloads.elchinese-word-at-point-autoloads.elnames-autoloads.elyoudao-dictionary-autoloads.elyasnippet-autoloads.elyaml-mode-autoloads.elwhich-key-autoloads.eluse-package-autoloads.elivy-autoloads.elslime-autoloads.elCall Stack (from log)
Expected Behavior
load-file-name(i.e.#$) should be bound to the absolute path of the file being loaded duringload/load-with-code-conversion/eval-buffer, just as standard Emacs does. This allows(file-name-directory #$)in autoloads files to correctly return the package directory.Suggested Fix
In neomacs's implementation of
load/load-with-code-conversion/eval-buffer, ensureload-file-nameis dynamically bound to the filename being loaded before evaluating forms. In standard Emacs C source (lread.c),Vload_file_nameis set to the filename at the start ofload_internal.Impact
This causes all third-party ELPA packages to fail loading their autoloads, effectively breaking all user-installed packages at startup.