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 repo0789326and 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).
225 lines
8.8 KiB
EmacsLisp
225 lines
8.8 KiB
EmacsLisp
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
|
|
|
;; Place your private configuration here! Remember, you do not need to run 'doom
|
|
;; sync' after modifying this file!
|
|
|
|
|
|
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
|
;; clients, file templates and snippets. It is optional.
|
|
;; (setq user-full-name "John Doe"
|
|
;; user-mail-address "john@doe.com")
|
|
|
|
;; Doom exposes five (optional) variables for controlling fonts in Doom:
|
|
;;
|
|
;; - `doom-font' -- the primary font to use
|
|
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
|
|
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
|
;; presentations or streaming.
|
|
;; - `doom-symbol-font' -- for symbols
|
|
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
|
|
;;
|
|
;; See 'C-h v doom-font' for documentation and more examples of what they
|
|
;; accept. For example:
|
|
;;
|
|
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
|
|
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
|
|
;;
|
|
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
|
|
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
|
|
;; refresh your font settings. If Emacs still can't find your font, it likely
|
|
;; wasn't installed correctly. Font issues are rarely Doom issues!
|
|
|
|
;; There are two ways to load a theme. Both assume the theme is installed and
|
|
;; available. You can either set `doom-theme' or manually load a theme with the
|
|
;; `load-theme' function. This is the default:
|
|
(setq doom-theme 'leuven)
|
|
|
|
;; This determines the style of line numbers in effect. If set to `nil', line
|
|
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
|
(setq display-line-numbers-type `relative)
|
|
|
|
;; If you use `org' and don't want your org files in the default location below,
|
|
;; change `org-directory'. It must be set before org loads!
|
|
(setq org-directory "~/Documents/qwan/essays/willem/")
|
|
(setq org-roam-directory "~/Documents/qwan/essays/willem/" )
|
|
|
|
;; Speed up clock work, possibly
|
|
(setq org-clock-clocked-in-display nil)
|
|
|
|
|
|
;; mostalive custom additions to org-roam
|
|
(add-load-path! "~/dev/emacs/org-roaming")
|
|
(require 'my-org-roam)
|
|
|
|
(add-load-path! "~/.config/doom/qwan")
|
|
|
|
(require 'qwan-blog)
|
|
(require 'qwan-refactor)
|
|
(require 'firehose-blog)
|
|
|
|
|
|
;; Whenever you reconfigure a package, make sure to wrap your config in an
|
|
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
|
|
;;
|
|
;; (after! PACKAGE
|
|
;; (setq x y))
|
|
;;
|
|
;; The exceptions to this rule:
|
|
;;
|
|
;; - Setting file/directory variables (like `org-directory')
|
|
;; - Setting variables which explicitly tell you to set them before their
|
|
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
|
|
;; - Setting doom variables (which start with 'doom-' or '+').
|
|
;;
|
|
;; Here are some additional functions/macros that will help you configure Doom.
|
|
;;
|
|
;; - `load!' for loading external *.el files relative to this one
|
|
;; - `use-package!' for configuring packages
|
|
;; - `after!' for running code after a package has loaded
|
|
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
|
;; this file. Emacs searches the `load-path' when you load packages with
|
|
;; `require' or `use-package'.
|
|
;; - `map!' for binding new keys
|
|
;;
|
|
;; To get information about any of these functions/macros, move the cursor over
|
|
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
|
;; This will open documentation for it, including demos of how they are used.
|
|
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
|
|
;; etc).
|
|
;;
|
|
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
|
;; they are implemented.
|
|
;; https://yannesposito.com/posts/0029-ai-assistants-in-doom-emacs-31-on-macos-with-clojure-mcp-server/index.html
|
|
;; LLM
|
|
(use-package! gptel
|
|
:init
|
|
;; declare the default llm configuration
|
|
;; for me this is co-pilot with claude-sonnet-4
|
|
(setq gptel-default-mode 'org-mode ;; I want the llm to reply to me with org-mode format.
|
|
gptel-backend
|
|
(gptel-make-ollama "Ollama"
|
|
:host "localhost:11434"
|
|
:stream t
|
|
|
|
:models '(hf.co/unsloth/Qwen3-30B-A3B-Thinking-2507-GGUF:UD-Q4_K_XL
|
|
qwen3:0.6B
|
|
gpt-oss:20b
|
|
(qwen3-coder:30b ;Full spec
|
|
:description
|
|
"qwen3 coder large coding model "
|
|
:capabilities (tools media)
|
|
:mime-types ("image/jpeg" "image/png" "image/svg"))))
|
|
gptel-model 'gpt-oss:20b)
|
|
|
|
|
|
|
|
(setq gptel-include-reasoning "*gptel-reasoning*")
|
|
(require 'gptel-integrations) ;; <- for mcp
|
|
;; declare another llm configuration, I also use Ollama to easily use multiple smaller models that don't require
|
|
;; max speed or the latest API.
|
|
;; Do not use chatgpt as default. took long to find.
|
|
(gptel-make-openai "llama.cpp"
|
|
:host "localhost:8000"
|
|
:protocol "http"
|
|
:stream t
|
|
:models '(Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf))
|
|
|
|
(gptel-make-openai "llama.cpp on mac"
|
|
:host "MacBook-Pro-3.local:8000"
|
|
:protocol "http"
|
|
:stream t
|
|
:models '(Qwen3-Coder-Next-UD-Q4_K_XL))
|
|
|
|
(gptel-make-openai "MTPLX on mac"
|
|
:host "mb:8001"
|
|
:protocol "http"
|
|
:key "REDACTED-MTPLX-API-KEY-NOT-A-SECRET"
|
|
:stream t
|
|
:models '(mtplx-qwen38-27b-optimized-speed))
|
|
(set-default gptel-model 'mtplx-qwen38-27b-optimized-speed))
|
|
|
|
;; Whisper speech-to-text via Lemonade server (OpenAI-compatible API)
|
|
(add-load-path! "lisp")
|
|
(autoload #'live-dictate "live-dictate" nil t)
|
|
|
|
(use-package! whisper
|
|
:commands (whisper-run whisper-file whisper-select-language)
|
|
:init
|
|
(map! :leader
|
|
(:prefix ("A" . "+ai")
|
|
:desc "Whisper record/transcribe" "w" #'whisper-run
|
|
:desc "Whisper transcribe file" "W" #'whisper-file
|
|
:desc "Whisper select language" "l" #'whisper-select-language
|
|
:desc "Live dictate (streaming)" "d" #'live-dictate))
|
|
:config
|
|
(setopt whisper-install-whispercpp nil ; no whisper.cpp needed, remote API only
|
|
whisper-server-mode 'openai ; use OpenAI-compatible transcription API
|
|
whisper-openai-api-baseurl "http://localhost:13305/"
|
|
whisper-openai-api-key "not-needed" ; Lemonade ignores auth, but whisper.el requires a non-nil key
|
|
whisper-openai-model "Whisper-Large-v3-Turbo"
|
|
whisper-language "en"
|
|
whisper-translate nil ; t would POST to /translations instead
|
|
whisper-return-cursor 'end))
|
|
|
|
;; elixir
|
|
;; inspiration https://medium.com/@victor.nascimento/elixir-emacs-development-2023-edition-1a6ccc40629
|
|
(use-package
|
|
emacs
|
|
:ensure nil
|
|
:custom
|
|
|
|
;; Should use:
|
|
;; (mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist))
|
|
;; at least once per installation or while changing this list
|
|
(treesit-language-source-alist
|
|
'((heex "https://github.com/phoenixframework/tree-sitter-heex")
|
|
(elixir "https://github.com/elixir-lang/tree-sitter-elixir")
|
|
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
|
|
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")))
|
|
|
|
;; Install grammars if not present
|
|
(dolist (lang '(typescript tsx))
|
|
(unless (treesit-language-available-p lang)
|
|
(treesit-install-language-grammar lang)))
|
|
(major-mode-remap-alist
|
|
'((elixir-mode . elixir-ts-mode)))
|
|
)
|
|
|
|
;; The eglot server for elixir-ts-mode is OS-specific; see config-mac.el and
|
|
;; config-linux.el.
|
|
|
|
(use-package
|
|
elixir-ts-mode
|
|
:hook (elixir-ts-mode . eglot-ensure)
|
|
(elixir-ts-mode
|
|
.
|
|
(lambda ()
|
|
(push '(">=" . ?\u2265) prettify-symbols-alist)
|
|
(push '("<=" . ?\u2264) prettify-symbols-alist)
|
|
(push '("!=" . ?\u2260) prettify-symbols-alist)
|
|
(push '("==" . ?\u2A75) prettify-symbols-alist)
|
|
(push '("=~" . ?\u2245) prettify-symbols-alist)
|
|
(push '("<-" . ?\u2190) prettify-symbols-alist)
|
|
(push '("->" . ?\u2192) prettify-symbols-alist)
|
|
(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
|