krz/orgstar

A native macOS editor for org-mode files. editor org-mode swift

docs/plans/2026-10-05-capture.md

c1295824f55c7bba681fca8338bf08167e110105
orgstar/docs/plans/2026-10-05-capture.md rendered · source · history · blame · raw

23 lines · 2093 bytes

Capture Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: org-capture: templates, filling them, filing the result where Emacs would, from inside the app and from a system-wide shortcut.

Architecture: OrgCore/Capture/Capture.swift ports org-capture-fill-template (%?, %i, %a, %l, %L, %c, %f, %F, %n, %t, %T, %u, %U, %<…>, %^{prompt|default}, %\N; the text trimmed and ending in one newline) and placement for entry, plain, item and checkitem into file, file+headline (created when missing) and file+olp targets, with org-capture-place-entry's blank-line handling (org--blank-before-heading-p with auto, empty lines after removed) and level shifting, and a final newline as saving adds. Templates come from capture.toml beside keymap.toml, defaulting to the two in your Doom config, files relative to the first folder. The capture window picks a template by key, asks the prompts, and files the edited text through the open buffer or the save path. ⌃⌥Space opens it from any app (Carbon hot key, no accessibility permission), as do C-c c and ⇧⌘N.

Tech Stack: Swift 6.2 tools, Swift Testing, Emacs 31.1 / Org 9.8.7 oracle (org-capture + org-capture-finalize in batch).

Spec: docs/design.md, "Phase 5".

Global Constraints

  • Oracle: 12 templates × target files (existing and missing headlines, blank lines, prepend, nested outline paths, property drawers, lists, files without a final newline).
  • Not yet: datetree targets, %^g/%^t/%^C and other typed prompts, %(sexp), %[file], %k, %K, %x; such templates show a message instead of filing something different.

  • Fill, questions, placement; oracle.
  • CaptureTemplates, DocumentSession.capture, captureAnnotation; tests.
  • Capture window, global shortcut, menu, keys, settings.
  • Commit "Capture".