Files
dotemacs/config.el
T
Willem van den Ende f687a18806 adopt: wire org-roam blog export; move its roots into the OS files
config.el        require org-roam-export-blog; SPC n r b / SPC n r j
  config-linux.el  firehose ~/dev/elixir/firehose, jekyll ~/Documents/...
  config-mac.el    firehose ~/dev/elixir/firehose, jekyll ~/MyDocuments/...

Upstream sets both roots in the shared config.el.  That does not survive the
trip: the jekyll checkout is ~/MyDocuments/qwan/sites/qwaneu.github.io on
macOS and ~/Documents/qwan/sites/qwaneu.github.io here (both verified to
exist).  So the roots go to the OS files and the shared half holds only the
require and the bindings.  Paths are home-relative, and config-local.el can
override them if a checkout ever moves.

Prefix SPC n r was unused in this config, so no rebinding.

Verified in a scratch checkout: the imported suite passes 20/20
(emacs -Q --batch -L qwan -l qwan/org-roam-export-blog.el
 -l qwan/org-roam-export-blog-test.el -f ert-run-tests-batch-and-exit)
and the existing firehose-blog suite still passes 16/16.
2026-11-03 12:25:56 +00:00

233 lines
9.2 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)
(require 'org-roam-export-blog)
;; Publishing: export an org-roam note into a blog post. The two candidate
;; destinations live in config-mac.el / config-linux.el, because their paths
;; differ per machine (and neither has anything to do with the OS as such).
(map! :leader
:desc "Export note as firehose blog post" "n r b" #'org-roam-export-blog
:desc "Export note as jekyll draft" "n r j" #'org-roam-export-jekyll)
;; 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