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
+28
View File
@@ -0,0 +1,28 @@
;;; config-linux.el --- Linux-specific configuration -*- lexical-binding: t; -*-
;; Loaded from config.el on GNU/Linux machines only; config-mac.el is the
;; macOS counterpart. Anything with a Linux path, a Linux binary, or a
;; backend that only exists on this box belongs here rather than in the
;; shared config.el.
;;
;; Machine-specific settings that should not be committed at all (API keys,
;; checkouts in unusual places) belong in config-local.el, which is
;; gitignored -- see config-local.example.el.
;; Elixir language server. The shared config.el used to point eglot at a
;; macOS path (/Users/willem/.elixir-ls/...), which was silently dead here.
;; Prefer `expert' if it is installed, else any elixir-ls on PATH, else
;; leave eglot alone rather than configuring a server that cannot start.
(with-eval-after-load 'eglot
(let ((server (cond ((executable-find "expert")
'("expert" "--stdio"))
((executable-find "language_server.sh")
(list (or (executable-find "bash") "sh")
(executable-find "language_server.sh"))))))
(when server
(setf (alist-get '(elixir-mode elixir-ts-mode heex-ts-mode)
eglot-server-programs
nil nil #'equal)
server))))
;;; config-linux.el ends here