refactor: split shared config from OS-specific config

Introduces the seam that makes adopting upstream changes safe: config.el
holds what every machine shares, and a pcase on `system-type` at the end of
it loads exactly one OS file.  Leaves are loaded last on purpose, so they
can override shared settings such as `gptel-backend'.

  config-mac.el    seeded from mac repo 0789326 and now owned locally
  config-linux.el  new; Linux paths and binaries only
  config-local.el  per-machine, gitignored (template: config-local.example.el)

Nothing changes for the current machine.  The one line that moved -- the
eglot entry pointing elixir-ts-mode at /Users/willem/.elixir-ls/... -- was
already dead on Linux; it now lives in config-mac.el, and config-linux.el
picks `expert', any elixir-ls on PATH, or nothing at all, in that order.

Rationale: upstream already ships this exact layout (236c0e1 "refactor
config for multi-machine support"), so adopting it costs nothing and every
later upstream hunk then has an obvious correct home -- shared, mac, linux,
or not-committed.

Verified: parens/strings parse in all five .el files; `load!' arity checked
against doom-lib.el (filename &optional path noerror).
This commit is contained in:
Willem van den Ende
2026-11-03 12:25:12 +00:00
parent a06bb22444
commit a3b0c3d6e2
3 changed files with 267 additions and 2 deletions
+20 -2
View File
@@ -185,8 +185,8 @@
'((elixir-mode . elixir-ts-mode)))
)
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs '(elixir-ts-mode . ("sh" "/Users/willem/.elixir-ls/release/language_server.sh" ))))
;; The eglot server for elixir-ts-mode is OS-specific; see config-mac.el and
;; config-linux.el.
(use-package
elixir-ts-mode
@@ -204,3 +204,21 @@
(push '("<-" . ?\u2190) prettify-symbols-alist)
(push '("|>" . ?\u25B7) prettify-symbols-alist)))
(before-save . eglot-format))
;;; Machine-specific configuration
;;
;; Everything above is shared by every machine. Anything below is not: the
;; two files below hold paths, binaries and backends that only make sense on
;; one OS. They are loaded last so they can override the shared settings
;; above (e.g. `gptel-backend').
;;
;; Per-machine secrets and unusual checkout locations go in config-local.el,
;; which is gitignored. Copy config-local.example.el to get started.
(pcase system-type
('darwin (load! "config-mac.el" doom-user-dir t))
('gnu/linux (load! "config-linux.el" doom-user-dir t)))
(when (file-exists-p (expand-file-name "config-local.el" doom-user-dir))
(load! "config-local.el" doom-user-dir t))
;;; config.el ends here