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))) +