diff --git a/config-mac.el b/config-mac.el index d548f35..2b2fff4 100644 --- a/config-mac.el +++ b/config-mac.el @@ -209,12 +209,23 @@ Returns answer with org-roam links to sources." (when yas-was-active (yas-minor-mode 1))) (message "No @glm-search or @gptel-search query found on current line")))) -;; Elixir language server. Moved out of the shared config.el, where this -;; macOS path was hard-coded and therefore dead on any other machine. +;; Elixir language server. Moved out of the shared config.el (where a +;; hard-coded macOS path leaked to Linux); that ~/.elixir-ls checkout no +;; longer exists on this machine either. Mirrors config-linux.el: prefer +;; `expert' if it is installed, else any elixir-ls on PATH, else leave eglot +;; alone rather than configuring a server that cannot start. Covers all +;; three Elixir modes, including heex-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")))) + (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)))) ;; Blog export destinations. Kept in this file rather than in the shared ;; config.el because the jekyll checkout sits under ~/MyDocuments on macOS and