From c8a4303711e1cd27c52be67c613f46b08ee9f607 Mon Sep 17 00:00:00 2001 From: Willem van den Ende Date: Sat, 14 Nov 2026 14:27:22 +0000 Subject: [PATCH] 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..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. --- agent-start-here.md | 12 ++++++++++++ config.el | 22 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/agent-start-here.md b/agent-start-here.md index 098ec46..64285aa 100644 --- a/agent-start-here.md +++ b/agent-start-here.md @@ -33,6 +33,18 @@ checks; the `alist-get`/`setf` pattern unit-tested in vanilla Emacs 30.2. the human asks. - Never run `git clean`. The root `init.el` is an untracked, gitignored symlink; `git clean -xfd` deletes it. Recreate with `./bin/link-machine.sh`. +- **Never run `doom sync` without a root `init.el`.** Doom loads `init.el` + with NOERROR, so a missing symlink is not an error: `doom!` never runs, + Doom regenerates `$EMACSDIR/.local/etc/@/init..el` (the + generated startup file) with a `doom-modules` table containing only + `:doom`/`:user`/`:doom compat`, and from then on **no module packages are + on `load-path`** — `(require 'org-roam)` dies, module config/init files + don't load, and every setting after the failing form in `config.el` + silently stops working. `doom doctor` still looks healthy apart from that + one error. Always `./bin/link-machine.sh` first, then `doom sync`. + To check: `grep -l '(:lang . org)' ~/.emacs.d/.local/etc/@/init.*.el` + must list the file for your Emacs version. This is what broke org-roam + on 2026-11-05 and again on 2026-11-14. - Never commit `init.el`, `custom.el`, `config-local.el`, or `*.elc`. - `config.el` and `packages.el` are shared by both machines. Prefer `config-mac.el` / `config-linux.el` for machine-specific work. diff --git a/config.el b/config.el index 56d8e6a..ef5f0ea 100644 --- a/config.el +++ b/config.el @@ -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..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))) +