- Fix org DND flag: +download-dnd → +dragndrop (was silently no-op) - New qwan-markdown-dnd.el: handles file drops in markdown buffers copies images to configurable attachment dir (default: attachments/) inserts markdown image links at point per-repo config via .dir-locals.el (qwan-markdown-attachment-dir) - AGENTS.md: document the new module and DND setup
5.4 KiB
5.4 KiB
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 configuration at ~/.doom.d/. The Doom framework lives in ~/.emacs.d/ (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 fordoom synccustom.el— Auto-generated by Emacs' customize systemconfig-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 openerjournelly-convert-entry-to-org-roam.el— Convert Journelly app entries to org-roam notesconvert-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 toattachments/, inserts markdown link)
coe-xx/ — Cross-stitch pattern editor (from Craft of Emacs guide)
coe-xx.el— Major mode for.coe-xxpattern filescoe-demo.el— Demo functions
User Identity
- Willem van den Ende —
redacted@example.invalid— @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!+requireinconfig.el. - Formatting:
elisp-autofmtinstalled for Elisp formatting.
Markdown Drag-and-Drop
Status: Implemented in qwan/qwan-markdown-dnd.el (see above).
How it works:
- When a file is dragged from Finder into a markdown buffer, Emacs'
dnd-protocol-alistdispatches toqwan-markdown-dnd-handler - The handler copies the file into
qwan-markdown-attachment-dir(default"attachments", relative to the markdown file) - On name conflicts, appends a timestamp suffix
- For images, inserts
; for other files, inserts[filename](path) - Configure per-repo via
.dir-locals.el:((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 bufferqwan/relative-path-to-attachments— strips prefix to get relative path from/attachmentsqwan/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-backnil,evil-move-beyond-eolt - 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.elorpackages.elrequiresdoom syncthenM-x doom/reload load!is Doom's version ofloadfor files relative todoom-user-dirafter!runs code after a package has loadeduse-package!is Doom's wrapper arounduse-packagemap!for keybindings (especially leader keys)add-load-path!for adding directories to Emacs'load-path