Files
dotemacs/AGENTS.md
T
Willem van den Ende 0b267d04c5 fix(linux): port startup and dictation fixes from the private working copy
Fixes that only existed on the Linux machine (unpushed commit and
uncommitted work there), without which a fresh clone breaks on Linux:

- config.el resolved coe-xx/mostalive/qwan against ~/.doom.d, but the
  config lives at ~/.config/doom, so (require 'coe-xx) aborted startup
  with "Cannot open load file". Resolve them against doom-user-dir.

- lisp/live-dictate.el only spoke whisper.cpp's POST /inference, which
  Lemonade (the Linux transcription server) does not serve -- every
  utterance came back as a not_found object and was dropped silently.
  It now auto-detects between /inference and the OpenAI-compatible
  /v1/audio/transcriptions endpoint, remembers which one answered,
  reports unusable replies, reads the VAD peak from the high byte of
  little-endian PCM16 (the low byte made silence look like speech),
  prints the peak level on stop, and gains M-x live-dictate-reload,
  wired into doom-after-reload-hook on both OSes.

- config.el hardcoded the macOS org-directory (~/MyDocuments, inside
  iCloud). Where the notes live is now owned by config-linux.el
  (~/Documents) and config-mac.el (~/MyDocuments), and the OS leaf
  loads before org and org-roam load below instead of after them.
  Blog export targets stay in the OS files, where they belong.

- mostalive/my-org-roam.el: compute org-agenda-files by listing the
  daily/ directory instead of org-roam-db-query at load time, and
  defer the full org-roam DB sync to idle time. Doom advises the first
  DB query of a session into a full org-roam-db-sync, which SHA1s all
  ~8.4k notes before the first frame is drawn (blank-screen startup).

Also correct the ~/.doom.d paths in AGENTS.md, the export-test header
and README that the sanitization base predated the fix for.
2026-11-27 17:57:37 +01:00

112 lines
5.4 KiB
Markdown

# AGENTS.md — willem's .doom.d
This file provides context for LLM coding agents working on this Doom Emacs configuration repository.
## Repository Overview
This is a [Doom Emacs](https://github.com/doomemacs/doomemacs) configuration at `~/.config/doom/`. The Doom framework lives in `~/.config/emacs/` (managed via straight.el). This repo only contains user configuration:
- `init.el` — Doom module declarations (what features to enable)
- `config.el` — Main user configuration (editor settings, keybindings, org, latex, gptel, etc.)
- `packages.el` — Package declarations for `doom sync`
- `custom.el` — Auto-generated by Emacs' customize system
- `config-mac.el` — Mac-specific configuration (gptel backends, LLM tools)
- `config-local.example.el` — Example local overrides (not committed with secrets)
### Custom Package Directories
**`mostalive/`** — Personal extensions by Willem (@mostalive)
- `my-org-roam.el` — `org-roam-node-insert-immediate` (insert link without opening buffer), org-agenda file collection, log file opener
- `journelly-convert-entry-to-org-roam.el` — Convert Journelly app entries to org-roam notes
- `convert-chats-to-org.el` — Chat log formatting utilities
**`qwan/`** — QWAN partnership utilities
- `qwan-blog.el` — Blog publishing helpers (publish draft to `../_posts/`, org-to-markdown link conversion, image markdown link creation, URL stripping)
- `qwan-refactor.el` — Elisp refactoring utilities with ERT tests (rename function at point, remove tests, `as-function-name`)
- `qwan-markdown-dnd.el` — Drag-and-drop image attachment for markdown buffers (copies dropped files to `attachments/`, inserts markdown link)
**`coe-xx/`** — Cross-stitch pattern editor (from Craft of Emacs guide)
- `coe-xx.el` — Major mode for `.coe-xx` pattern files
- `coe-demo.el` — Demo functions
## User Identity
- **Willem van den Ende** — @mostalive
- **QWAN** — partnership entity (Willem's collaborative practice)
- **Org-roam directory**: `~/MyDocuments/qwan/essays/willem/`
- **Blog**: Static site, markdown files in `../_posts/` relative to org-roam dir
- **Mastodon**: @mostalive@mastodon.social
## Workflow Patterns
### Key Commands
| Action | Command |
|--------|---------|
| Reload config | `M-x doom/reload` |
| Sync packages | `doom sync` (terminal) |
| Run all ERT tests | `(ert t)` |
| Run matching tests | `(ert "test-pattern-*")` |
### Code Style Conventions
- **Naming**: Functions use namespace prefixes: `qwan/`, `my/`, `org-roam-node-insert-immediate` (no conflict needed).
- **Testing**: ERT tests follow the function being tested. Test names use `test-` prefix or describe the function. Tests live in the same file as the code.
- **Loading**: Custom packages loaded via `add-load-path!` + `require` in `config.el`.
- **Formatting**: `elisp-autofmt` installed for Elisp formatting.
## Markdown Drag-and-Drop
**Status**: Implemented in `qwan/qwan-markdown-dnd.el` (see above).
**How it works**:
1. When a file is dragged from Finder into a markdown buffer, Emacs' `dnd-protocol-alist` dispatches to `qwan-markdown-dnd-handler`
2. The handler copies the file into `qwan-markdown-attachment-dir` (default `"attachments"`, relative to the markdown file)
3. On name conflicts, appends a timestamp suffix
4. For images, inserts `![alt](path)`; for other files, inserts `[filename](path)`
5. Configure per-repo via `.dir-locals.el`:
```elisp
((markdown-mode . ((qwan-markdown-attachment-dir . "assets/images"))))
```
**Related existing code in `qwan/qwan-blog.el`**:
- `qwan/image-mode-copy-filename-as-markdown-image-link` — copies markdown image link to kill-ring from an image buffer
- `qwan/relative-path-to-attachments` — strips prefix to get relative path from `/attachments`
- `qwan/string-as-markdown-image-link` — wraps path in markdown image syntax
**Org DND**: The `+dragndrop` flag (fixed from `+download-dnd`) enables `org-download` for org-mode screenshots, clipboard images, and nicer inline previews.
## Org-mode Configuration Highlights
- **org-roam** enabled with heavy customization
- **org-pomodoro** + gnuplot + pretty bullets
- **Export**: LaTeX with xelatex (ET Bembo font, Tufte style), HTML without preamble
- **Elfeed** RSS with org integration, org-roam capture for saved articles
- **Publishing**: Drafts published to `../_posts/` with date prefix
## LLM Integration (gptel / pi)
- **Primary backend**: Local llama.cpp server at `localhost:8000`
- **Alternative**: Ollama at `localhost:11434`
- **Presets**: `explain`, `elixir`, `elisp`, `glm-fast`, `glm-think`, `glm-search`
- **Custom tools**: `projectile-search` (code search), `search_notes` (org-roam RIP grep)
- **pi-coding-agent**: Also installed for agentic coding assistance
## Key Editor Settings
- **Theme**: leuven
- **Line numbers**: relative
- **Evil mode**: `evil-move-cursor-back` nil, `evil-move-beyond-eol` t
- **Company**: idle delay disabled
- **Magit**: magit-delta enabled, diff-hl disabled in magit (to avoid refresh errors)
- **Spell check**: aspell (hunspell not used)
## Important Gotchas
- Changing `init.el` or `packages.el` requires `doom sync` then `M-x doom/reload`
- `load!` is Doom's version of `load` for files relative to `doom-user-dir`
- `after!` runs code after a package has loaded
- `use-package!` is Doom's wrapper around `use-package`
- `map!` for keybindings (especially leader keys)
- `add-load-path!` for adding directories to Emacs' `load-path`