fix(config): stop a stale module list from silently disabling config.el

A `doom sync` run while the root init.el symlink was missing regenerates
Doom's profile startup file (.local/etc/@/init.<ver>.el) with a
doom-modules table holding only :doom/:user/:doom compat. No module
package lands on load-path, so `(require 'org-roam)` signalled
"cannot open load file" and aborted config.el mid-file -- taking the
OS leaf, the map! bindings and config-local.el with it, while
`doom doctor` reported nothing else.

- config.el: load org-roam with NOERROR, so a missing package can no
  longer truncate the rest of the file.
- config.el: tripwire at the end that raises an error-level warning when
  :lang org is absent from doom-modules, naming the real fix
  (./bin/link-machine.sh && doom sync).
- agent-start-here.md: document that init.el is loaded with NOERROR, so
  syncing without the symlink is silent and destructive, plus the
  one-line check for the generated startup file.
This commit is contained in:
Willem van den Ende
2026-11-14 14:27:22 +00:00
parent bd8622756e
commit c8a4303711
2 changed files with 33 additions and 1 deletions
+21 -1
View File
@@ -43,7 +43,13 @@
(setq org-roam-directory "~/MyDocuments/qwan/essays/willem")
; (define-key org-roam-mode-map [mouse-1] #'org-roam-visit-thing)
(require 'org-roam)
;; `+roam` makes org-roam a module dependency, so this is normally a no-op.
;; Keep it NOERROR: a top-level `require' failure aborts the rest of this file,
;; which silently kills everything below it (the OS leaf, the map! bindings,
;; and config-local.el). That is exactly what happened when a `doom sync'
;; without a root `init.el' regenerated Doom's module list as empty and
;; org-roam fell off the load-path. See agent-start-here.md.
(require 'org-roam nil t)
(setq mastodon-instance-url "https://mastodon.social"
mastodon-active-user "mostalive")
@@ -375,3 +381,17 @@
(when (file-exists-p! "config-local.el" doom-user-dir)
(load! "config-local.el" doom-user-dir t))
;; Sanity tripwire: if Doom's generated module list is empty (it is cached in
;; $EMACSDIR/.local/etc/@/init.<emacs-version>.el and regenerated only by
;; `doom sync'), no module packages are on the load-path and half this file
;; silently does nothing. Say so loudly instead.
(when (and (boundp 'doom-modules) (hash-table-p doom-modules)
(not (doom-module-get '(:lang . org) :path)))
(display-warning
'(doom startup)
(format (concat "Doom started with no modules enabled (:lang org missing)!\n"
"Doom's generated startup file is stale -- most likely a "
"`doom sync' ran with no root init.el.\n"
"Fix: ./bin/link-machine.sh && doom sync, then restart Emacs.")
:error)))