summaryrefslogtreecommitdiff
path: root/docs/plans/2026-04-10-org-refile-implementation.md
blob: 687e86d2ab807155c5e1fca2c99581d188c2be7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Org Refile Implementation Plan

> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Configure Org refile so entries can be moved to any heading in `org-agenda-files` with a clearer Vertico-friendly path-based prompt.

**Architecture:** Reuse the existing agenda discovery helper to keep `org-agenda-files` current before refile, then configure built-in Org refile variables in `lisp/ss-org.el`. Add narrow ERT coverage for the helper and settings, and update `README.md` so the documented workflow matches the configuration.

**Tech Stack:** Emacs Lisp, Org mode, ERT, Vertico, Orderless, Marginalia

---

## Chunk 1: Refile Configuration

### Task 1: Add refile refresh helper and Org settings

**Files:**
- Modify: `lisp/ss-org.el`
- Reference: `lisp/ss-agenda.el`

- [ ] **Step 1: Write the failing test**

Add ERT coverage that loads `ss-org`, stubs agenda refresh behavior, runs the
new setup helper, and asserts:

- `org-refile-targets` points at `org-agenda-files`
- unlimited heading depth is enabled
- outline-path completion is enabled
- the direct path completion flow is selected

- [ ] **Step 2: Run test to verify it fails**

Run: `emacs --batch -Q -L lisp -l tests/ss-org-tests.el -f ert-run-tests-batch-and-exit`
Expected: FAIL because the refile helper and settings do not exist yet.

- [ ] **Step 3: Write minimal implementation**

- Add a small helper in `lisp/ss-org.el` that refreshes `org-agenda-files`
  before refile, reusing `ss-refresh-org-agenda-files` when available.
- Configure Org refile variables during `ss-org-setup`.

- [ ] **Step 4: Run test to verify it passes**

Run: `emacs --batch -Q -L lisp -l tests/ss-org-tests.el -f ert-run-tests-batch-and-exit`
Expected: PASS.

- [ ] **Step 5: Commit**

Wait for verification and user approval before creating a commit.

## Chunk 2: Documentation and Startup Verification

### Task 2: Document the refile workflow

**Files:**
- Modify: `README.md`

- [ ] **Step 1: Write the failing test**

The failing condition is documentation drift: the README currently does not
describe refile behavior.

- [ ] **Step 2: Run test to verify it fails**

Review `README.md` and confirm it lacks refile documentation.

- [ ] **Step 3: Write minimal implementation**

- Add a short note describing that Org refile targets any heading in
  `org-agenda-files` and uses path-based minibuffer completion.

- [ ] **Step 4: Run test to verify it passes**

Review the updated text against the code for accuracy.

- [ ] **Step 5: Commit**

Wait for verification and user approval before creating a commit.

### Task 3: Verify the full startup path

**Files:**
- Verify only

- [ ] **Step 1: Write the failing test**

Use the repository's normal startup verification path in addition to the new
targeted ERT coverage.

- [ ] **Step 2: Run test to verify it fails**

Not applicable before implementation.

- [ ] **Step 3: Write minimal implementation**

No code changes in this task.

- [ ] **Step 4: Run test to verify it passes**

Run: `emacs --batch -Q --load ./init.el`
Expected: exits successfully.

Run: `emacs --batch -Q -L lisp -l tests/ss-org-tests.el -f ert-run-tests-batch-and-exit`
Expected: PASS.

- [ ] **Step 5: Commit**

Wait for verification and user approval before creating a commit.