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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
|
#+TITLE: Emacs Config Tasks
#+AUTHOR: Craig Jennings
#+ARCHIVE: %s::* Emacs Resolved
* Emacs Priority Scheme
Use priority to express impact and urgency, not task type. Bugs, refactors,
tests, chores, and features can all be high or low priority.
- =[#A]= Urgent risk or current workflow blocker. Use for credential exposure,
security/privacy leaks, data loss, destructive behavior, startup breakage,
failing tests that block work, or a feature/refactor that unblocks a core
daily workflow.
- =[#B]= Important planned work. Use for concrete bugs, high-leverage
architecture cleanup, brittle load-order/test gaps, dependency failures, or
feature work with a clear design and expected near-term use.
- =[#C]= Useful but optional. Use for low-risk cleanup, ergonomics, smoke tests,
investigations with limited current impact, or feature work that would improve
the setup but is not yet a committed workflow.
- =[#D]= Someday/maybe or watchlist. Use for speculative features, tiny polish,
upstream/package tracking, optimizations without current pain, or deferred
ideas that should not compete with active maintenance.
For =PROJECT= headings, use the highest priority of the meaningful child work
inside the project. If a project only contains exploration or review, assign the
priority by the expected decision value rather than the number of files touched.
Use tags to describe the work shape:
- =:bug:= means the current behavior is wrong or likely broken.
- =:feature:= means the task adds a new user-visible capability or workflow.
- =:refactor:= means the task changes structure/ownership without primarily
changing behavior.
- =:quick:= means the task appears low effort and localized. It is a planning
hint, not a promise; remove it if the task grows during implementation.
Tags are additive. For example, a small wrong-behavior fix can be
=:bug:quick:=, and a feature that requires internal restructuring can be
=:feature:refactor:=.
* Emacs Open Work
** PROJECT [#A] Architecture review follow-up from 2026-05-03 :refactor:no-sync:
High-level pass over =init.el=, =early-init.el=, and all 104 files in
=modules/=. The main theme: the config works, but load order, startup side
effects, credentials, and test measurement are more implicit than they should
be. Use this project as the parent tracker; each child below should land as a
small, reviewable change.
Review snapshot:
- =modules/= has 104 files and about 24k lines including =init.el= and
=early-init.el=.
- =init.el= eagerly =require=s nearly every module.
- =make coverage= passed when allowed to write the test scratch directory.
- Coverage report: =3240/4952= executable lines, =65.43%=, across 49 module
files. Caveat: 55 module files do not appear in the report at all, so the
real project confidence is lower than the raw percentage suggests.
*** DONE [#B] Consolidate shared utility helpers :architecture:refactor:
CLOSED: [2026-05-15 Fri]
Helpers are scattered across feature modules where they were first needed.
Some are duplicated, and some private helpers are generic enough to belong in a
shared foundation library. This is adjacent to the load-graph refactor because
central helper ownership reduces hidden inter-module dependencies, but it
should remain a sibling project so load-order batches stay small and
reviewable.
Guidance:
- Do not extract a helper until at least two callers are clearly the same
shape.
- Prefer growing =system-lib.el= first; split into topic libraries only if it
becomes too broad or starts pulling coarse dependencies into foundation
startup.
- Keep one helper extraction per commit.
- Move unit tests with the helper. Consumers should keep behavior/integration
coverage.
- Do not add heavy package dependencies to foundation helpers.
**** DONE [#B] Write full utility consolidation design spec :architecture:refactor:
CLOSED: [2026-05-04 Mon]
Create a design document that inventories candidate helper extractions,
recommends grouping and naming, explains how the helpers fit into existing
library modules, defines migration phases, and identifies testing/rollback
rules.
Spec: [[file:docs/design/utility-consolidation.org][docs/design/utility-consolidation.org]]
Verify 2026-05-04:
- Added [[file:docs/design/utility-consolidation.org][docs/design/utility-consolidation.org]].
- Spec includes framing questions, existing library fit, proposed grouping,
concrete pull/rename table, migration phases, test strategy, acceptance
criteria, risks, open questions, and recommended first commits.
- Parsed the spec and =todo.org= with =org-element=.
- Committed the tracked spec as =3ea4707=.
- Incorporated complete review feedback in =dd77ebd=, including API behavior
contracts, speculative-extraction rules, =system-lib= dependency budget,
inventory/audit artifacts, test relocation policy, commit type guidance,
=use-package :if= load-order policy, and Phase 5 cache-design addendum
requirement.
**** DONE [#B] Inventory private helpers across modules :refactor:
CLOSED: [2026-05-10 Sun]
Walk every module and tag private helpers as genuinely module-specific,
generic-but-trapped, or duplicated. Capture likely consumers and any dependency
cost before extracting.
Candidate families:
- shell argument formatting,
- executable lookup with user-visible warnings,
- argv-based process runners,
- path containment/safe-base predicates,
- Org-safe heading/property/body text sanitizers,
- cache-with-TTL plus invalidation hooks,
- warning/message wrappers.
Verify 2026-05-10:
- Added [[file:docs/design/utility-inventory.org][docs/design/utility-inventory.org]] covering the 30 entries in the spec's
Candidate Extraction Table grouped by family (executable discovery, shell
quoting, process runner, file/path, external-open, Org-safe text, cache,
logging, macros/debug, theme I/O, string).
- For each helper recorded: visibility, dependencies, side effects, callers
(production + test), test files, priority, decision (Migrate / Leave / Defer)
with rationale.
- Decisions Summary: 11 Migrate, 3 Leave, 13 Defer.
- Concrete next-action list groups Migrate items by Phase (2 = foundation
helpers, 3 = Org-safe text, 4 = external-open consolidation) for the order
the spec recommends.
- Discoveries: =cj/log-silently= has 10 production callers (more than the
spec's table suggested -- defer is the right call); =cj/--file-manager-program-for=
shipped today in =dirvish-config.el= is the new form of OS-dispatch
consolidation and should fold into =cj/external-open-command= during Phase 4.
**** DONE [#B] Extract executable lookup with warning helper :refactor:
CLOSED: [2026-05-10 Sun]
Create a generic helper such as =cj/find-executable-or-warn= from the useful
=mail-config= pattern. It should return the executable path or nil and produce
a clear warning when the executable is missing.
Done 2026-05-10:
- Shipped as =cj/executable-find-or-warn= in =modules/system-lib.el=
(commit =c75e36f4=, extracted from =mail-config=).
- First consumer rewired in =12c2cb14= (=cj/set-wallpaper= in
=dirvish-config.el=).
**** DONE [#B] Extract argv-based process runner helper :refactor:
CLOSED: [2026-05-10 Sun]
Generalize the =coverage-core= process pattern into a dependency-light helper
that captures output and signals a clear =user-error= with command/status/output
on failure. Consider a small git wrapper only after the generic runner exists.
Done 2026-05-10:
- Shipped =cj/process-output-or-error= plus the =cj/git-output-or-error=
wrapper in =modules/system-lib.el= (commit =57e558ce=, extracted from
=coverage-core=).
**** DONE [#B] Extract Org-safe text sanitizers :refactor:
CLOSED: [2026-05-10 Sun]
Move heading/property/body sanitization into a shared helper once at least one
non-calendar consumer is ready. Keep behavior explicit so external text cannot
accidentally create headings or malformed properties.
Done 2026-05-10:
- Shipped =modules/cj-org-text-lib.el= (renamed to its final =-lib= form in
commit =0f9e3087=) with three sanitizers: =cj/org-sanitize-body-text=,
=cj/org-sanitize-property-value=, =cj/org-sanitize-heading=.
*** DONE [#B] Make coverage reporting account for untracked modules :tests:
CLOSED: [2026-05-15 Fri]
The current coverage result is useful but easy to overread. =make coverage=
reported =65.43%= for files that undercover saw, but only 49 of 104 module
files appeared in =.coverage/simplecov.json=.
Definition: in this task, "untracked modules" means repository-owned
=modules/*.el= files that should be part of the Emacs configuration coverage
universe but have no entry in =.coverage/simplecov.json= after =make coverage=
runs. These files may be missing because no test required them, because loading
was skipped due to package/environment guards, or because instrumentation did
not see them. They are distinct from tracked modules with 0% covered lines,
which already appear in SimpleCov and can be scored directly.
Completed 2026-05-15:
- Both child tasks are done.
- =make coverage-summary= reports missing modules explicitly and also reports a
separate project-module score where missing modules count as 0%.
- Focused summary tests and byte-compilation of the summary helper passed.
**** DONE [#B] Teach the coverage report to list modules missing from SimpleCov
CLOSED: [2026-05-15 Fri]
Expected outcome:
- Compare =modules/*.el= against paths present in =.coverage/simplecov.json=.
- Show a separate "not in report" section.
- Do not silently fold those files into the percentage until we decide the
semantics. A visible missing-file count is enough for v1.
Done 2026-05-15:
- =make coverage-summary= now compares direct =modules/*.el= files on disk
against the module paths present in =.coverage/simplecov.json=.
- The terminal report appends a =Not in SimpleCov report= section with a count
and the missing module paths.
- Missing modules are explicitly excluded from the displayed percentage for
now; the policy question below remains open.
- Added focused tests in =tests/test-coverage-summary.el= for missing-module
reporting and for ignoring =.elc= files and nested paths outside direct
=modules/*.el= ownership.
**** DONE [#B] Decide whether unreported modules count as 0% coverage
CLOSED: [2026-05-15 Fri]
This is a policy decision:
- Counting missing modules as 0% gives a more honest project-level number.
- Keeping the current number is useful for "instrumented executable lines only".
Recommendation: display both:
- Instrumented coverage: current SimpleCov percentage.
- Project module coverage: includes unreported module files as 0% or reports
them separately with an explicit caveat.
Decision 2026-05-15:
- Keep the existing SimpleCov percentage as the line-weighted
=instrumented coverage= number. It only covers modules that SimpleCov saw and
has real executable-line denominators for.
- Also display a separate module-weighted =project module coverage= score over
all direct =modules/*.el= files. Modules present in SimpleCov contribute their
per-file coverage percentage; modules absent from SimpleCov count as 0%.
- Do not pretend missing modules have known executable-line counts. Counting
them as 0% at the module level is honest about risk without inventing a line
denominator.
Done 2026-05-15:
- =make coverage-summary= now prints both the existing line-weighted summary
and a separate =Project module coverage= line that includes missing modules
as 0%.
- The missing-module section now states that missing modules count as 0% in the
project-module score.
- Updated =tests/test-coverage-summary.el= to assert the policy and the
displayed project-module percentage.
*** DONE [#B] Add a lightweight architecture smoke test for startup contracts :tests:
CLOSED: [2026-05-15 Fri]
After the above refactors start, add one or two smoke tests that protect the
architecture instead of individual functions.
Candidate checks:
- All modules can be loaded directly with only =modules/= on =load-path=, or
skipped with a clear external package reason.
- No module other than =keybindings.el= binds =C-;= itself.
- Startup-only modules do not run timers in batch test mode.
Keep this small. The goal is to catch accidental return to hidden load-order
coupling, not to build a full static analyzer.
Done 2026-05-15:
- Added =tests/test-architecture-startup-contracts.el= with two source-level
smoke checks:
- only =keybindings.el= may globally own the exact =C-;= prefix;
- top-level timer scheduling forms must be guarded by =noninteractive= so
batch/test loads do not schedule startup timers.
- Gated existing startup timers in =org-agenda-config.el=,
=org-refile-config.el=, =quick-video-capture.el=, and =wrap-up.el=.
- Focused tests passed for the new architecture smoke file and the affected
agenda/refile helpers.
*** PROJECT [#A] Un tangle the eager =init.el= load graph :architecture:refactor:
=init.el= currently functions as the dependency graph by eagerly requiring
almost every module in a fixed order. That makes modules harder to test in
isolation and hides real dependencies behind "loaded earlier in init.el"
assumptions.
Spec: [[file:docs/design/init-load-graph.org][docs/design/init-load-graph.org]]
**** VERIFY [#B] Write full design spec for the =init.el= load-graph refactor :architecture:refactor:
Create a design document that defines the target architecture, module
categories, migration phases, test strategy, acceptance criteria, and risk
controls for untangling the eager =init.el= load graph.
Review incorporation:
- Treat helper consolidation as adjacent architecture work, not a direct
acceptance criterion for the load-graph refactor.
- Mention utility extraction guardrails in the spec so Phase 2 dependency work
has a clear rule for duplicated helpers found along the way.
Verify 2026-05-04:
- Added [[file:docs/design/init-load-graph.org][docs/design/init-load-graph.org]].
- Incorporated review feedback by making utility consolidation an explicit
sibling project with guardrails and candidate helper families.
- Parsed the spec and =todo.org= with =org-element=.
- Committed the tracked spec as =0528475=.
**** TODO [#B] Classify modules by role and startup requirement :refactor:
Create a simple inventory, probably in =docs/design/= or an org note linked
from this task:
- Pure library modules: should have explicit =require=s, no top-level keybinds,
no timers, no package install/load side effects.
- Package configuration modules: mostly =use-package=, hooks, mode bindings.
- Startup side-effect modules: server startup, timers, dashboard, weather,
calendar auto-sync, quick-video setup, etc.
- User command modules: expose interactive commands but defer heavy package
loading until the command runs.
Acceptance criteria:
- Every module has an assigned category.
- Any module that must be eager has a documented reason.
- Obvious "modules in test" or "WIP need to fix" comments in =init.el= are
either retired or turned into actual tasks.
**** TODO [#B] Add explicit module dependencies before changing load order :refactor:
Several modules assume things like =cj/custom-keymap=, path constants, or
environment predicates already exist. Before deferring load, make each module
declare what it uses.
Guidance:
- Prefer runtime =(require 'foo)= for actual runtime dependencies.
- Use =eval-when-compile= only for macros or compile-time declarations.
- Avoid shims like "define this keymap if it does not exist" except in tests.
- If a module only needs a command from another module, consider =autoload=.
Acceptance criteria:
- Loading a module directly in batch mode either succeeds or gives a clear
missing-package error.
- =make validate-modules= still passes.
- New tests cover any extracted pure dependency helpers.
**** TODO [#B] Defer feature modules behind autoloads, hooks, and commands :refactor:
Once dependencies are explicit, reduce the number of modules required at
startup. Start with lower-risk feature modules:
- Entertainment and optional integrations: =games-config=, =music-config=,
=weather-config=, =slack-config=, =erc-config=.
- Heavy document/media modules: =pdf-config=, =calibredb-epub-config=,
=video-audio-recording=, =transcription-config=.
- AI/rest tooling: =ai-config=, =restclient-config=, =ai-conversations=.
Do this incrementally. After each batch:
- Restart Emacs interactively.
- Run =make test= or at least targeted tests.
- Check that keybindings still resolve and which-key labels still appear.
**** TODO [#B] Centralize custom keymap registration :refactor:
Many modules mutate =cj/custom-keymap= or global keys at top level. This is a
real architectural boundary because it forces load order and makes standalone
module loading brittle.
Expected outcome:
- Define a small helper or convention for registering prefix maps.
- Modules can expose their keymaps without assuming =keybindings.el= has already
loaded.
- =keybindings.el= remains the owner of global prefixes like =C-;=.
- Existing keymaps continue to work.
Related existing task: [#B] "Review and rebind M-S- keybindings".
*** PROJECT [#A] Move package bootstrap out of =early-init.el= where possible :startup:refactor:
=early-init.el= currently handles package archives, package refresh, installing
=use-package=, and =use-package-always-ensure=. That is more than early startup
needs and can make startup network-sensitive.
**** TODO [#B] Split early startup from package bootstrap :refactor:
Keep =early-init.el= focused on things that must happen before package and UI
startup:
- GC/file-name-handler startup tuning.
- =load-prefer-newer=.
- frame/UI suppression.
- minimal debug behavior.
Move package archive setup and =use-package= installation to a normal module or
bootstrap command, unless there is a specific reason it must run in
=early-init.el=.
Acceptance criteria:
- Fresh install/bootstrap still works from a documented command or script.
- Normal startup does not refresh archives or install packages unexpectedly.
- Offline startup remains quiet and predictable.
**** TODO [#A] Revisit package signature policy
=package-check-signature= is disabled. Decide whether that is still necessary
for the localrepo/mirror workflow.
Expected outcome:
- Prefer signatures on by default.
- If signatures must be disabled for local mirrors, scope that exception and
document why.
- Add a note to the local repository docs so future package failures do not
lead to permanent insecure defaults.
** TODO [#B] Implement EMMS-free music-config architecture :refactor:
*** 2026-05-15 Fri @ 19:17:01 -0500 Specification
Implement the design in [[file:docs/design/music-config-without-emms.org][Design: music-config Without EMMS]].
The implementation should make =music-config.el= load without EMMS, introduce
package-owned playlist and track state, add a =cj/music-playlist-mode= view,
and route playback through a small backend protocol with an initial =mpv=
backend. Preserve the current F10 and =C-; m= user workflows where practical,
and keep M3U load/save/edit/reload plus radio station creation working.
Complexity estimate: high. This is a module rewrite with a new internal data
model, package-owned playlist mode, backend protocol, mpv process management,
and migration of existing EMMS-backed commands/tests.
Time estimate: 2-4 focused days for an EMMS-free v1 with play/stop/next/previous,
M3U persistence, playlist UI, and focused tests. Add another 1-2 days if v1
must include full mpv IPC support for pause, seek, and volume parity.
Acceptance checks:
- =music-config.el= can be required in batch with no EMMS package installed.
- Existing focused music tests pass without EMMS preload or EMMS stubs except
where a compatibility adapter is explicitly under test.
- New tests cover playlist state, backend command dispatch, M3U persistence,
and the EMMS-free load smoke path.
*** TODO [#B] Pure helpers + state structs extraction :refactor:
Lift EMMS-free pure code into standalone form: file validation, recursive
collection, M3U parse/write, safe filenames, radio-station content, and
URL/file track typing. Introduce =cj/music-track= and =cj/music-playlist=
cl-structs plus state-mutation helpers (=cj/music-playlist-*= predicates and
setters). Files: =modules/music-config.el=, possibly a new
=modules/music-state.el= split. Existing pure-helper tests should pass
unchanged.
Acceptance: structs defined, helpers callable in batch without EMMS loaded.
Depends on: none (start here).
*** TODO [#B] Backend protocol + fake test backend :refactor:tests:
Define the backend plist contract (=:available-p :play :pause :resume :stop
:seek :volume :status :metadata=) and =cj/music-current-backend=. Add
=cj/music-state-change-functions= abnormal hook with the v1 event set
(=started=, =paused=, =resumed=, =stopped=, =finished=, =error=,
=playlist-changed=, =mode-changed=). Create =tests/testutil-music-backend.el=
exposing =cj/test-music-fake-backend= with an event ledger.
Acceptance: fake backend installable in tests; ordered-event assertions work
against a no-op playback flow.
Depends on: pure helpers + state structs.
*** TODO [#B] Read-side state API + characterization tests :tests:refactor:
Implement =cj/music-playing-p=, =cj/music-paused-p=, =cj/music-current-track=,
=cj/music-playlist-state=, =cj/music-track-description=. Before rewriting
command bodies, add characterization tests against current behavior for
=cj/music-next=, =cj/music-previous=, =cj/music-toggle-consume=,
=cj/music-playlist-toggle=, =cj/music-playlist-load=, =cj/music-playlist-clear=
so the migration has a safety net.
Acceptance: read-side helpers covered; characterization tests green against
the current EMMS-backed implementation.
Depends on: backend protocol + fake test backend.
*** TODO [#B] Playlist major mode + render-from-state :feature:
Add =cj/music-playlist-mode= rendering the buffer as a view over
=cj/music-current-playlist=. Selected-track overlay + face, header reads
package state, full keymap from design Section "Playlist Buffer" (RET/p, SPC,
s, >/<, f/b, +/=/-, a, A, c/C, L/S/E/g, r/t/z/x, Z, i, o, q, S-up/down).
Preserve the active-window background highlight.
Acceptance: opening the playlist renders package state; reorder/shuffle/clear
go through state mutations and re-render; tests cover header + overlay
positioning.
Depends on: read-side state API.
*** TODO [#B] mpv backend implementation :feature:
Implement =cj/music-mpv-*= backend functions. Phase the work per migration
plan §5: (a) process spawn, UID/PID-stamped socket under
=temporary-file-directory=, stale-socket sweep, IPC connect via
=make-network-process :family 'local=, state-hook plumbing. (b) play/stop/
next/previous + finished-track auto-advance with deliberate-stop tracking.
(c) pause/resume, seek, volume over JSON IPC. (d) metadata read on track
start. Add =cj/music-doctor= reporting platform capabilities; ship Windows
degraded mode (play/stop/next/previous only via stdin/=call-process=).
Acceptance: integration tests tagged =:slow= and skipped when =mpv= not on
PATH; on Linux/macOS pause/seek/volume parity works; clean socket lifecycle
across Emacs restart and exit.
Depends on: backend protocol + fake test backend.
*** TODO [#B] Command + Dired/Dirvish rewire :refactor:
Migrate user-facing commands (=cj/music-play=, =cj/music-pause=,
=cj/music-stop=, =cj/music-next=, =cj/music-previous=, seek/volume,
random/repeat/consume/shuffle toggles) to operate on package state and call
=cj/music-current-backend=. Update Dired/Dirvish =+= add routing,
M3U load/save/edit/reload, radio-station creation, F10 toggle, and =C-; m=
keymap entries to drop EMMS symbols. Migrate command-flow tests to the fake
backend.
Acceptance: full keymap functional end-to-end against the fake backend;
characterization tests still green; Dirvish =+= add path covered.
Depends on: playlist major mode + mpv backend.
*** TODO [#B] EMMS removal + parity walk :cleanup:tests:
Remove =cj/emms--setup=, the on-demand EMMS loader, and the =use-package emms=
block. Add the EMMS-free batch-load smoke test (=music-config.el= requires
clean without EMMS installed). Run the 22-step parity walk from design
§"Parity Walk" against the new implementation; record measurements against
the performance budget (1000-track load <500ms, reorder <50ms, IPC dispatch
<100ms, header refresh <16ms) and note any deviations.
Acceptance: =init.el= loads cleanly without EMMS; =make test= passes; parity
walk recorded as a completion log entry under the parent task.
Depends on: command + Dired/Dirvish rewire.
** TODO [#B] Rework dev F-keys: compile+run (F4), test (F6), coverage (F7) :feature:
*** 2026-05-15 Fri @ 19:16:08 -0500 Specification
Consolidate the developer F-key block into a coherent sequence. F5 reserved for debug (separate ticket). Format bindings move off F6 to C-; f.
Menu mechanism: =completing-read= everywhere (consistent with F7 coverage scope prompt and with the vertico/consult workflow in the rest of the config). No transient definitions.
**F4 — compile + run**
- F4 (no modifier): completing-read with candidates filtered by project type. Detection via projectile-project-compilation-cmd and heuristic fallbacks (go.mod, Makefile, Eask, package.json, pyproject.toml, docker-compose.yml).
- Compiled project candidates: "Compile", "Run", "Compile + Run" (default), "Clean + Rebuild"
- Interpreted project candidates: "Run" only
- C-F4: fast path = Compile only. On interpreted projects, shows "not a compiled language" and no-ops.
- M-F4: fast path = Clean + Rebuild. Same "not applicable" behavior on interpreted projects.
The dispatcher reads projectile's per-project compile/run/test commands. No Docker-specific logic in the command itself. Container workflows are configured via projectile's prompt-and-cache (or .dir-locals.el from the dev-project-setup helper).
**F6 — run tests**
- F6 (no modifier): completing-read top-level:
- "All tests"
- "Current file's tests"
- "Run a test..." (nested completing-read with individual tests)
- C-F6: fast path = "Current file's tests"
- M-F6: fast path = "Run a test..."
"Current file's tests": if current buffer is a test file, run it directly. If source file, find matching test file(s) via language conventions (elisp: tests/test-<module>*.el; python: tests/test_<module>.py; etc.) and run them aggregated.
"Run a test...": build a candidate list of individual tests, pre-select the last-chosen test for this buffer (buffer-local cj/--last-test-run), present via completing-read. Pressing RET re-runs last. Memory is buffer-local so different source files remember their own last-test.
Candidate set for "Run a test...":
- If buffer is a test file: parse the file, return its test definitions.
- If buffer is a source file: find matching test file(s) and aggregate their test definitions.
- No matches: error out with "No tests found for <buffer>". Don't silently fall through.
Per-language test discovery:
- Python, Go, TypeScript/JavaScript: tree-sitter queries (treesit-auto already configured, grammars auto-install)
- Python: (function_definition name: (identifier) @name (:match "^test_" @name))
- Go: (function_declaration name: (identifier) @name (:match "^Test" @name))
- TS/JS: (call_expression function: (identifier) @fn arguments: (arguments (string) @name) (:match "^\\(test\\|it\\)$" @fn))
- Parsing unopened test files: use with-temp-buffer + insert-file-contents + python-ts-mode (etc.) + treesit-query-capture
- Elisp: built-in sexp navigation; scan for (ert-deftest <name> ...) forms. No tree-sitter needed.
*F7 — coverage* (already designed in docs/design/coverage.org)
**Required moves:**
- Move blacken-buffer (python), shfmt-buffer (sh), clang-format-buffer (c) off F6 to C-; f prefix (already the format-buffer prefix).
- Move projectile-run-project off F6 (folds into the new F4 completing-read).
**Ordering:**
Do this after the coverage-config work ships. No churn mid-flight.
*** TODO [#B] Format keybindings move off F6 :refactor:cleanup:
Move blacken-buffer (python), shfmt-buffer (sh), and clang-format-buffer (c)
off F6 onto the =C-; f= prefix, which already hosts format-buffer bindings.
Also remove projectile-run-project from F6 (it folds into the new F4).
Touch the per-language config modules that currently bind F6 for formatting.
Acceptance: F6 has no remaining format-or-run bindings in any module; =C-; f=
prefix triggers the right formatter per major mode.
Depends on: none (start here -- clears F6 before F4/F6 work lands).
*** TODO [#B] Project-type detection helper :feature:
Single helper that returns a project-type symbol (=compiled=, =interpreted=,
=unknown=) from the current buffer's project. Uses
=projectile-project-compilation-cmd= when set, then heuristic fallbacks:
=go.mod=, =Makefile=, =Eask=, =package.json=, =pyproject.toml=,
=docker-compose.yml=. Lives near the F4 dispatcher.
Acceptance: ERT tests cover each heuristic in isolation plus a precedence
case where projectile's cached cmd wins over the file heuristics.
Depends on: none.
*** TODO [#B] F4 compile+run dispatcher :feature:
Build the F4 binding per spec: plain F4 opens a completing-read whose
candidates depend on project-type (Compile / Run / Compile + Run [default] /
Clean + Rebuild for compiled; Run only for interpreted). C-F4 fast-paths to
Compile; M-F4 fast-paths to Clean + Rebuild. Both fast paths show a "not a
compiled language" message and no-op on interpreted projects. Reads
projectile's per-project compile/run commands; no Docker-specific logic.
Acceptance: each candidate dispatches to the right projectile command; fast
paths no-op cleanly on interpreted projects; F4 bindings live in one module.
Depends on: project-type detection helper.
*** TODO [#B] Per-language test discovery :feature:tests:
Provide a single =cj/--tests-in-buffer= function returning a list of test
names for the current buffer's language. Tree-sitter queries for Python,
Go, TS/JS (treesit-auto already configured); built-in sexp scan for elisp
(=ert-deftest= forms). Parsing unopened test files uses with-temp-buffer +
insert-file-contents + <lang>-ts-mode + treesit-query-capture. Queries are
spelled out in the spec above.
Acceptance: ERT tests feed each language a fixture file and assert the
expected test-name list comes back; missing grammar surfaces a clear error.
Depends on: none (parallel-safe with F4 work).
*** TODO [#B] F6 test dispatcher :feature:tests:
Build the F6 binding per spec: plain F6 opens completing-read with "All
tests", "Current file's tests", "Run a test..."; C-F6 fast-paths to current
file's tests; M-F6 fast-paths to "Run a test...". "Current file's tests"
runs the buffer directly if it's a test file, otherwise finds matching test
files via language conventions (elisp =tests/test-<module>*.el=, python
=tests/test_<module>.py=, etc.) and runs them aggregated. "Run a test..."
pre-selects =cj/--last-test-run= (buffer-local) and errors with "No tests
found for <buffer>" when discovery returns nothing -- no silent fallthrough.
Acceptance: each entry point dispatches to the right runner; buffer-local
last-test memory persists per source file; no-match error fires correctly.
Depends on: per-language test discovery.
*** TODO [#B] F7 hand-off to dev-fkeys story :feature:
Once the coverage track ships ([[file:../docs/design/coverage.org][docs/design/coverage.org]]),
confirm F7 binds =cj/coverage-report= and lives alongside F4/F6 in the same
dev-fkeys module so the three keys read as one unit. No new coverage logic
here -- only the binding placement and a short comment block in the module
pointing at the coverage design doc.
Acceptance: F7 invokes coverage-report; F4/F6/F7 are visibly grouped in one
module; coverage track is shipped before this lands.
Depends on: the coverage-config track shipping; F4 and F6 sub-tasks above.
** TODO [#B] Review and rebind M-S- keybindings :refactor:
Changed from M-uppercase to M-S-lowercase for terminal compatibility.
These may override useful defaults - review and pick better bindings:
- M-S-b calibredb (was overriding backward-word)
- M-S-c time-zones (was overriding capitalize-word)
- M-S-d dwim-shell-menu (was overriding kill-word)
- M-S-e eww (was overriding forward-sentence)
- M-S-f fontaine (was overriding forward-word)
- M-S-h split-below
- M-S-i edit-indirect
- M-S-k show-kill-ring (was overriding kill-sentence)
- M-S-l switch-themes (was overriding downcase-word)
- M-S-m kill-all-buffers
- M-S-o kill-other-window
- M-S-r elfeed
- M-S-s window-swap
- M-S-t toggle-split (was overriding transpose-words)
- M-S-u winner-undo (was overriding upcase-word)
- M-S-v split-right (was overriding scroll-down)
- M-S-w wttrin (was overriding kill-ring-save)
- M-S-y yank-media (was overriding yank-pop)
- M-S-z undo-kill-buffer (was overriding zap-to-char)
** TODO [#B] Build cj/dev-setup-project helper (per docs/design/dev-setup-project.org) :feature:
*** 2026-05-15 Fri @ 19:17:37 -0500 Specification
Interactive command that opens a review buffer with proposed per-subdirectory .dir-locals.el contents (projectile compile/run/test + cj/coverage-backend), optional starter Makefile when none exists, and gitignore updates. User edits inline, C-c C-c writes all files.
Design: [[file:../docs/design/dev-setup-project.org][docs/design/dev-setup-project.org]]
Scope of v1:
- modules/dev-setup-config.el (command + review-buffer major mode)
- Three-tier detection: existing Makefile, existing package.json/pyproject.toml scripts, fall-back starter Makefile generation.
- Project shapes supported: pure Elisp, pure Go, pure Python, pure Node/TS, Docker Compose polyglot.
- Re-run semantics: status banners (UNCHANGED / WILL UPDATE / WILL CREATE), idempotent gitignore append, never modifies an existing Makefile.
- ERT tests for the pure helpers (Makefile parser, package.json parser, shape detection, target-to-role mapping, review-buffer parser).
Deferred:
- Rust (Cargo.toml), Java (pom.xml), other language shapes.
- Project-wide override config file.
- Auto-detecting external run scripts in conventional locations.
Do this after the F-key rework ticket ships; don't want to churn project configs before the keys are stable.
*** TODO [#B] Pure detection + parsing helpers :feature:
Implement the four pure helpers the rest of the command composes on:
- =cj/--dev-setup-parse-makefile-targets FILE= (.PHONY + bare target lines, skip pattern rules)
- =cj/--dev-setup-parse-package-json-scripts FILE= (scripts block, JSON)
- =cj/--dev-setup-detect-project-shape ROOT= (Elisp / Go / Python / Node-TS / Docker-Compose polyglot / unknown)
- =cj/--dev-setup-map-targets-to-roles TARGETS= (best-guess compile/run/test mapping per design § Detection)
Files: =modules/dev-setup-config.el= (new). No interactive surface, no I/O
beyond reading the named file.
Acceptance: each helper callable in isolation with handcrafted fixtures;
no command yet.
Depends on: none -- start here.
*** TODO [#B] ERT coverage for the pure helpers :feature:tests:
Normal/Boundary/Error tests for every helper from the prior sub-task,
matching the design's testing section.
Files: =tests/test-dev-setup-config.el=, plus
=tests/testutil-dev-setup-config.el= for the temp-project fixture builder
(writes Makefile / package.json / compose stub into =make-temp-file ... 'dir=).
Acceptance: =make test-file FILE=tests/test-dev-setup-config.el= green;
every helper has at least one Normal, one Boundary, one Error case.
Depends on: pure detection + parsing helpers.
*** TODO [#B] Starter-Makefile + .dir-locals.el proposal generator :feature:
Pure function =cj/--dev-setup-build-proposal SHAPE ROOT= returning a
structured plist of proposed blocks: one per subproject =.dir-locals.el=
(projectile compile/run/test + =cj/coverage-backend=), the optional starter
Makefile (only when none exists, adapted per shape per design § Tier 3),
and the gitignore append lines.
Files: =modules/dev-setup-config.el=.
Acceptance: given a shape plist, returns deterministic block list ready for
the review buffer; ERT cases cover each shape (Elisp / Go / Python / Node-TS
/ polyglot) plus the Tier-1 "Makefile already exists, suppress Makefile
block" branch.
Depends on: pure detection + parsing helpers.
*** TODO [#B] Review-buffer major mode + parser :feature:
Define =cj/dev-setup-review-mode= (derived from =emacs-lisp-mode=) with =C-c
C-c= / =C-c C-k= bindings, plus the pure parser
=cj/--dev-setup-review-buffer-parse CONTENTS= that turns buffer text back
into a block list. Banner syntax per design § Review Buffer (=;; ==== <path>
====[ <status>]==, gitignore special, Makefile special).
Files: =modules/dev-setup-config.el=, =tests/test-dev-setup-config.el=
(parser cases: well-formed multi-block, single block, empty body, missing
banner, malformed elisp inside a dir-locals block).
Acceptance: round-trip -- render proposal -> parse buffer -> equal block
list. Mode keybindings smoke-tested.
Depends on: starter-Makefile + .dir-locals.el proposal generator.
*** TODO [#B] Writer + status diff + projectile cache reset :feature:
Implement the =C-c C-c= writer: diff each parsed block against the on-disk
file to assign =UNCHANGED= / =WILL UPDATE= / =WILL CREATE=, write only the
non-UNCHANGED ones, append gitignore idempotently, never touch an existing
Makefile, honor the =;;; cj/dev-setup-project: ignore= escape hatch, clear
projectile's per-project command cache, print the summary line.
Files: =modules/dev-setup-config.el=, plus ERT cases for the diff +
idempotent-append logic against temp dirs.
Acceptance: re-run on an unchanged project writes nothing; renaming a
Makefile target flips one block to =WILL UPDATE=; ignore-marked files stay
untouched.
Depends on: review-buffer major mode + parser.
*** TODO [#B] Interactive command + smoke test :feature:tests:
Thin =cj/dev-setup-project= interactive wrapper: resolve project root via
projectile, run detection, build proposal, render the review buffer, pop to
it. One smoke test against a prepared temp project asserting the expected
files exist after a simulated =C-c C-c=.
Files: =modules/dev-setup-config.el=, =tests/test-dev-setup-config.el=. Add
=(require 'dev-setup-config)= to =init.el= (or the appropriate aggregator).
Acceptance: =M-x cj/dev-setup-project= on a fixture project opens the review
buffer; =C-c C-c= writes the expected files.
Depends on: writer + status diff + projectile cache reset.
*** TODO [#B] Resolve open questions + design follow-ups :cleanup:
Three design questions to close before / during implementation: (a) include
=make coverage= target in starter Makefile? (b) project-wide override file
=.cj-dev-setup.el=? (c) Cargo/pom detection.
Body: park decisions inline in the design doc or run =arch-decide= if they
turn out load-bearing.
Depends on: none, but easiest after the writer sub-task surfaces real
friction.
** TODO [#B] Pick and wire a debug backend for F5 :feature:
#+begin_src emacs-lisp
Give me an idea of the amount of work and complexity and what allows for a consistent UX across languages.
#+end_src
*** 2026-05-15 Fri @ 19:19:21 -0500 Inital Goals
Bind F5 globally to a debug entry point. Backend choice is the hard part:
- dape (Debug Adapter Protocol for Emacs) — modern, multi-language via DAP. Single UX across Python, Go, TS, Rust, etc. Less mature than DAP clients in other editors.
- realgud — wraps multiple debuggers (pdb, gdb, node --inspect, etc.). More mature; UX varies by backend.
- Language-specific stacks — dap-mode (python-mode + dap), delve for go, ts-node --inspect, etc. Best per-language UX; most config work.
F5 itself will be simple (start/resume debug). Likely modifier variants once the backend is picked:
- C-F5 toggle breakpoint at point
- M-F5 eval expression in debug context (or step-over shortcut)
Evaluate against these projects' languages: elisp (edebug already works), Python, Go, TS, shell. Shell debug is usually print-based; skip.
Do this after the F-key rework ticket ships so F5 is the only hole left.
** TODO [#B] Build debug-profiling.el module :feature:
Reusable profiling infrastructure for targeted slow-command investigation. Consolidates scattered profiler bindings (currently in =modules/config-utilities.el=) and adds two pure-helper-backed entry points: "profile next command" and "time region or sexp." Designed via =/brainstorm= 2026-04-26.
Design: [[file:../docs/design/debug-profiling.org][docs/design/debug-profiling.org]]
Implement via =/start-work= against the design — branch =feat/debug-profiling=, commits decomposed along the test-first split-for-testability boundary. Once shipped, use it as the v1 exercise on the queued [#B] org-capture target-building investigation.
** DOING [#B] Module-by-module hardening :harden:no-sync:
Review every file in =modules/= and capture concrete bugs, tests, refactors,
and design improvements as child tasks. This is intentionally separate from the
top-level architecture review: the architecture project tracks cross-cutting
load/startup/test structure, while this project tracks module-specific work.
Re-review pass 2026-05-15:
- Each of the six existing review tracks (foundation, custom editing, UI /
navigation, Org workflow, programming workflow, integrations and
applications) was re-walked as if it had not been reviewed before.
- 32 new sub-task findings filed across the tracks above (foundation 5,
custom editing 6, UI / navigation 9, Org workflow 3, programming 6,
integrations 2). Findings already covered by an existing sub-task were
dropped during consolidation.
- A separate =Review newly added modules= task lists the 24 modules that
were either added after the parent task was written (post-2026-04) or
fell outside the original scope lists. Each is routed to its target
track; module-specific findings are filed under the relevant track.
Review protocol for each module:
- Read the module directly, not just the test names.
- Check runtime dependencies, top-level side effects, keybindings, timers,
external executable assumptions, secrets, host-specific paths, and user-data
writes.
- Check existing test coverage and whether tests protect the highest-risk
behavior.
- Promote larger findings into child =PROJECT= tasks with phases. Keep small
fixes as plain =TODO= tasks.
Priority scheme: use the top-level =Priority Scheme= section in this file.
Suggested review order:
1. Foundation: =system-lib=, =user-constants=, =host-environment=,
=system-defaults=, =keybindings=, =config-utilities=, =early-init=,
=init=.
2. Custom editing utilities: =custom-*=, =external-open=, =media-utils=.
3. UI and navigation: =ui-*=, =font-config=, =modeline-config=,
=selection-framework=, =mousetrap-mode=, =popper-config=.
4. Org workflow: =org-*=, =calendar-sync=, =hugo-config=, =gloss-config=.
5. Programming workflow: =prog-*=, =dev-fkeys=, =test-runner=,
=coverage-*=, =vc-config=.
6. Integrations and applications: mail, Slack, ERC, Elfeed, EWW, Dirvish,
PDF, Calibre, music, recording/transcription, AI/rest tooling.
*** DOING [#B] Harden foundation modules :harden:
Scope:
- =system-lib.el=
- =user-constants.el=
- =host-environment.el=
- =system-defaults.el=
- =keybindings.el=
- =config-utilities.el=
- =early-init.el=
- =init.el=
Expected output:
- Add one child task for each actionable finding.
- Note "no action" only when the module has been reviewed and no task is
needed.
- Cross-reference existing architecture tasks instead of duplicating them.
Review progress:
- =system-lib.el=: reviewed 2026-05-03. No immediate action beyond the existing
[#B] system-lib extraction task.
- =host-environment.el=: reviewed 2026-05-03. See child tasks below.
- =user-constants.el=: reviewed 2026-05-03. See child tasks below.
- =system-defaults.el=: reviewed 2026-05-03. See child tasks below.
- =keybindings.el=: reviewed during architecture pass. No new module-specific
action beyond the load-order/keymap architecture tasks.
- =config-utilities.el=: reviewed 2026-05-03. No new module-specific action;
profiling extraction is already tracked by [#B] "Build debug-profiling.el
module".
- =early-init.el=: reviewed 2026-05-10. See child tasks below and the existing
[#B] "Split early startup from package bootstrap" task.
- =init.el=: reviewed 2026-05-10. See child tasks below and the existing
eager load-graph architecture tasks.
Completion review 2026-05-15:
- Re-read the parent =Module-by-module review and hardening= context and the
adjacent architecture follow-up so this review stays module-specific.
- Re-checked all scoped files against the review protocol. Existing child
tasks below still cover the actionable module findings for
=user-constants.el=, =host-environment.el=, =system-defaults.el=, and
=early-init.el=.
- =system-lib.el=, =keybindings.el=, =config-utilities.el=, and =init.el= do
not need additional module-specific child tasks from this pass; remaining
concerns are already tracked by the utility-consolidation, keymap
registration, debug-profiling, and eager-load-graph architecture tasks.
**** PROJECT [#B] Split path constants from filesystem initialization in =user-constants.el= :refactor:
=user-constants.el= defines paths and immediately creates directories/files at
module load time. That makes a simple =(require 'user-constants)= write to the
filesystem, including org files and calendar placeholder files. This is useful
for interactive startup but brittle for tests, batch tools, and future
autoloading.
***** TODO [#B] Extract pure path definitions from startup writes :refactor:
Expected outcome:
- Loading path constants should not create files by default.
- Put filesystem creation behind an explicit command/hook, e.g.
=cj/initialize-user-directories-and-files= called from startup/wrap-up, not
from the constant module's top level.
- Keep startup behavior equivalent in normal interactive Emacs.
Pitfalls:
- Some modules may assume =gcal-file=, =pcal-file=, =dcal-file=, agenda files,
or org inbox files already exist. Handle those call sites deliberately.
- Calendar placeholder creation may belong in =calendar-sync= or
=org-agenda-config=, not in generic constants.
***** TODO [#B] Make initialization failures actionable :refactor:
=cj/verify-or-create-dir= and =cj/verify-or-create-file= currently catch errors
and only =message= them. That can hide a broken environment until a later module
fails less clearly.
Expected outcome:
- Decide which paths are required vs optional.
- Required path failures should signal a clear =user-error= or startup warning
that is hard to miss.
- Optional path failures should be logged but not block startup.
- Add tests around success, optional failure, and required failure behavior.
**** TODO [#B] Clean up host environment predicates and timezone detection :cleanup:refactor:
Small module-specific cleanup in =host-environment.el=:
- =env-desktop-p= has a docstring that says "host is a laptop"; it should say
desktop / no battery.
- =env-x-p= uses =(string= (window-system) "x")= while =env-x11-p= uses symbol
comparison. Existing tests pass, but the two predicates should use one style
and document the difference between "X display" and "X11 not Wayland".
- =cj/match-localtime-to-zoneinfo= reads every zoneinfo file and compares
contents. That is fine as a fallback, but it is expensive enough to consider
caching or preferring symlink/env methods first if this ever runs during
startup.
Acceptance criteria:
- Fix the docstring.
- Normalize or document =env-x-p= vs =env-x11-p= semantics.
- Add or adjust tests only if behavior changes.
**** TODO [#B] Add minimal =system-defaults.el= setting smoke tests :tests:
=system-defaults.el= has no direct test file, despite holding high-impact
defaults: server startup, backup behavior, custom-file behavior, symlink
prompting, minibuffer GC hooks, backup directory, and mouse/key disabling.
Keep this narrow; do not test Emacs itself. Good smoke assertions:
- =vc-follow-symlinks= has the intended explicit value.
- =custom-file= points at a temp file and is not loaded from the repo.
- =backup-directory-alist= points inside =user-emacs-directory/backups=.
- Minibuffer GC hooks are registered.
This should be done after the =vc-follow-symlinks= fix so the test captures the
correct behavior.
**** TODO [#B] Move package bootstrap policy out of =early-init.el= :startup:refactor:
=early-init.el= currently handles performance/debug setup, package archive
construction, archive refresh policy, =use-package= installation, package
signature policy, and Unicode defaults. That makes early startup do network- and
package-manager-adjacent work before the regular module system exists.
This overlaps with the existing [#B] "Split early startup from package
bootstrap" task; keep the implementation there if that task is already active.
This foundation review finding is the module-level acceptance detail.
Expected outcome:
- =early-init.el= keeps only settings that must happen before normal init:
startup GC/file-handler tuning, debug flag setup, native-comp workaround,
=load-prefer-newer=, site-start suppression, and package startup suppression.
- Package archive setup, refresh/install policy, and =use-package= bootstrap
live in a normal module or bootstrap helper that can be tested directly.
- Offline and missing-package states produce actionable errors without doing an
unexpected package refresh during early startup.
- Existing local repo and ELPA mirror behavior is preserved.
Pitfalls:
- Do not break first-run bootstrap on a clean machine.
- Keep local repositories higher priority than online archives.
- Avoid prompting or refreshing archives during batch tests.
**** TODO [#B] Decide and test package signature policy :security:startup:
=early-init.el= sets =package-check-signature= to =nil= after package setup, with
an earlier commented emergency toggle for expired signatures. That may be
intentional for local mirrors, but it is security-sensitive enough to make the
policy explicit.
Expected outcome:
- Document when signatures should be disabled, if ever.
- Prefer signatures on for online archives unless a local-mirror workflow
requires otherwise.
- If signatures stay disabled, add a clear comment explaining the trust model.
- Add a small test or validation helper around the computed package policy if
package bootstrap is extracted.
**** TODO [#C] Consolidate duplicate =user-home-dir= constant :cleanup:
=user-home-dir= is defined identically in =early-init.el:116-117= and
=modules/user-constants.el:74-75=. early-init.el defines it first
because =package-archive= paths reference it, then user-constants.el
redefines it. Both definitions silently drift if one is edited.
Consolidate: keep early-init.el's definition (load-order requirement)
and reference it from user-constants.el with a comment explaining why
the constant lives in early-init.
**** TODO [#C] Drop redundant =eval-when-compile= alongside autoload in =system-defaults.el= :cleanup:
=modules/system-defaults.el:20-24= wraps host-environment and
user-constants under =eval-when-compile= require forms, then line 24
also declares =(autoload 'env-bsd-p "host-environment" nil t)=. The
=eval-when-compile= is redundant given the autoload; the mixed pattern
suggests one of the two requires was added without removing the other.
Pick one boundary and document it.
**** TODO [#C] Convert =cj/debug-modules= and =cj/use-online-repos= to =defcustom= :refactor:
These are user-facing toggles defined as =defvar= in
=modules/user-constants.el:25-30= and =early-init.el:84-87=. Users
cannot discover or change them through =M-x customize=. Convert to
=defcustom= with =:type=, =:group=, and a docstring so they show up in
the customization UI alongside other config knobs.
**** TODO [#B] Surface custom-file redirection so accidental Customize use isn't silent :safety:
=modules/system-defaults.el:91-92= sends Customize UI writes to a
temp file (=emacs-customizations-trashbin-...=) that is never read
back. This is intentional -- the convention is to manage config in
Elisp -- but it silently discards user edits made through =M-x customize=.
A user who occasionally clicks "Save for Future Sessions" in a
Customize buffer loses those changes on Emacs exit. Either surface a
=display-warning= on first =custom-set-variables= attempt, or set
=custom-file= to a versioned path under =data/= so the discard is at
least durable for the session.
**** TODO [#C] Name and document package archive priorities :refactor:
=early-init.el:149-180= assigns priorities as magic numbers
(localrepo=200, gnu-local=125, melpa-local=115, online gnu=25,
melpa=15, melpa-stable=5). Future maintainers cannot answer "why is
gnu-local 125 but melpa-local 115?" without re-deriving the
hierarchy. Define named constants
(=cj/package-priority-local-mirror=, =cj/package-priority-online=,
etc.) at the top of early-init.el with a short comment explaining the
local-first ordering.
**** TODO [#C] Remove dead world-clock block in =chrono-tools.el= :cleanup:
Lines 23-41 carry a 19-line commented-out =use-package time= block
("old world-clock config while testing time-zone package above") left
over from the time-zones migration. Either delete it or replace with
a one-line breadcrumb noting that =time-zones= superseded it. Dead
commented code lengthens the file with no value to future readers.
**** TODO [#C] Add coverage for =cj/tmr-select-sound-file= in =chrono-tools.el= :tests:
The two TMR sound-selection helpers (=cj/tmr-select-sound-file= and
=cj/tmr-reset-sound-to-default=) currently have no tests. The select
function has nontrivial branching across the prefix-arg path, the
missing-directory path, the empty-directory path, the cancel path,
and the "default selected" message variant. Refactor the
prefix-arg branch to call =cj/tmr-reset-sound-to-default= directly
so the duplication collapses, then add Normal/Boundary/Error tests
against the resulting helper.
*** DOING [#B] Harden custom editing utility modules :harden:
Scope:
- =custom-buffer-file.el=
- =custom-case.el=
- =custom-comments.el=
- =custom-datetime.el=
- =custom-line-paragraph.el=
- =custom-misc.el=
- =custom-ordering.el=
- =custom-text-enclose.el=
- =custom-whitespace.el=
- =external-open.el=
- =media-utils.el=
Review progress:
- Core =custom-*= text modules reviewed 2026-05-03. They have unusually strong
direct ERT coverage compared with the rest of the config.
- =external-open.el= and =media-utils.el= reviewed 2026-05-03. See child tasks.
- =custom-buffer-file.el= reviewed 2026-05-03. See child tasks.
Completion review 2026-05-15:
- Re-checked the scoped custom editing utility modules and their test files.
- The pure editing modules remain well covered by focused ERT tests.
- Remaining actionable issues are already logged below: process-launch
hardening and coverage for =external-open.el= / =media-utils.el=,
destructive buffer/file keybinding policy, and explicit cross-module
autoload/require boundaries.
**** TODO [#B] Harden external process launching in =external-open.el= and =media-utils.el= :security:refactor:
=external-open.el= and =media-utils.el= use shell command strings for launching
external applications:
- =cj/open-this-file-with= interpolates the user-supplied command into
=call-process-shell-command=.
- =cj/media-play-it= builds a shell command for players and optional =yt-dlp=
stream extraction.
This is mostly controlled local input, but it is still brittle: command paths
with spaces can fail, arguments are hard to reason about, and future URL/source
changes could create shell quoting bugs.
Expected outcome:
- Prefer =start-process= / =call-process= with argv lists where possible.
- If shell is required for command substitution, isolate and quote every
untrusted value.
- Add tests around command construction for:
- file paths with spaces and shell metacharacters,
- URL strings with shell metacharacters,
- configured player args,
- missing executable errors.
Pitfalls:
- =cj/open-this-file-with= may intentionally accept "program plus args". If so,
split the command deliberately or introduce separate program/args prompts.
- Some media players need different URL handling; preserve the existing
=:needs-stream-url= behavior.
**** TODO [#B] Add coverage for =external-open.el= and =media-utils.el= :tests:
The core custom editing modules are covered, but these integration helpers have
little or no direct test coverage despite owning shell/process boundaries.
Useful test seams:
- Pure command-builder helpers for external open and media play.
- Player availability selection from =cj/media-players=.
- Error behavior when =yt-dlp=, =tsp=, or the selected player is missing.
- Advice behavior for externally opened file extensions should not leave
surprising buffers behind.
This pairs naturally with the process-launch hardening task above.
**** TODO [#B] Audit destructive buffer/file keybindings for confirmation policy :ux:
=cj/buffer-and-file-map= includes destructive operations under =C-; b=,
including delete file, erase buffer, clear top, clear bottom, and revert. Some
are intentionally fast, but this module is high blast radius.
Expected outcome:
- Decide which operations need confirmation when the buffer is modified or
visiting a file.
- At minimum, document the intended policy in =custom-buffer-file.el=.
- Consider safer wrappers for =erase-buffer= and =revert-buffer= under the
personal keymap.
**** TODO [#B] Add explicit autoloads/requires for cross-module command keybindings :cleanup:refactor:
Several custom utility keymaps bind symbols owned by other modules without
declaring the relationship:
- =custom-ordering.el= binds =cj/org-sort-by-todo-and-priority=.
- =custom-text-enclose.el= binds =change-inner= and =change-outer=.
- =custom-buffer-file.el= binds =cj/kill-buffer-and-window= and external-open
commands.
These work in the current eager =init.el= load order, but standalone module
loading and future deferral will be cleaner if the dependencies are explicit.
Expected outcome:
- Use =autoload= for commands that should remain lazy.
- Use =declare-function= for byte-compiler clarity when only the symbol is
needed.
- Add a simple module-load smoke test if this becomes part of the load-graph
refactor.
**** TODO [#C] Reconcile region-or-buffer scope across editing helpers :bug:
=modules/custom-text-enclose.el:135-180= helpers
(=cj/append-to-lines-in-region-or-buffer=,
=cj/prepend-to-lines-in-region-or-buffer=) fall back to the whole
buffer when no region is active. =modules/custom-ordering.el:38-41=
and =:86-88= helpers
(=cj/--arrayify=, =cj/--unarrayify=) accept explicit =(start end)=
parameters but their docstrings imply "region or entire buffer" --
the implementation does not match. Pick one contract per pair and
update docstrings, or extract a shared helper that decides the
target range.
**** TODO [#C] Preserve trailing newlines in custom-ordering output :bug:
=modules/custom-ordering.el:38-41,86-88= splits input on whitespace
and commas without tracking a trailing newline. Compare with
=custom-text-enclose.el=, which explicitly records and restores a
trailing newline. When the user invokes ordering on a buffer whose
last line ends with =\n=, the output drops it -- which then breaks
line-oriented operations on the result.
**** TODO [#C] Guard =cj/duplicate-line-and-comment= against non-file buffers :safety:
=modules/custom-line-paragraph.el:79-93= calls =(cj/comment-line)= via
delegation. =comment-line= reads =comment-start= from the current
major-mode's syntax tables, which is unreliable in non-file buffers
(=*scratch*= sometimes works, fundamental-mode buffers do not). The
duplicate-and-comment flow silently produces malformed output in
those buffers. Either error out clearly or only enable the binding
in modes that have a comment syntax.
**** TODO [#C] Make =external-open.el= advice setup idempotent at load time :cleanup:
=modules/external-open.el:150-151= runs =advice-remove= followed by
=advice-add= unconditionally during module load. The pair is
idempotent-by-construction, but the pattern leaves no signal that the
module guards against duplicate loads -- if the module ever stops
being load-once, the advice list grows. Wrap the setup in a guarded
form or move it behind an explicit init function.
**** TODO [#C] Validate comment-delimiter character in =custom-comments.el= :safety:
The comment-divider / border helpers in =modules/custom-comments.el=
accept a delimiter string with no length or printability check.
Passing =\n=, =\t=, or a multi-character string produces malformed
output that can corrupt subsequent =M-q= flows. Add a guard:
=(unless (and (stringp delim) (= (length delim) 1) (string-match-p "[[:print:]]" delim))
(user-error "..."))=
**** TODO [#C] Add coverage for =cj/title-case-region= state machine :tests:
=modules/custom-case.el:40-120= implements title-casing via a
character-by-character state machine (case rules, leading-quote /
paren handling). No focused tests exercise: empty region, unicode
boundaries (combining marks, RTL), sequences of numbers + symbols,
opening quote characters. The state machine is the kind of helper
that fails silently on the unusual case -- ERT coverage on those
inputs catches regressions during refactors.
**** TODO [#C] De-duplicate spell-checker availability guard in =flyspell-and-abbrev.el= :cleanup:
=cj/flyspell-toggle= and =cj/flyspell-then-abbrev= each carry an
identical =(unless (or (executable-find "aspell") (executable-find
"ispell") (executable-find "hunspell")) (user-error ...))= block.
Extract into =cj/--require-spell-checker= and call from both sites.
Keeps the executable list in one place when a new checker (e.g.
nuspell) is added.
**** TODO [#C] Add coverage for =cj/flyspell-then-abbrev= and helpers in =flyspell-and-abbrev.el= :tests:
The interactive flow has real logic worth pinning: previous-
misspelling overlay walk in =cj/find-previous-flyspell-overlay=
(face-change check, list reversal), the abbrev-table choice in
=cj/flyspell-then-abbrev= (prefix arg switches local vs global), and
the buffer-type dispatch in =cj/flyspell-on-for-buffer-type= (prog-
mode -> flyspell-prog-mode vs text-mode -> flyspell-mode). None of
these have tests. Pure-logic helpers can be exercised against
synthetic overlay buffers without aspell on the path.
*** DOING [#B] Harden UI and navigation modules :harden:
Scope:
- =ui-config.el=
- =ui-navigation.el=
- =ui-theme.el=
- =font-config.el=
- =modeline-config.el=
- =selection-framework.el=
- =mousetrap-mode.el=
- =popper-config.el=
Review progress:
- Reviewed 2026-05-03.
- =mousetrap-mode.el= has strong focused and integration tests.
- =modeline-config.el= has pure string-helper coverage, but not VC/runtime
segment behavior.
- =font-config.el=, =ui-theme.el=, =selection-framework.el=, =ui-navigation.el=,
and =popper-config.el= have little direct test coverage.
Completion review 2026-05-15:
- Re-checked the scoped UI/navigation modules and current tests.
- =mousetrap-mode.el=, =ui-navigation.el=, =ui-theme.el=,
=selection-framework.el=, and selected modeline/UI helpers now have focused
tests, but the font/modeline/popper runtime policy remains under-tested.
- Existing cleanup below covers the disabled =popper-config.el= load-graph
issue; added a separate test-gap task for the remaining UI smoke coverage.
**** TODO [#B] Add UI/navigation runtime smoke coverage :tests:
Several UI modules are mostly top-level runtime configuration and currently
have only partial helper coverage. The highest-value missing assertions are:
- =font-config.el=: font fallback/daemon frame setup does not error when
optional fonts or emoji packages are absent.
- =modeline-config.el=: runtime segment assembly handles missing VC/project
data and does not signal in non-file buffers.
- =popper-config.el=: if the module remains in =init.el= while disabled, a
smoke test should prove requiring it is an intentional no-op.
Keep these tests batch-safe by stubbing frame/font/package functions rather
than depending on a graphical session.
**** TODO [#B] Decide whether =popper-config.el= should exist while disabled :cleanup:
=popper-config.el= is required by =init.el=, but the only =use-package popper=
form is =:disabled t=. That makes the module a no-op while still participating
in the load graph.
Expected outcome:
- Either remove it from =init.el= until Popper is wanted, or re-enable and test
the popup behavior.
- If kept disabled, add a clear task/comment explaining why it remains.
This is low priority, but it is a good example of load graph noise to clean up
during the =init.el= deferral work.
**** TODO [#B] Move =popper-mode= activation out of =:init= so =:disabled t= actually disables it :bug:
=modules/popper-config.el:40= activates =(popper-mode +1)= inside the
=use-package= =:init= block. =use-package='s =:disabled t= keyword
prevents =:config= from running but =:init= forms run unconditionally.
The =:disabled= marker is therefore a no-op: popper-mode is enabled
on every load, including batch / test runs. Move the activation into
=:config= so disabling actually disables it.
**** TODO [#C] Gracefully fallback in =cj/modeline-vc-fetch= when =vc-git--symbolic-ref= is missing :safety:
=modules/modeline-config.el:149-151= calls the internal
=vc-git--symbolic-ref= without a fallback if Emacs's =vc-git=
implementation changes. Internal functions can be renamed or
removed between Emacs versions. When that happens, the modeline
errors during render, which blocks =mode-line-format= and produces a
confusing failure. Add an =fboundp= guard and fall back to
=(vc-working-revision file backend)= when the internal accessor is
unavailable.
**** TODO [#C] Use theme-aware faces in =cj/display-available-fonts= :refactor:
=modules/font-config.el:266= hardcodes ="Light Blue"= and gray
foreground for font labels. Switching themes (especially light
themes) makes the labels nearly unreadable. Replace the literal
color with a face reference (=font-lock-keyword-face= or a face this
config owns) so the labels follow theme contrast.
**** TODO [#C] Handle TTY-first frame race in font setup :safety:
=modules/font-config.el:168-176= checks =(env-gui-p)= once at module
load. In daemon mode, when the first =emacsclient -t= creates a TTY
frame, the check returns nil and font setup never runs. A
later =emacsclient -c= creating a GUI frame inherits no font
configuration. Either move the GUI check inside
=server-after-make-frame-hook= (per-frame), or invoke font setup
unconditionally and let Emacs handle terminal frames gracefully.
**** TODO [#C] Cache =mousetrap-mode= keymap rebuilds per profile :performance:
=modules/mousetrap-mode.el:231-233= registers =mouse-trap-maybe-enable=
on every major-mode hook (text, prog, special, plus custom profile
modes). Each mode switch rebuilds the keymap from scratch (~8
prefixes × ~30 events). Rapid mode-switching workflows (project
switching, multi-buffer review) pay a measurable cost. Cache by
profile + active-events list and skip rebuild when the cache key
matches.
**** TODO [#C] Invalidate VC modeline cache on file symlink target changes :tests:
=modules/modeline-config.el:131-140= keys the cache on =(list file
cj/modeline-vc-show-remote)=. If =file= is a symlink whose target
moves (rare but possible on shared drives, CI workspaces), the cache
stays warm with the old VC backend. Add the resolved =file-truename=
to the key, or invalidate the cache when =vc-backend= disagrees with
the cached entry.
**** TODO [#B] Move =C-s= binding into =consult= =:bind= for =isearch-mode-map= :safety:
=modules/selection-framework.el:253= binds =C-s= globally to
=cj/consult-line-or-repeat=. The same module's =consult= =:bind=
block rebinds =M-s e= in =isearch-mode-map=. Once isearch is active,
pressing =C-s= should advance to the next match -- isearch's own
keymap convention -- but the global binding shadows that and exits
isearch into consult-line. Move the =C-s= binding into the consult
=:bind= block under =:map isearch-mode-map= to preserve isearch's
in-mode contract.
**** TODO [#C] Guard cursor-color =post-command-hook= behind =display-graphic-p= :safety:
=modules/ui-config.el:125,137= registers =cj/set-cursor-color-according-to-mode=
on =post-command-hook= unconditionally. In batch / test runs and TTY
sessions, the hook fires on every command but the cursor color logic
is meaningless. Guard the =add-hook= behind
=(display-graphic-p)= or move it inside =server-after-make-frame-hook=
so it activates only for GUI frames.
**** TODO [#C] Defer =nerd-icons-config= advice with =with-eval-after-load= :refactor:
=modules/nerd-icons-config.el:73-75= uses =:demand t= and applies
icon-color advice via =dolist= at module load. This makes
nerd-icons eagerly load on every Emacs start (not just when an icon
is rendered). Wrap the advice block in
=(with-eval-after-load 'nerd-icons ...)= so the advice still applies
but nerd-icons can stay deferred for batch and headless contexts.
*** DOING [#B] Harden Org workflow modules :harden:
Scope:
- =org-config.el=
- =org-agenda-config.el=
- =org-babel-config.el=
- =org-capture-config.el=
- =org-contacts-config.el=
- =org-drill-config.el=
- =org-export-config.el=
- =org-noter-config.el=
- =org-refile-config.el=
- =org-reveal-config.el=
- =org-roam-config.el=
- =org-webclipper.el=
- =calendar-sync.el=
- =hugo-config.el=
- =gloss-config.el=
Review progress:
- Reviewed 2026-05-03 at high level.
- =calendar-sync.el= has substantial focused coverage for parsing, recurrence,
timezone conversion, event conversion, and regressions. The largest remaining
risks are configuration/secrets, startup side effects, and process/network
boundaries.
- =org-agenda-config.el= and =org-refile-config.el= now have useful cache tests,
but the cache lifecycle and startup idle timers still deserve a design pass.
- =org-noter-config.el= already has an older [#B] workflow VERIFY task. Do not
duplicate that work here.
- =hugo-config.el= and =org-reveal-config.el= have focused helper coverage.
- =gloss-config.el= is a thin package wrapper; no local unit-test target unless
custom glue is added.
- Deeper pass 2026-05-10 added follow-up tasks for org-roam done hooks, drill
file selection/package loading, Org export defaults, Babel templates, and
contact/Mu4e boundaries.
Completion review 2026-05-15:
- Re-checked the scoped Org workflow modules and their test coverage.
- The broad parser/cache/helper areas now have useful focused tests, especially
=calendar-sync.el=, agenda/refile helpers, org-roam helpers, org-noter, Hugo,
reveal, and webclipper processing.
- Remaining issues are already logged below, including security-sensitive
calendar config and Babel evaluation policy, cache lifecycle/timer behavior,
org-roam destructive workflow guardrails, executable checks, capture-template
smoke tests, and Org workflow ownership documentation.
**** PROJECT [#A] Split personal calendar configuration from =calendar-sync.el= :security:refactor:
=calendar-sync.el= is a reusable sync engine, but it also defines the personal
=calendar-sync-calendars= value at top level. The concrete URLs are private feed
tokens, so they should be rotated and moved out of source. This overlaps the
top-level architecture/security item; this module task tracks the implementation
shape.
***** TODO [#A] Load calendar definitions from a private source :refactor:
Expected outcome:
- =calendar-sync.el= should default =calendar-sync-calendars= to nil or a safe
placeholder.
- Put real calendar plists in private machine config, auth-source, env-backed
elisp, or an ignored file loaded from =custom-file= / host config.
- =calendar-sync-status= and =calendar-sync-start= should explain missing config
clearly without erroring.
Pitfalls:
- =org-agenda-config.el= expects =gcal-file=, =pcal-file=, and =dcal-file= in
agenda file lists. Missing calendar config should not break agenda startup.
- Avoid logging URLs on fetch failures.
**** PROJECT [#B] Normalize Org agenda/refile cache lifecycle :perf:refactor:
=org-agenda-config.el= and =org-refile-config.el= both solve the same startup
problem with hand-rolled globals: cache value, cache time, TTL, "building" flag,
idle timer, force-refresh command, and a synchronous fallback. The behavior is
useful, but the implementation is duplicated and has edge cases.
***** TODO [#B] Extract a small reusable cache helper or shared pattern :refactor:
Expected outcome:
- Keep the agenda and refile public commands unchanged.
- Share the common "valid cache or rebuild" control flow, or at least document
why the two implementations intentionally differ.
- Make "build in progress" semantics real. Today the message says "waiting",
but the code continues into a rebuild path rather than waiting or using the
old cache.
***** TODO [#B] Make directory scan failures visible but non-fatal
=org-refile-config.el= silently ignores =permission-denied= while scanning
directories, and =org-agenda-config.el= assumes =projects-dir= exists and is
readable. These are acceptable interactive defaults only if the resulting
agenda/refile target list tells the user what was skipped.
Expected outcome:
- Missing optional roots should log a concise warning once per refresh.
- Required roots should produce an actionable error.
- Tests should cover missing =projects-dir= and permission/error cases by
stubbing directory functions.
***** TODO [#C] Suppress startup idle timers in batch/test contexts
Both modules start cache builders with =run-with-idle-timer= at top level. That
is fine for interactive startup, but awkward for tests and batch commands.
Expected outcome:
- Gate the idle timers behind =(not noninteractive)= or an explicit startup
function.
- Preserve normal interactive behavior.
- Add a smoke test that requiring the modules in batch does not schedule cache
builders.
**** TODO [#A] Revisit =org-confirm-babel-evaluate= default :security:
=org-babel-config.el= sets =org-confirm-babel-evaluate= to nil globally. That
means every source block in every Org file can execute without confirmation,
including files from cloned repos, downloaded notes, or web clips.
Expected outcome:
- Decide whether the global default should be safe (=t=) with a fast toggle for
trusted buffers/projects, or whether only selected languages should skip
confirmation.
- Keep =babel-confirm= or replace it with a clearer command that reports and
toggles the current policy.
- Add a test/smoke assertion for the chosen default.
**** TODO [#B] Add guardrails to =cj/move-org-branch-to-roam= :ux:
=org-roam-config.el= implements =cj/move-org-branch-to-roam= by copying the
subtree, cutting it from the source buffer, writing a new roam file, and syncing
the database. There is no confirmation, rollback, or save behavior around the
destructive step.
Expected outcome:
- Confirm before cutting large subtrees or when the source buffer is modified.
- Write the new file before deleting source content, and avoid losing the
subtree if file creation or =org-roam-db-sync= fails.
- Decide whether the source buffer should be saved automatically or left dirty.
- Add tests around the pure slug/demotion/format helpers are already present;
add one integration-style test around failure ordering if feasible.
**** TODO [#B] Make =org-webclipper.el= initialization less global-state-heavy :cleanup:refactor:
=org-webclipper.el= stores protocol URL/title in global variables, registers
capture templates lazily, and clears those globals during template expansion.
That is workable for one-at-a-time org-protocol calls, but brittle if a capture
is interrupted or nested.
Expected outcome:
- Prefer passing URL/title through the capture plist or a lexical wrapper rather
than global temp vars where possible.
- Ensure aborted captures clear temp state.
- Keep the existing browser bookmarklet workflow unchanged.
**** TODO [#B] Review external executable assumptions in Org export/publishing modules :cleanup:
=org-export-config.el= assumes =zathura= for one Pandoc PDF path, =hugo-config.el=
assumes =hugo= and a browser/file-manager opener, =org-reveal-config.el= assumes
a local =reveal.js= checkout, and =org-webclipper.el= assumes Pandoc through
=org-web-tools=.
Expected outcome:
- Add explicit executable/directory checks before commands run.
- Error messages should name the missing tool and the command/setup needed.
- Keep startup quiet; only check expensive/external requirements when the
relevant command runs.
**** TODO [#B] Guard the org-roam completed-task hook around non-file buffers :bug:refactor:
=org-roam-config.el= adds a global =org-after-todo-state-change-hook= that
copies newly completed tasks to today's org-roam journal. The hook assumes the
current Org buffer is visiting a file:
- It calls =(buffer-file-name)= and passes the result to =string=.
- =cj/org-roam-copy-todo-to-today= later compares =file-truename= of the daily
file and the current buffer file.
That can error in capture buffers, indirect buffers, temporary Org buffers, or
other fileless Org workflows.
Expected outcome:
- Extract a predicate for "should copy this completed task to today's journal".
- Skip fileless buffers, calendar sync files, aborted capture buffers, and tasks
already in the target daily file.
- Keep the normal completed-task journal workflow unchanged.
- Add tests for fileless buffers, =gcal-file=, already-daily buffers, and a
normal project/todo buffer.
**** TODO [#B] Make Org drill file selection robust and shared :bug:refactor:
=org-capture-config.el= and =org-drill-config.el= both scan =drill-dir= for
candidate =.org= files with inline =directory-files= calls. If =drill-dir= is
missing, empty, or unreadable, the user gets a low-level error from whichever
command happened to run.
Expected outcome:
- Extract one helper that returns valid drill files or signals a clear
=user-error=.
- Use it from drill capture templates, =cj/drill-start=, and =cj/drill-edit=.
- Preserve the current completing-read workflow when files exist.
- Add tests for missing directory, empty directory, and normal selection list.
**** TODO [#B] Clarify contradictory Org export task defaults :cleanup:tests:
=org-export-config.el= sets =org-export-with-tasks= twice in a row: first to
=("TODO")= and then to =nil=. The final behavior is "export no tasks", but the
adjacent comments describe both policies.
Expected outcome:
- Pick the intended default and remove the contradictory assignment/comment.
- Add a narrow smoke test for the chosen =org-export-with-tasks= value after
=ox= config loads.
- If task export should vary by workflow, expose an explicit command or local
export option instead of relying on the global default.
**** TODO [#B] Fix and cover Org Babel structure templates :bug:tests:
=org-babel-config.el= adds a Java structure template as =("java" . "src javas")=,
which appears to expand to the wrong language name. The template list is useful
but currently untested, so small typos can persist unnoticed.
Expected outcome:
- Correct the Java template or remove it if Java blocks are not used.
- Add a focused test that loads the Org Tempo config and asserts key templates
expand to the intended language names for common aliases: =bash=, =zsh=,
=el=, =py=, =json=, =yaml=, and =java=.
**** TODO [#B] Make org-contacts/Mu4e boundaries explicit :cleanup:refactor:
=org-contacts-config.el= defines helpers that call Mu4e functions when the
current major mode is a Mu4e mode, and the =use-package org-contacts= block is
=:after (org mu4e)= while also requiring =mu4e= inside =:config=. This works in
the current eager setup, but the ownership boundary is unclear now that
=mu4e-org-contacts-integration.el= exists.
Expected outcome:
- Decide whether contact capture-from-email behavior belongs in
=org-contacts-config.el= or the Mu4e integration modules.
- Add =declare-function= / autoloads or move Mu4e-specific code behind
=with-eval-after-load 'mu4e=.
- Keep plain Org contact commands usable on systems without Mu4e loaded.
- Add a smoke test for loading =org-contacts-config.el= without Mu4e stubs if
practical.
**** TODO [#B] Add an Org workflow health check command :feature:ux:
Several Org workflow modules depend on personal paths, optional external tools,
and local package checkouts. Failures currently show up at command time in
different ways, depending on which module hits the missing dependency first.
Recommended improvement:
- Add a lightweight =cj/org-workflow-doctor= command that checks the main Org
workflow prerequisites without mutating user data.
- Report status for core files/directories: =org-dir=, =roam-dir=, =drill-dir=,
=contacts-file=, =webclipped-file=, =cj/hugo-content-org-dir=, and
=cj/reveal-root=.
- Report optional executable/package availability for Pandoc/org-web-tools,
Hugo, reveal.js, org-drill, org-roam, and org-noter.
- Keep startup quiet; run this only on demand.
- Make the checker return structured data so it can be unit-tested and displayed
either in Messages or a buffer.
**** TODO [#B] Add capture-template key collision and target smoke tests :tests:
Org capture templates are assembled across =org-capture-config.el=,
=org-contacts-config.el=, =org-webclipper.el=, and other feature modules. The
current setup works, but template ownership is implicit and duplicate keys or
missing target files would be easy to miss.
Recommended improvement:
- Add a test helper that loads the Org capture-related modules with temp path
bindings.
- Assert template keys are unique or intentionally overridden.
- Assert templates that write to files point at non-empty path variables.
- Cover lazy additions for contact and webclipper templates without requiring a
browser/org-protocol round trip.
**** TODO [#B] Document Org workflow module ownership and load boundaries :docs:refactor:
The Org workflow is spread across many modules with overlapping responsibilities:
capture templates, keymaps, org-protocol handlers, refile/agenda target
construction, roam notes, publishing, and document annotation. The code is
usable, but future load-order work will be easier with explicit ownership notes.
Recommended improvement:
- Add a short design note under =docs/design/= that maps each Org module to the
behavior it owns.
- Call out which modules may mutate global Org variables, capture templates,
keymaps, and protocol handlers.
- Define which modules should be safe to load in batch mode and which are
allowed to start timers or require interactive packages.
- Link this note from the Org workflow review task and the broader load-graph
refactor.
**** TODO [#C] De-duplicate =org-protocol-protocol-alist= registration in =org-webclipper= :cleanup:
The =webclip= protocol handler is registered twice:
=modules/org-webclipper.el:72-76= inside =cj/webclipper-ensure-initialized=
(unconditional =add-to-list=) and =:207-214= inside a
=with-eval-after-load 'org-protocol= block (=unless (assoc ...)= guard).
=add-to-list= uses =equal= membership so the two are effectively
idempotent, but maintaining two registration paths invites drift if
the alist entry shape ever changes. Pick one site -- the
=with-eval-after-load= block is the more robust location -- and
remove the other.
**** TODO [#C] Validate =:url= and =:title= in =cj/org-protocol-webclip= :safety:
=modules/org-webclipper.el:124-125= extracts =:url= and =:title= from
the incoming protocol plist with no type or nil check. An unexpected
plist shape silently sets the globals to nil, and downstream code
fails inside the capture handler with confusing messages. Guard with
=(unless (and (stringp url) (not (string-empty-p url))) (user-error ...))=
before stashing.
**** TODO [#C] Replace global mutation of =cj/webclip-current-url= / =title= with structured state :refactor:
=modules/org-webclipper.el:128-129,151-152= relies on two top-level
variables (=cj/webclip-current-url=, =cj/webclip-current-title=)
=setq='d by the protocol handler and read by the capture template.
Concurrent or rapidly-fired protocol invocations interleave and
corrupt each other's state. Pass the data through a plist on
=org-capture-plist=, a per-invocation closure, or a queue, instead of
global mutation.
**** TODO [#C] Declare cross-module free variables in =mu4e-org-contacts-integration.el= :cleanup:quick:
The module reads =contacts-file= (defined in =user-constants.el=) and
calls =cj/get-all-contact-emails= (defined in =org-contacts-config.el=)
without any forward declaration at the top of the file. Byte-compile
in isolation warns about both as free variables / unknown functions.
Add =(eval-when-compile (defvar contacts-file))= and
=(declare-function cj/get-all-contact-emails "org-contacts-config")=
near the existing requires so the compile is clean and the
cross-module dependency is explicit at the top of the file.
**** TODO [#C] Add coverage for =mu4e-org-contacts-integration.el= completion logic :tests:
No tests exist for =cj/org-contacts-completion-at-point=,
=cj/mu4e-org-contacts-tab-complete=, =cj/mu4e-org-contacts-comma-
complete=, or =cj/mu4e-org-contacts-insert-email=. The header-field
detection (=mail-abbrev-in-expansion-header-p=) and the TAB-cycle
branch are the highest-value coverage targets. Stub
=cj/get-all-contact-emails= and run against a temp buffer in
=mu4e-compose-mode= / =org-msg-edit-mode= where applicable.
*** DOING [#B] Harden programming workflow modules :harden:
Scope:
- =prog-c.el=
- =prog-general.el=
- =prog-go.el=
- =prog-json.el=
- =prog-lisp.el=
- =prog-lsp.el=
- =prog-python.el=
- =prog-shell.el=
- =prog-training.el=
- =prog-webdev.el=
- =prog-yaml.el=
- =coverage-core.el=
- =coverage-elisp.el=
- =test-runner.el=
- =vc-config.el=
- =keyboard-compat.el=
- =dev-fkeys.el=
Review progress:
- Reviewed 2026-05-03 at high level.
- =dev-fkeys.el= reviewed 2026-05-03 after local edits settled. The focused
dev-fkeys test set passed: 22 test files, 163 ERT tests.
- =coverage-core.el= / =coverage-elisp.el= have strong pure-helper tests.
- Language formatter wiring is covered for Python, Go, shell, webdev, JSON, and
YAML.
- =test-runner.el= has direct tests, but project-scoping is still a design gap.
Completion review 2026-05-15:
- Re-checked the scoped programming workflow modules and current tests.
- =dev-fkeys.el=, coverage modules, formatter wiring, keyboard compatibility,
and test-runner helpers have meaningful focused coverage.
- Remaining issues are logged below: F4 project capability classification,
LSP ownership and smoke coverage, tree-sitter auto-install policy, Git clone
process handling, shell-script executable policy, and formatter process
boundaries.
**** TODO [#C] Add smoke coverage for lightweight programming modules with no direct tests :tests:
Several low-risk programming modules currently have little or no direct test
surface, especially =prog-general.el=, =prog-lisp.el=, and
=prog-training.el=. Most behavior is package/hook configuration, so this should
stay narrow:
- require the modules with package side effects stubbed,
- assert key hooks/settings that this config owns,
- ensure batch loading does not trigger external installs or downloads.
Prioritize this after the LSP and tree-sitter policy tasks, because those
changes will define the stable assertions.
**** TODO [#B] Revisit F4 project classification vs actual project capabilities :ux:
=dev-fkeys.el= classifies a project as =interpreted= if it has
=pyproject.toml=, =requirements.txt=, =Pipfile=, or =package.json=, even when it
also has a =Makefile=. That intentionally keeps Python/Node projects on a
Run-only F4 menu, but it also hides useful Compile/Clean options for projects
where =Makefile=, =package.json= scripts, or Projectile cached commands provide
real build/test tasks.
Expected outcome:
- Decide whether F4 should classify by language family or by available
capabilities.
- Consider deriving candidates from Projectile's known compile/run/test commands
first, then falling back to markers.
- Keep the current "interpreted markers win" behavior only if that remains the
intentional UX after trying it in mixed Python/Node projects.
**** PROJECT [#B] Consolidate LSP ownership across programming modules :architecture:refactor:
LSP setup is currently split across =prog-general.el=, =prog-lsp.el=, and each
language module. There are multiple =use-package lsp-mode= forms and some
conflicting defaults:
- =prog-general.el= enables snippets/UI doc/sideline behavior.
- =prog-lsp.el= disables snippets/UI doc/sideline-heavy behavior.
- Python, Go, shell, C, and webdev modules both call =lsp-deferred= from local
setup functions and add package hooks that call =lsp-deferred= again.
This probably works because lsp-mode is defensive, but it makes the final
runtime policy hard to predict.
***** TODO [#B] Make =prog-lsp.el= the single owner of generic LSP policy :refactor:
Expected outcome:
- Move generic =lsp-mode= and =lsp-ui= defaults out of =prog-general.el=.
- Keep language-specific server variables in language modules.
- Keep one hook path per language for starting LSP.
- Preserve the remote-file guard.
Pitfalls:
- =lsp-pyright= may still need a language-specific hook to load before LSP
starts.
- Do not accidentally re-enable UI/doc/sideline behavior that was explicitly
disabled for performance.
***** TODO [#B] Add a startup smoke test for LSP config resolution
Keep this narrow. A useful test can require the LSP-related modules with mocked
=use-package= side effects and assert that:
- generic defaults are set in one place,
- no duplicate hook entries are installed for the same mode,
- =lsp-enable-remote= remains nil.
**** TODO [#B] Gate tree-sitter grammar auto-install behind an explicit policy :startup:
=prog-general.el= sets =treesit-auto-install= to =t=. That means opening a file
can trigger grammar download/build/install behavior. This is convenient on a
fresh machine, but it is a startup/network/build side effect in normal editing
and batch contexts.
Expected outcome:
- Prefer ='prompt= or a custom command such as =cj/install-treesit-grammars=.
- Batch/test startup should never auto-install grammars.
- Document the intentional bootstrap path for a new machine.
Originally meant to coordinate with the [#A] Python tree-sitter predicate
syntax issue. That one resolved upstream on 2026-05-14 (see =docs/python-
treesit-predicate-mismatch.txt= RESOLVED footer), so this task no longer
depends on it.
**** TODO [#B] Harden git clone from clipboard in =vc-config.el= :robustness:refactor:
=cj/git-clone-clipboard-url= shells out to =git clone= from clipboard text and
derives the clone directory with =file-name-nondirectory=. The URL is quoted, so
this is not an immediate shell-injection bug, but process handling and path
derivation are still brittle.
Expected outcome:
- Use =start-process= or =call-process= with =("git" "clone" url)=.
- Validate that the target directory exists and is writable before cloning.
- Derive the expected repository directory robustly for HTTPS, SSH, and local
clone URLs.
- Report clone failures from the process exit status instead of assuming the
directory appears.
**** TODO [#B] Decide whether auto-executable shell scripts should be opt-in :ux:
=prog-shell.el= adds a global =after-save-hook= that sets executable bits on any
saved file with a shebang. This is convenient, but it silently changes file
modes for every buffer in the session.
Expected outcome:
- Decide whether this should remain global, be limited to shell/script modes, or
prompt the first time per file.
- Preserve the fast path for real scripts.
- Keep the existing =cj/make-script-executable= tests updated for the chosen
policy.
**** TODO [#B] Review language formatter process boundaries :cleanup:
JSON, YAML, and webdev formatters use =shell-command-on-region= with command
strings. Most inputs are fixed or shell-quoted, but formatter code is a good
place to standardize process handling.
Expected outcome:
- Prefer process APIs with argv lists where practical.
- Keep point preservation behavior.
- Keep existing formatter wiring tests and add command-construction tests if a
helper is extracted.
**** TODO [#C] Add =executable-find= checks for =prettier= and =pyright= at load time :safety:
=modules/prog-webdev.el:34-40= declares =prettier-path= and
=modules/prog-python.el:33-40= declares =pyright-path= as string
literals. No validation at module load means a missing executable
surfaces only at first use -- format-on-save fires, then errors
mid-edit, then the user has to discover why. Wrap with
=cj/executable-find-or-warn= (already in =system-lib.el=) at module
load time so the missing dependency is reported up front.
**** TODO [#C] Make =keyboard-compat= =server-after-make-frame-hook= idempotent :safety:
=modules/keyboard-compat.el:169-174= adds the frame-setup hook
unconditionally. If the module is required twice (e.g. via two
=eval-after-load= chains in different load orders), the hook runs
twice per new frame and installs duplicate =key-translation-map=
entries. Wrap the =add-hook= in a guard, or use a named function
and rely on =add-hook='s own duplicate-check.
**** TODO [#C] Wire =dev-fkeys= F6 test-runner clause for typescript / tsx :refactor:
=modules/dev-fkeys.el:261-269= maps =tsx= to =typescript= in the
language detection table. =modules/dev-fkeys.el:347-349=
(=cj/--f6-test-runner-cmd-for=) has no clause for =typescript= --
the catch-all =(_)= returns nil, so F6 errors instead of routing to
a real runner. Either add a =typescript= → =jest=/=vitest= clause
or remove the =tsx= mapping until the runner side is implemented.
**** TODO [#B] Fix =prog-lsp= eldoc-provider removal scope :bug:
=modules/prog-lsp.el:51-54,76= attaches
=cj/lsp--remove-eldoc-provider= globally to =lsp-managed-mode-hook=
but the removal it performs uses =(remove-hook ... t)= -- a
buffer-local removal. The first LSP buffer activates the hook,
which removes the provider for that buffer. Subsequent LSP buffers
still inherit the global default because the hook itself never
re-fires the buffer-local removal in their context. Either make
the hook itself buffer-local-friendly (add it inside
=lsp-managed-mode-hook= per-buffer) or remove from the global
provider list once instead of per-buffer.
**** TODO [#C] Externalize hardcoded LanguageTool script path in =flycheck-config= :cleanup:
=modules/flycheck-config.el:69= hardcodes
=~/.emacs.d/scripts/languagetool-flycheck= as the LanguageTool wrapper.
Users running from a non-standard =user-emacs-directory= (or anyone
auditing the module against a future package) get a broken checker.
Replace with =(expand-file-name "scripts/languagetool-flycheck"
user-emacs-directory)= or a defcustom.
**** TODO [#C] Replace hardcoded Zathura viewer in =latex-config= :cleanup:
=modules/latex-config.el:28= sets the LaTeX viewer to =zathura=
unconditionally. macOS / Windows users and anyone who prefers a
different PDF viewer lose document review without explanation.
Resolve via =executable-find= over a candidate list (=zathura=,
=evince=, =okular=, =Preview.app= via =open=, =SumatraPDF.exe=) and
fall back to =pdf-tools=.
**** 2026-05-15 Fri @ 18:49:24 -0500 Fixed abbrev-mode no-arg toggle in =cj/prose-helpers-on=
Replaced the =(if (not (abbrev-mode)) (abbrev-mode))= shape with
=(unless (bound-and-true-p abbrev-mode) (abbrev-mode 1))= and the same
for =flycheck-mode= in =modules/flycheck-config.el:36-42=. Dropped
"flyspell" from the docstring (the commented-out
=cj/flyspell-on-for-buffer-type= line had been gone for a while; the
docstring was lying) and removed the stale comment marker.
Added =tests/test-flycheck-config-prose-helpers-on.el= -- 4 tests
covering Normal (both modes off -> each enabled once with a positive
arg) and Boundary (both on -> no-op; each mixed state -> only the off
one enabled). The "both on -> no-op" assertion is the regression
guard for the no-arg toggle shape: it would record a =(nil)= call list
under the bug and a =()= call list under the fix.
Test infra needed an explicit =(defvar abbrev-mode)= /
=(defvar flycheck-mode)= at the top of the test file: with
=lexical-binding: t= and flycheck loaded =:defer t=, =let= on the
flycheck-mode symbol creates a lexical-only binding the production
code's =bound-and-true-p= can't see; declaring both as special makes
=let= dynamic and the test stable.
Full suite: =make test= exits 0; 468 lines of output with =ALL UNIT
TESTS PASSED= banner; no regressions.
*** DOING [#B] Harden integrations and application modules :harden:
Scope:
- AI/rest: =ai-config.el=, =ai-conversations.el=, =restclient-config.el=
- Mail/chat/social: =mail-config.el=, =mu4e-*.el=, =slack-config.el=,
=erc-config.el=, =elfeed-config.el=, =eww-config.el=
- File/media/apps: =dirvish-config.el=, =dwim-shell-config.el=, =pdf-config.el=,
=calibredb-epub-config.el=, =music-config.el=, =quick-video-capture.el=,
=video-audio-recording.el=, =transcription-config.el=
- Utilities/apps: =auth-config.el=, =browser-config.el=, =dashboard-config.el=,
=help-config.el=, =help-utils.el=, =jumper.el=, =keyboard-macros.el=,
=local-repository.el=, =lorem-optimum.el=, =reconcile-open-repos.el=,
=show-kill-ring.el=, =system-commands.el=, =system-utils.el=,
=tramp-config.el=, =undead-buffers.el=, =weather-config.el=, =wrap-up.el=
Review progress:
- Reviewed 2026-05-03 at high level by direct reads plus risky-pattern search.
- Recording/transcription and music modules have much stronger coverage than
most application wrappers.
- Existing coverage audit already tracks =ai-conversations=, =quick-video-capture=,
=dashboard-config=, =mail-config=, =show-kill-ring=, =system-commands=, and
=wrap-up= as high-value test targets.
Completion review 2026-05-15:
- Re-checked the scoped integration/application modules with risky-pattern and
test-coverage searches.
- Many integration modules now have focused tests, including AI config,
restclient, mail helpers, Slack commands, Dirvish helpers, music,
recording/transcription, system commands, browser/help/jumper/reconcile, and
undead buffer helpers.
- Remaining issues are already logged below, especially system command safety,
REST key persistence, mail privacy/lifecycle policy, quick-video timers and
temp state, shell-heavy dwim/recording command hardening, AI conversation
persistence coverage, calendar operational behavior, Dirvish dependency/path
hardening, EWW/Elfeed network helpers, and Slack which-key registration.
**** TODO [#B] Make system restart/shutdown commands more defensive :safety:
=system-commands.el= exposes high-impact shell commands through a convenience
menu. The restart-Emacs path starts a shell command that restarts the user
service and reconnects, then schedules =kill-emacs= after one second. If the
service command is unavailable or fails, the current session can still be killed.
Expected outcome:
- Check whether the Emacs daemon service exists before offering the service
restart command.
- Start restart/reconnect work as a process with an exit sentinel.
- Kill the current Emacs only after the replacement path has clearly started,
or keep a non-daemon fallback that does not kill the session on failure.
- Consider requiring a stronger confirmation for shutdown/reboot than a single
RET/space confirmation.
- Add smoke tests around key resolution and command selection without invoking
real system commands.
**** TODO [#A] Prevent REST API keys from being saved into template files :security:bug:
=restclient-config.el= opens =data/skyfi-api.rest= and replaces the
=:skyfi-key= line in that file-visiting buffer with the real key from
=authinfo.gpg=. Even if the function does not write to disk itself, an
accidental save can persist the key.
Expected outcome:
- Open SkyFi requests in a scratch/indirect buffer, or mark the injected buffer
read-only with a save guard that restores =PLACEHOLDER= before writing.
- Make the buffer visibly modified state sane after injection.
- Keep the existing tests that assert the template file remains unchanged, and
add a test for accidental save behavior.
**** TODO [#B] Reconcile mail image/privacy settings :privacy:
=mail-config.el= documents blocked remote images and sets
=gnus-blocked-images=, but later enables both =mu4e-show-images= and
=mu4e-view-show-images=. The interactive toggle changes =gnus-blocked-images=
buffer-locally, so the final privacy behavior is hard to reason about without
manual testing against real HTML messages.
Expected outcome:
- Decide the default policy for embedded images versus remote HTTP images.
- Make the toggle report the effective state in the current mu4e view buffer.
- Add a short manual checklist or mocked test for the variables that control
remote image display.
**** TODO [#B] Clean up mail compose buffer lifecycle conflicts :cleanup:quick:
=mail-config.el= first sets =message-kill-buffer-on-exit= to =t= in the mu4e
configuration, then =org-msg= later sets it to nil. That may be intentional for
org-msg editing, but the ownership is unclear.
Expected outcome:
- Decide whether compose buffers should be killed on send/exit for plain mu4e,
org-msg, or both.
- Move the final policy next to the owner module.
- Add a short note in the config explaining the choice.
**** TODO [#B] Remove automatic startup timers from =quick-video-capture.el= :startup:refactor:
=quick-video-capture.el= schedules both an =after-init-hook= idle timer and a
fallback =run-with-timer= to initialize org-protocol/capture glue shortly after
startup. This is a small side effect, but it loads Org capture/protocol plumbing
even if the video workflow is never used.
Expected outcome:
- Register the protocol lazily through autoloadable setup, or initialize only
when Org/protocol support is already active.
- Batch/test startup should not schedule timers.
- Keep manual bookmarklet usage working when an org-protocol URL arrives before
the rest of Org has been used.
**** TODO [#B] Avoid global temp state in =quick-video-capture.el= :cleanup:refactor:
Like =org-webclipper.el=, quick video capture passes URL state through a global
=cj/video-download-current-url=. Interrupted captures or nested capture flows can
leave stale state.
Expected outcome:
- Pass the URL through capture/protocol state where possible.
- Ensure aborted captures clear the temp URL.
- Add coverage for manual URL prompt, protocol URL, and aborted capture cleanup.
**** TODO [#B] Audit shell-command-heavy recording and dwim-shell workflows :security:refactor:
=video-audio-recording.el= and =dwim-shell-config.el= are intentionally close to
the shell: pactl/ffmpeg/qpdf/7z/tesseract/media conversion commands are the
point. They also have the highest process and quoting surface in the config.
Expected outcome:
- Keep the current workflows, but catalog which commands accept filenames,
URLs, passwords, or free-form user input.
- Prefer argv process APIs for commands that do not require a shell.
- For commands that must use shell templates, document which placeholders are
safely quoted by =dwim-shell-command= and add focused tests around password
temp-file cleanup.
***** TODO [#A] Fix async password temp-file lifetime in dwim-shell commands :bug:
Several password commands create a temp file, call
=dwim-shell-command-on-marked-files=, and delete the temp file in
=unwind-protect= immediately after the command is launched. Because these
commands are normally asynchronous, =qpdf= or =7z= may start after the password
file is already gone.
Affected workflows:
- PDF password protect and unprotect.
- Remove ZIP encryption.
- Create encrypted ZIP.
Expected outcome:
- Keep password material out of command-line arguments.
- Delete password files only after the spawned process exits.
- Add tests or a small harness that proves cleanup happens on success, failure,
and user cancellation.
***** TODO [#A] Quote or argv-ify user-controlled dwim-shell inputs :security:bug:
Several commands interpolate clipboard text, archive names, prefixes,
recipients, timestamps, and output paths into shell templates. Some are quoted
by dwim-shell placeholders, but several explicit =format= calls are not robust
against spaces, quotes, newlines, or shell metacharacters.
Specific cases to check first:
- =cj/dwim-shell-commands-git-clone-clipboard-url= uses =git clone <<cb>>=
rather than an argv process call or a quoted URL.
- Encrypted archive names and GPG recipients are interpolated into single-quoted
shell fragments.
- Sequential rename prefixes are interpolated into =mv= destinations.
- Video thumbnail timestamps come from =read-string= and are inserted into
=ffmpeg -ss=.
- Video concatenation builds a concat list with =echo= / =tr= / =sed=, which is
fragile for filenames with spaces or quotes.
Expected outcome:
- Replace high-risk commands with process helpers where practical.
- Where dwim-shell templates remain, add focused command-construction tests.
- Validate user strings as domain values when possible, e.g. ffmpeg timestamps.
***** TODO [#B] Clarify broad or misleading file-operation commands :safety:bug:
Two dwim-shell commands look broader or weaker than their names suggest:
- =cj/dwim-shell-commands-remove-empty-directories= runs
=find . -type d -empty -delete= from the current directory, not from the marked
files.
- =cj/dwim-shell-commands-secure-delete= calls =shred= without =-u=, so it may
overwrite file contents but leave the directory entry in place.
Expected outcome:
- Scope empty-directory cleanup to an explicit selected root and show that root
in the confirmation prompt.
- Decide whether secure delete should actually remove files with =shred -u= or
be renamed to describe overwrite-only behavior.
- Add tests around command strings or extract small pure builders.
***** TODO [#B] Quote X11 and audio recording command paths :bug:
=video-audio-recording.el= quotes devices and filenames in the Wayland
=wf-recorder= command path, but the X11 =ffmpeg= path and audio-only =ffmpeg=
path interpolate device names and output filenames without shell quoting. This
will break on output directories with spaces and can mishandle unusual device
names.
Expected outcome:
- Shell-quote mic device, system device, and output file consistently in every
shell command path.
- Prefer argv process APIs for ffmpeg where possible.
- Add regression tests for recording directories with spaces.
***** TODO [#B] Track recorder processes instead of killing by program name :safety:bug:
The Wayland recording path stops recording with =pkill -INT wf-recorder=. That
can interrupt unrelated =wf-recorder= processes outside Emacs.
Expected outcome:
- Store the process object or PID for the recorder launched by this module.
- Stop only that process or process group.
- Preserve existing toggle behavior and tests for already-running recordings.
***** TODO [#B] Ensure chosen recording directories are created directly :bug:
The recording toggles accept a directory via prefix argument, then derive parent
directories in a way that can create the parent but not necessarily the selected
recording directory itself.
Expected outcome:
- Normalize the selected destination as either an explicit file or explicit
directory.
- Ensure the actual target directory exists before launching ffmpeg/wf-recorder.
- Add tests for new directories and paths containing spaces.
**** TODO [#B] Make AI conversation persistence path-safe and project-aware :cleanup:refactor:
=ai-conversations.el= has good pure helper seams but is currently untested in
this repo. The path slugging is simple and the save/load/delete commands operate
directly in a single global directory.
Expected outcome:
- Add tests for candidate sorting, topic slug collisions, autosave path setup,
and delete confirmation behavior.
- Consider whether conversations should remain global or support project-scoped
subdirectories.
- Confirm autosave never writes partial prompt/response state to an unexpected
file after loading a different conversation.
**** TODO [#B] Harden calendar sync operational behavior around the parser :data:refactor:
=calendar-sync.el= has broad parser/recurrence coverage, but the operational
path around it still has startup, persistence, and fetch risks.
Expected outcome:
- Move private calendar URLs out of source and rotate the exposed feed URLs
before doing further cleanup.
- Avoid immediate network fetches at module load unless explicitly enabled for
interactive sessions.
- Add a per-calendar in-flight guard so a timer tick cannot launch overlapping
syncs for the same calendar.
- Use =curl --fail= or equivalent status handling so HTTP error pages are not
treated as successful ICS downloads.
- Write generated Org files atomically via a temp file and rename.
- Read the local state file with =read-eval= disabled.
**** TODO [#B] Add first coverage for AI conversation persistence :tests:
=ai-conversations.el= is not currently represented in =.coverage/simplecov.json=.
The module has several pure helper seams and a few file operations that can be
tested without loading GPTel.
Expected outcome:
- Test slug generation, timestamp parsing, candidate sorting, and latest-file
selection.
- Test save/load header stripping against a temp conversations directory.
- Test autosave path setup and delete confirmation with stubbed prompts.
- Keep GPTel itself mocked or avoided unless a later integration test needs it.
**** TODO [#B] Add first coverage for Dirvish utility helpers :tests:
=dirvish-config.el= is not currently represented in =.coverage/simplecov.json=.
The pure-ish Dired helpers have a few sharp edges that are easy to characterize
with mocked =dired-get-filename= / =dired-get-marked-files= calls.
Expected outcome:
- Test playlist path construction and reject playlist names that escape
=music-dir=.
- Test duplicate/copy-path/wallpaper helpers when there is no file at point.
- Test project-relative, home-relative, absolute, and Org-link path copying.
- Keep Dirvish package loading mocked; these tests should not require the full
UI package.
**** TODO [#B] Require runtime constants explicitly in =dirvish-config.el= :startup:bug:
=dirvish-config.el= uses =eval-when-compile= for =user-constants= and
=system-utils=, but runtime configuration constructs quick-access entries from
constants such as =code-dir=, =music-dir=, =pix-dir=, and recording directories.
This depends on load order rather than the module declaring its runtime inputs.
Expected outcome:
- Require runtime dependencies normally or add clear =defvar= declarations for
values owned elsewhere.
- Keep byte compilation clean without making standalone module loads depend on
accidental init order.
- Add a module-load smoke test with required constants stubbed.
**** TODO [#B] Harden Dirvish path helpers around nil files and path traversal :bug:
Several Dirvish helpers derive path components before checking whether Dired has
a file at point. Playlist creation also accepts a raw playlist name and expands
it under =music-dir= without rejecting =../= style input.
Expected outcome:
- In duplicate, copy-path, and wallpaper helpers, check for a file before
calling path functions.
- Reject playlist names that contain directory separators or resolve outside
=music-dir=.
- Add regression tests for no-file-at-point and traversal-like playlist names.
**** TODO [#B] Add first smoke coverage for mail and system command modules :tests:
=mail-config.el= and =system-commands.el= are not currently represented in the
coverage report. Both can get useful coverage without sending mail or invoking
real system commands.
Expected outcome:
- For mail, stub executable discovery and assert the resulting config either
assigns valid commands or reports missing dependencies clearly.
- For system commands, test keymap shape, menu candidates, confirmation routing,
and command-string construction with =shell-command= stubbed.
- Keep all tests batch-safe and non-destructive.
**** TODO [#B] Harden EWW/Elfeed synchronous network helpers :cleanup:refactor:
=elfeed-config.el= includes synchronous URL retrieval helpers for converting
YouTube channel/playlist URLs into feed entries, and =eww-config.el= advises URL
retrieval to inject a user agent only from EWW buffers.
Expected outcome:
- Add timeouts/error handling to synchronous feed-conversion requests.
- Kill temporary URL buffers after parsing.
- Add a small test or manual checklist for the EWW user-agent advice so it does
not affect package.el or non-EWW URL callers.
**** TODO [#B] Move Slack which-key registration behind =with-eval-after-load= :cleanup:quick:
=slack-config.el= calls =which-key-add-keymap-based-replacements= at top level,
while most modules defer which-key registration. If which-key is not loaded or
autoloaded as expected, Slack config can fail during require.
Expected outcome:
- Wrap the registration in =with-eval-after-load 'which-key=.
- Add a module-load smoke test or byte-compile check if easy.
**** TODO [#C] Remove =httpd-start= side effect from =markdown-preview= :safety:
=modules/markdown-config.el:37-51= starts =simple-httpd= inside an
interactive command, then opens a browser at
=http://localhost:8080/imp=. Starting a network listener as a side
effect of a "preview" command surprises users; once started, the
server keeps running until Emacs exits. Either gate the start
behind an explicit confirmation, document the listener clearly, or
move the server start into a separate =cj/markdown-preview-server-start=
command so =markdown-preview= just opens the URL once the server is
known to be running.
**** TODO [#C] Externalize hardcoded SSH hostnames in =eshell-config= :cleanup:
=modules/eshell-config.el:74-76= sets up =cj/eshell-aliases= with
SSH aliases pointing at specific hostnames (=gosb=, =gowolf=).
Those identifiers are personal; they should live in a per-machine
config (a defcustom, an alist read from disk, or
=host-environment.el='s machine-table) so the module itself is
portable.
**** TODO [#B] Fix HTTPS scheme in =markdown-preview= URL :bug:
=modules/markdown-config.el:45= opens
=https://localhost:8080/imp= via =browse-url-generic=, but the
=simple-httpd= listener bound in =httpd-config.el= serves plain
HTTP on port 8080. The =https= scheme causes the browser to
attempt a TLS handshake against a plaintext listener -- the request
fails before any preview content reaches the page, so the entire
feature is broken end-to-end. Change the URL to
=http://localhost:8080/imp= (and consider switching the launch to
=browse-url= so the user's default protocol handler is respected).
**** TODO [#C] Document or vendor strapdown.js CDN dependency in =markdown-preview= :cleanup:
=cj/markdown-html= (=modules/markdown-config.el:48-51=) embeds a
=<script src="http://ndossougbe.github.io/strapdown/dist/strapdown.js">=
in every rendered page. The preview silently fails when offline,
when the GitHub Pages host is unreachable, or if the upstream project
disappears. Document the dependency in the module commentary at
minimum; better, vendor a copy of =strapdown.js= under
=assets/= and serve it from the local =simple-httpd= root.
**** TODO [#C] Reconsider global =TERM=xterm-256color= setenv in =eshell-config= :startup:
=modules/eshell-config.el:131= calls =(setenv "TERM" "xterm-256color")=
at config time inside the =xterm-color= use-package block. That
changes =TERM= for the entire Emacs process, so every subsequent
=start-process= / =call-process= inherits =xterm-256color= rather
than the terminal's actual emulator. Most subprocesses treat it as
truthful and emit ANSI escapes, which surface as raw =\e[31m= bytes
in shells that aren't interpreting them. Move the setenv into the
eshell entry hook (=eshell-mode-hook= or =eshell-before-prompt-hook=)
so it scopes to eshell processes only.
**** TODO [#C] Quote agent command in =cj/--ai-vterm-launch-command= :safety:
=modules/ai-vterm.el:236-240= builds the tmux launch command by
wrapping =(concat cj/ai-vterm-agent-command "; exec bash")= in
literal single quotes. The default value carries embedded double
quotes (=claude "Read .ai/protocols.org and follow all
instructions."=) which survives that wrap, but a user-customized
=cj/ai-vterm-agent-command= containing a single quote breaks the
shell parse silently. Run the inner command through
=shell-quote-argument= (or pass the command as a separate tmux
=new-session= positional argument) so any user-customized agent
command launches safely.
*** 2026-05-15 Fri @ 18:14:26 -0500 Reviewed newly added modules
Fresh end-to-end re-read of the 24 modules listed for this review,
applying the parent's protocol (runtime deps, top-level side effects,
keybindings, timers, external-executable assumptions, secrets,
host-specific paths, user-data writes, and test coverage).
The 24 modules in scope:
- Post-2026-04 additions (11): =telega-config.el=,
=mu4e-attachments.el=, =vterm-config.el=, =external-open-lib.el=,
=eshell-config.el=, =cj-window-toggle-lib.el=,
=cj-window-geometry-lib.el=, =cj-org-text-lib.el=,
=cj-cache-lib.el=, =nerd-icons-config.el=, =ai-vterm.el=.
- Pre-existing modules outside the original scope (13):
=text-config.el=, =markdown-config.el=, =latex-config.el=,
=flycheck-config.el=, =flyspell-and-abbrev.el=, =ledger-config.el=,
=httpd-config.el=, =chrono-tools.el=, =diff-config.el=,
=games-config.el=, =mu4e-org-contacts-setup.el=,
=mu4e-org-contacts-integration.el=, =org-agenda-config-debug.el=.
Confirmed the 5 findings from the 2026-05-15 re-review pass are
filed and visible under their target Harden tracks:
=markdown-config= httpd start (UI/integrations track), =flycheck-config=
LanguageTool path (programming track), =latex-config= Zathura
(programming), =eshell-config= SSH hostnames (integrations), and
=nerd-icons-config= advice-timing / =:demand t= (UI/navigation).
Filed 11 new sub-tasks across the Harden tracks this pass:
- Foundation: dead world-clock block in =chrono-tools.el=, and
coverage for the TMR sound-selection helpers (with a refactor to
collapse the prefix-arg duplication).
- Custom editing: de-duplicate the spell-checker availability guard
in =flyspell-and-abbrev.el=, and add coverage for
=cj/flyspell-then-abbrev= + helpers.
- Org workflow: declare cross-module free variables in
=mu4e-org-contacts-integration.el=, and add coverage for the
completion-at-point / TAB / comma logic there.
- Programming workflow: fix the =cj/prose-helpers-on= toggle bug in
=flycheck-config.el= (=(if (not (abbrev-mode)) (abbrev-mode))=
flips the mode twice; needs =bound-and-true-p= + explicit enable).
- Integrations: fix the =https= vs =http= scheme mismatch in
=markdown-preview=, document/vendor its strapdown.js CDN
dependency, narrow the global =TERM=xterm-256color= setenv in
=eshell-config= so it doesn't leak into every subprocess, and
shell-quote the user-customized agent command in
=cj/--ai-vterm-launch-command=.
The remaining 13 of the 24 modules had no concrete findings worth
filing -- they are either pure libraries with strong test coverage
(=cj-window-toggle-lib=, =cj-window-geometry-lib=, =cj-org-text-lib=,
=cj-cache-lib=, =external-open-lib=) or thin declarative
configuration (=text-config=, =diff-config=, =ledger-config=,
=games-config=, =mu4e-org-contacts-setup=, =telega-config=,
=httpd-config=, =org-agenda-config-debug=).
** VERIFY [#B] Continue org-noter custom workflow implementation (IN PROGRESS) :feature:bug:
Continue debugging and testing the custom org-noter workflow from 2025-11-21 session.
This is partially implemented but has known issues that need fixing before it's usable.
*Last worked on:* 2025-11-21
*Current status:* Implementation complete but has bugs, needs testing
**Known Issues to Fix:**
1. **Double notes buffer appearing when pressing 'i' to insert note**
- When user presses 'i' in document to insert a note, two notes buffers appear
- Expected: single notes buffer appears
- Need to debug why the insert-note function is creating duplicate buffers
2. **Toggle behavior refinement needed**
- The toggle between document and notes needs refinement
- May have edge cases with window management
- Need to test various scenarios
**Testing Needed:**
1. **EPUB files** - Test with EPUB documents (primary use case)
2. **Reopening existing notes** - Verify it works when notes file already exists
3. **Starting from notes file** - Test opening document from an existing notes file
4. **PDF files** - Verify compatibility with PDF workflow
5. **Edge cases:**
- Multiple windows open
- Splitting behavior
- Window focus after operations
**Implementation Files:**
- modules/org-noter-config.el - Custom workflow implementation
- Contains custom functions for document/notes toggling and insertion
**Context:**
This custom workflow is designed to make org-noter more ergonomic for Craig's reading/annotation
workflow. It simplifies the toggle between document and notes, and streamlines note insertion.
The core functionality is implemented but needs debugging before it's production-ready.
**Next Steps:**
1. Debug the double buffer issue when pressing 'i'
2. Test all scenarios listed above
3. Refine toggle behavior based on testing
4. Document the final keybindings and workflow
** VERIFY [#B] Test and review restclient.el implementation :tests:
Test the new REST API client integration in a running Emacs session.
**Keybindings to test:**
- C-; R n — new scratch *restclient* buffer (should open in restclient-mode)
- C-; R o — open .rest file (should default to data/ directory)
- C-; R s — open SkyFi template (should auto-inject API key from authinfo)
**Functional tests:**
1. Open tutorial-api.rest, run JSONPlaceholder GET (C-c C-c) — verify response inline
2. Run POST example — verify 201 response with fake ID
3. Run httpbin header echo — verify custom headers echoed back
4. Navigate between requests with C-c C-n / C-c C-p
5. Test jq filtering (requires jq installed): restclient-jq loaded?
6. Open scratch buffer (C-; R n), type a request manually, execute
7. which-key shows "REST client" menu under C-; R
**SkyFi key injection (if authinfo entry exists):**
- C-; R s should replace :skyfi-key = PLACEHOLDER with real key
- Key should NOT be written to disk (verify file still shows PLACEHOLDER)
** TODO [#C] Implement flycheck modeline customization :feature:
Spec: [[file:docs/design/flycheck-modeline-customization.org][docs/design/flycheck-modeline-customization.org]]
Custom modeline (=modules/modeline-config.el=) omits =minor-mode-alist=,
so flycheck's error/warning lighter is invisible. Fix is a two-line
=:custom= block in =flycheck-config.el= (prefix + success indicator) plus
one guarded =(:eval ...)= form in =mode-line-format=. See spec for the
active-window-gating decision, risky-local-variable note, emoji
candidates, and the manual verification walk.
** TODO [#C] Migrate from Company to Corfu (with prescient integration) :feature:
Spec: [[file:docs/design/company-to-corfu-migration.org][docs/design/company-to-corfu-migration.org]]
Drop-in replacement for the in-buffer completion stack: =company= →
=corfu=, =company-quickhelp= → =corfu-popupinfo=, =company-box= →
=kind-icon=, =company-prescient= → =corfu-prescient=, plus =cape= for
the file/keyword/dabbrev capfs that =company-files= / =company-keywords=
used to handle. Per-module fixups for ledger, AUCTeX, eshell, mu4e
compose, and the three =prog-*= modules. See the design doc for the
full translation table, migration steps, tests, and risks.
** PROJECT [#B] Gptel Work :refactor:cleanup:feature:
Keep gptel as a focused side-tool for one-off conversations, impromptu help, and the rewrite-region code helper. Workflow stays distinct from the dedicated Claude-Code agents launched via F9, so per-project agent sessions don't get cluttered with general-purpose chat.
In scope:
- The =cj/ai-keymap= (=C-; a=) commands in =modules/ai-config.el=.
- The save/load/delete + autosave flow in =modules/ai-conversations.el=.
- The local-tools surface in =gptel-tools/= and the loader =cj/gptel-load-local-tools=.
- gptel-magit's three triggers (M-g in git-commit, =g= in magit-commit transient, =x= in magit-diff transient).
Out of scope: the F9 =ai-vterm= Claude-Code launcher (=modules/ai-vterm.el=) — separate module, working well.
*** 2026-05-16 Sat @ 01:17:58 -0500 Rewrote update_text_file.el and wired it into cj/gptel-local-tool-features
I rewrote =gptel-tools/update_text_file.el= in pure Elisp. The previous
version shelled out to sed for everything, had a stray quote terminator
at EOF, produced literal backslash-n where actual newlines were
expected, and prompted via =y-or-n-p= redundantly with gptel's own
=:confirm t= flag.
The five operations (=replace=, =append=, =prepend=, =insert-at-line=,
=delete-lines=) split into pure string transforms that test without
touching the disk. The file-level wrapper validates the path, enforces
the 10MB size limit, takes a timestamped backup, and writes atomically.
No backup is created when the operation is a no-op.
=tests/test-update-text-file.el= covers Normal / Boundary / Error per
operation plus the wrapper -- 48 tests green. Added =update_text_file=
to =cj/gptel-local-tool-features= so gptel exposes it on next restart.
*** TODO [#B] Fix gptel-magit triggers :bug:
Wired up in =modules/ai-config.el= as three lazy entry points:
- =M-g= in =git-commit-mode-map= → =gptel-magit-generate-message=
- =g= in the =magit-commit= transient → =gptel-magit-commit-generate=
- =x= in the =magit-diff= transient → =gptel-magit-diff-explain=
Specific failure mode TBD. First step: reproduce, note which entry point fails and how, then trace from there. Likely suspects: autoload chain (the three =autoload= calls run inside =with-eval-after-load 'magit=), transient suffix attachment via =transient-append-suffix=, or gptel-side backend/model config.
Migration to the current lazy form: commit =3eb1a0c refactor(gptel): lazy-load gptel-magit, rebind rewrite/context keys=.
*** TODO [#B] Add ERT coverage for ai-conversations.el :tests:
Currently zero direct tests on the 274-line module. Cover at least:
- =cj/gptel--slugify-topic= — Normal / Boundary (empty, all-special-chars, unicode, idempotent slug) / Error.
- =cj/gptel--timestamp-from-filename= — Normal / Boundary (year/month/day/hour/min/sec edges) / Error (malformed filename → nil).
- =cj/gptel--existing-topics= and =cj/gptel--latest-file-for-topic= — with a temp conversations directory containing multiple topics + multiple timestamps each.
- =cj/gptel--conversation-candidates= — sort order honored for both =newest-first= and =oldest-first=.
- =cj/gptel--save-buffer-to-file= — visibility headers prepended; round-trips back through =cj/gptel--strip-visibility-headers=.
- The =with-eval-after-load 'gptel= advice/hook installs once and isn't duplicated on re-load.
- Interactive entry points (=save= / =load= / =delete=) exercised via =cl-letf= stubs on =completing-read= and =y-or-n-p=.
Use a per-test temp conversations directory; no writes outside it. Target ≥80% coverage on the module.
*** TODO [#B] Add ERT coverage for gptel-tools .el files :tests:
The six tool files have zero direct coverage. Focus on the pure helpers (the interactive =gptel-make-tool= entry points get smoke coverage only):
- =read_text_file.el= — =cj/validate-file-path=, =cj/get-file-metadata=, =cj/check-file-size-limits=, =cj/detect-binary-file=, =cj/handle-special-file-types=.
- =update_text_file.el= — =cj/build-sed-command= (each operation × Normal / Boundary / Error), backup-naming behavior.
- =write_text_file.el= — overwrite-vs-error path, backup naming, parent-directory creation.
- =list_directory_files.el= — =--mode-to-permissions=, =--get-file-info=, =--filter-by-extension=, =--format-file-entry=, recursive vs flat listing on a temp dir.
- =move_to_trash.el= — =gptel--move-to-trash-validate-path= (home/tmp allowed, anywhere else rejected), =gptel--move-to-trash-generate-unique-name= name-conflict suffixing.
- =read_buffer.el= — small smoke test that =read_buffer= returns the body of an existing buffer and errors on a nonexistent name.
Skip mocking =gptel-make-tool= itself; cover the helpers it wraps.
*** TODO [#C] Research and shortlist additional gptel tools :feature:research:
Survey what published gptel community tools exist (the gptel README, karthink's gist/repo, MELPA, GitHub topic search). Compile a candidate list with one-line descriptions and a per-tool adopt / skip / defer decision. Useful candidates to evaluate first (some are inventions, some are commonly-published patterns):
- =run_shell_command= — sandboxed to =~/= + =/tmp=, denylist for destructive ops (=rm=, =mv=, =dd=, =chmod=, etc.); confirmation for everything else.
- =search_in_files= — =rg= wrapper with path/glob filtering and result-count cap.
- =git_status= / =git_log= / =git_diff= — read-only git context tools (let the model see what's changed without manually pasting).
- =org_capture= — capture a snippet from the AI response into a template (driven by template key).
- =web_fetch= — =curl=-style URL fetch with body-length cap; html-to-text by default; opt-in raw mode.
- =search_emacs_help= — =apropos= / =describe-function= / =describe-variable= query for "what does emacs already do for X".
- =find_file_by_name= — =locate= or =fd= wrapper, capped result count.
- =eval_elisp= — dangerous; require explicit confirm-each-call and a denylist of forms (=shell-command=, =delete-file=, =call-process=, etc.).
- =take_screenshot= — Hyprland-native (=grim= + region selection); save to a known path; return the path so the model can reason about an attached image.
Output: a shortlist in =docs/design/gptel-tools-shortlist.org= with the adopt/skip/defer decisions and a follow-up extraction sub-task per "adopt".
*** TODO [#C] Promote gptel-rewrite ergonomics :feature:
=gptel-rewrite= is the killer feature for the keep-gptel decision. Currently bound only to =C-; a r=. Make it land closer to the editing flow:
- A directive-picker wrapper =cj/gptel-rewrite-with-directive= that =completing-read='s a directive name (=terse=, =fix-grammar=, =refactor-readability=, =add-docstring=, =explain-as-comment=, =shorten=) before delegating to =gptel-rewrite=. Directive bodies live in =ai-prompts/= so they share storage with =gptel-prompts=.
- A =cj/gptel-rewrite-redo-with-different-directive= command for "the last rewrite was close — try this style instead". Walks back to the prior region (or kept selection) and re-prompts.
Open question: should this build on =gptel-rewrite= directly via =:after= advice + state capture, or wrap the call in a =cj/= command that sets =gptel-directives= for the duration?
*** TODO [#B] Saved-conversations browser :feature:
=cj/gptel-load-conversation= prompts via =completing-read=. A browser buffer (dired-style) showing topic, timestamp, and last-message preview, with single-key bindings to load / delete / rename in-place, would be a markedly better interface than the completing-read prompt.
Priority bumped from [#C] to [#B] and the "defer until ≥20 conversations" hold lifted on 2026-05-15 -- the browser is the preferred entry point; build it now rather than wait for prompt friction to force the issue.
*** TODO [#C] One-shot quick-ask command :feature:
=cj/gptel-quick-ask= -- read a prompt in the minibuffer, send to gptel, stream the response into a transient =*GPTel-Quick*= buffer. Doesn't touch the =*AI-Assistant*= side window, doesn't autosave anywhere. Intended for impromptu help where the conversation thread doesn't matter.
UX (decided 2026-05-15):
- The =*GPTel-Quick*= buffer is dismissible with =q= or =escape=. Both bindings kill the buffer (or quit-window if Craig wants to revisit -- pick one; favor kill so the buffer doesn't pile up in =M-x= history).
- A second key (suggested: =c= for "continue") escalates the one-shot into a full conversation: creates a new gptel conversation seeded with the quick-ask prompt + response, then opens it in the normal =*AI-Assistant*= side window. After the escalation the =*GPTel-Quick*= buffer can be dismissed.
- Stream the response into the temp buffer (gptel's default behavior) -- minibuffer echo is awkward for anything past a single line.
*** TODO [#C] Autosave toggle command + indicator :feature:
=cj/gptel-autosave-enabled= flips to =t= inside the save/load entry points. There's no command to flip it back off without manually setting the var or clearing the buffer, and no visible indicator that autosave is on.
- Add =cj/gptel-autosave-toggle= bound under =C-; a A=.
- Surface autosave state in the mode-line of the =*AI-Assistant*= buffer (a small =[AS]= when on, blank when off).
** TODO [#C] Extend F2 "preview" convention across modes :feature:
F2 is the universal preview key. Currently bound in markdown-mode (markdown-preview) and org-mode (org-reveal, moved from F5). Extend to other modes where a "preview" action is natural:
- Hugo blog (hugo-config.el) — preview the post in browser
- HTML / web-mode — open in browser
- Any other mode with a natural "preview this" action
Keep the binding mode-local so F2 stays available as a global candidate where no preview makes sense.
** TODO [#C] Build localrepo and document limitations :feature:
Repeatable installs and safe rollbacks.
.localrepo only contains packages from package.el archives.
Treesitter grammars are downloaded separately by treesit-auto on first use.
For true offline reproducibility, need to cache treesitter grammars separately.
** TODO [#C] Investigate TRAMP/dirvish showing question marks for file dates :bug:
Remote directories in dirvish show "?" instead of actual modification dates.
Tried several approaches without success - needs deeper investigation.
**Attempted fixes (all reverted):**
1. Connection-local dired-listing-switches with -alh (didn't help)
2. Disabling tramp-direct-async-process (reported to cause this, but disabling didn't fix it)
3. Hook to set different listing switches for remote vs local (didn't help)
**Possible causes to investigate:**
- dirvish may be using its own attribute fetching that bypasses dired-listing-switches
- May need dirvish-specific configuration for remote file attributes
- Could be an Emacs 29/30 + TRAMP + dirvish interaction issue
- May require changes to how dirvish renders the file-size attribute on remote
**Files involved:**
- modules/tramp-config.el
- modules/dirvish-config.el
** TODO [#C] Finish terminal GPG pinentry configuration :feature:
Continue work on terminal-mode GPG passphrase prompts (loopback mode).
Branch: terminal-pinentry
Changes in progress (modules/auth-config.el):
- Use epa-pinentry-mode 'loopback in terminal
- Use external pinentry (pinentry-dmenu) in GUI
- Requires env-terminal-p from host-environment module
** TODO [#D] Polish reveal.js presentation setup :feature:
Three small reveal.js improvements; collected into one task because each on its own is too small to track separately.
1. *Image insertion helper.* Function to insert images with proper org-reveal attributes (sizing, background images, etc.) without having to remember the syntax.
2. *Default font sizing for slide elements.* Configure reveal.js font sizes for headings, body text, code blocks, etc. — better defaults via =org-reveal-head-preamble= CSS or a custom theme.
3. *Custom dupre reveal.js theme.* CSS theme using the colors from =themes/dupre-palette.el=. Install into =reveal.js/css/theme/= for use with =#+REVEAL_THEME: dupre=.
** TODO [#D] Evaluate and integrate Buttercup for behavior-driven integration tests :tests:
Complex workflow testing capability.
** TODO [#D] Track ELPA upstream byte-compile warnings (esxml, poetry) :chore:
Two ELPA packages emit byte-compile warnings on =make compile= that aren't fixable in this repo:
1. =elpa/esxml-20250421.1632/esxml.el= — =Warning: Unknown type: attrs= and =Unknown type: stringp= (a defcustom =:type= spec).
2. =elpa/poetry-20240329.1103/poetry.el= — =Warning: Case 'X will match 'quote'= for four cases (=post-command=, =projectile=, =project=, =switch-buffer=). Quoted symbols inside =pcase= clauses — should be unquoted upstream.
No action in this repo. Revisit when packages update. File upstream issues if warnings linger past a few months.
Discovered 2026-04-26 in =*Messages*= during compile.
** TODO [#D] Add status dashboard for dwim-shell-command processes :feature:
Create a command to show all running dwim-shell-command processes with their status.
Currently, there's no unified view of multiple running extractions/conversions.
**Current behavior:**
- Each command shows spinner in minibuffer while running
- Process buffers created: `*Extract audio*`, etc.
- On completion: buffer renamed to `*Extract audio done*` or `*Extract audio error*`
- No way to see all running processes at once
**Recommended approach:**
Custom status buffer that reads `dwim-shell-command--commands`.
Can add mode-line indicator later as enhancement.
* Emacs Resolved
** DONE [#B] Fix likely =elpa-mirror-location= path bug :bug:quick:
CLOSED: [2026-05-03 Sun]
=early-init.el= builds =elpa-mirror-location= with:
#+begin_src emacs-lisp
(concat user-home-dir ".elpa-mirrors/")
#+end_src
That likely expands to =~/..= incorrectly, e.g. =/home/cjennings.elpa-mirrors/=
instead of =/home/cjennings/.elpa-mirrors/=. Use =expand-file-name= instead.
Acceptance criteria:
- Local mirror paths resolve under the home directory as intended.
- Add a small testable helper if this logic moves out of =early-init.el=.
Done 2026-05-03:
- Replaced =concat= path construction with =expand-file-name= for
=elpa-mirror-location=, =localrepo-location=, and local mirror archive paths.
- Added =tests/test-early-init-paths.el= to load =early-init.el= with package
side effects stubbed and assert local archive paths.
** DONE [#B] Fix =vc-follow-symlinks= setting in =system-defaults.el= :bug:quick:
CLOSED: [2026-05-03 Sun]
=modules/system-defaults.el= has:
#+begin_src emacs-lisp
(setq-default vc-follow-symlinks)
#+end_src
The comment says "don't ask to follow symlinks if target is version
controlled", but evaluating this leaves =vc-follow-symlinks= as =nil=. That
means the intended prompt suppression is not actually configured. The likely
fix is =t=, but verify the exact Emacs semantics first.
Acceptance criteria:
- Set =vc-follow-symlinks= to the intended value explicitly.
- Add a small regression test or startup smoke assertion for this setting.
- Confirm opening a symlinked, version-controlled file no longer prompts.
Done 2026-05-03:
- Confirmed from Emacs docs that =t= follows version-controlled symlinks without
prompting.
- Set =vc-follow-symlinks= explicitly to =t=.
- Added =tests/test-system-defaults-vc-follow-symlinks.el=.
** DONE [#B] Fix overwritten =C-; != system command prefix :bug:quick:
CLOSED: [2026-05-03 Sun]
=system-commands.el= first binds =cj/system-command-map= under =C-; !=, then
later replaces the same prefix with =cj/system-command-menu=:
#+begin_src emacs-lisp
(keymap-set cj/custom-keymap "!" cj/system-command-map)
...
(keymap-set cj/custom-keymap "!" #'cj/system-command-menu)
#+end_src
That likely makes the documented subkeys such as =C-; ! r= and =C-; ! s=
unreachable.
Expected outcome:
- Decide whether =C-; != is a prefix map or a direct menu command.
- If keeping both, bind the menu inside the prefix, e.g. =C-; ! != or =C-; ! m=.
- Add a key-resolution smoke test for the chosen bindings.
Done 2026-05-03:
- Kept =C-; != as the prefix map.
- Moved the completing-read menu to =C-; ! !=.
- Added which-key labels for the documented subkeys.
- Added =tests/test-system-commands-keymap.el=.
** DONE [#B] Ensure formatters for TS, Python, Go, Shell with automated tests :tests:
CLOSED: [2026-04-30 Thu]
Audit showed the four formatters were already consistently bound to =C-; f=
across the relevant mode-maps. No production change needed — this branch
shipped the regression net only.
5 new files (1 testutil + 4 per-language test files), 17 tests total, all
passing.
Per-language wiring inventory (locked in):
- Python: =blacken-buffer= in =python-ts-mode-map= (use-package =:bind=)
- Shell: =shfmt-buffer= in =sh-mode-map= and =bash-ts-mode-map=
(use-package =:bind=, gated on =:if (executable-find shfmt-path)=)
- Go: =gofmt= via =cj/go-mode-keybindings= hook + =local-set-key=
- TS / JS / Web: =cj/webdev-format-buffer= via =cj/webdev-keybindings= hook
Each test file checks: prog module requires without error, formatter package
is in =features=, format command is fboundp, C-; f binding resolves, and the
underlying executable is on PATH (skipped via =ert-skip= if not installed).
Real-formatting tests (run formatter on misformatted input, assert output)
were deferred — wiring tests catch the highest-frequency regressions cheaply
without crossing the boundary into testing the upstream formatter tools.
** DONE [#A] Continue coverage push on low-coverage modules :tests:
CLOSED: [2026-04-30 Thu]
The four scoped low-coverage modules — =keybindings.el=, =config-utilities.el=,
=org-noter-config.el=, =host-environment.el= — are now covered. 121 new tests
across 18 test files. Plus one production bug fixed in
=cj/validate-org-agenda-timestamps= (property-check branch was dead since the
function was written: =(intern (downcase prop))= built plain symbols where
=org-element-property= expects keywords).
Modules covered (per-function test files, Normal/Boundary/Error categories):
- =keybindings.el= — =cj/jump-open-var=, the auto-generated jump commands.
- =host-environment.el= — laptop/desktop predicates, platform predicates,
display predicates, system-timezone detection. Folded a docstring fix on
=cj/detect-system-timezone= along the way.
- =config-utilities.el= — =with-timer=, =cj/compile-this-elisp-buffer=,
=cj/emacs-build--summary-string=, info-commands smoke. Plus refactor pass
to extract testable internals from the four heavyweight interactives:
=cj/--delete-compiled-files-in-dir=, =cj/--benchmark-method=,
=cj/--recompile-emacs-home=, =cj/--validate-timestamps-in-buffer= +
=cj/--format-validation-report-section=.
- =org-noter-config.el= — preferred-split, title-to-slug,
generate-notes-template, the predicate cluster.
Broader scope (the 11 high-value untested modules, 7 lightly-tested ones, and
~28 use-package wrappers to triage) is tracked under the [#B] "Coverage audit:
untested and lightly-tested modules" entry.
** DONE [#B] Test Slack mark-as-read and bury buffer (C-; S q) :tests:
CLOSED: [2026-04-30 Thu]
Verified working. =cj/slack-mark-read-and-bury= is bound to =C-; S q= in
=modules/slack-config.el=, replacing the previous binding that referenced a
non-existent =slack-buffer-mark-as-read-and-bury=.
** DONE [#A] Fix calendar-sync UNTIL boundary regression :bug:
CLOSED: [2026-05-03 Sun]
Real cause was a Saturday-only flake in the test, not a stale =.elc= as
earlier triage suggested. =test-calendar-sync--expand-weekly-boundary-single-week-5-element-until=
built its byday string from a 0-indexed Sunday-first array
=("SU" "MO" "TU" "WE" "TH" "FR" "SA")= while the production code uses
Monday=1, Sunday=7 throughout. When start-date landed on a Sunday
(start-weekday=7), =(nth 7 array)= returned nil, and inside =expand-weekly=
the =(mod (- nil current-weekday) 7)= form raised
=wrong-type-argument number-or-marker-p nil=. The test failed every
Saturday (when "tomorrow" is Sunday) and passed the other six days.
Fixed in commit =8ec668d= by switching the lookup to
=(nth (1- start-weekday) '("MO" "TU" "WE" "TH" "FR" "SA" "SU"))= — the
same convention as every other weekday-mapping in the codebase. Verified
across all 7 weekdays via faked =current-time=.
Production code was internally consistent; no production change needed.
** DONE [#B] Investigate missing yasnippet configuration
CLOSED: [2026-02-16 Mon]
Resolved: snippets were in ~/sync/org/snippets/ but directory was empty after
machine migration. Restored 28 snippets from backup, relocated snippets-dir
to ~/.emacs.d/snippets/ for source control.
** DONE [#B] Write Complete ERT Tests for This Config [13/13]
CLOSED: [2026-02-16 Mon]
All 13 modules covered: custom-case (43), custom-datetime (10), hugo-config (41),
org-capture-config (22), modeline-config (26), config-utilities (11),
org-agenda-config (31), org-contacts-config (40), ui-config (27),
org-refile-config (16), org-webclipper (31), org-noter-config (30),
browser-config (20). 172 test files, all passing.
** DONE [#B] Validate recording startup
CLOSED: [2026-02-15 Sun 15:40]
Check process status after starting.
Parse ffmpeg output for errors.
Show actual ffmpeg command for debugging.
** DONE [#C] Fix EMMS keybinding inconsistency with other buffers
CLOSED: [2026-02-15 Sun 15:40]
EMMS keybindings conflict with standard buffer keybindings, causing mistypes.
Results in accidental destructive actions (clearing buffers), requires undo + context switch.
Violates Intuitive value - muscle memory should help, not hurt.
** DONE [#B] Update stale model list in ai-config.el
CLOSED: [2026-03-06 Fri]
Model IDs were outdated. Updated to current models (claude-opus-4-6, claude-sonnet-4-6, etc.).
See cleanup task in ai-config.el for full list of related improvements.
** DONE [#C] Graduate easy-hugo into hugo-config.el, retire wip.el, uninstall pomm
CLOSED: [2026-04-22 Wed]
Move the easy-hugo use-package block from modules/wip.el into modules/hugo-config.el so the full Hugo pipeline (new post → ox-hugo export → preview server → SSH deploy) lives in one place and is actually reachable at runtime. wip.el is currently not required in init.el, so its only live block (pomm) never ran anyway.
Scope:
- Verify easy-hugo is usable against current Hugo CLI and the paths in the existing config (~/code/cjennings-net/, /var/www/cjennings/).
- If easy-hugo is healthy: graduate it and propose keybindings under the C-; h hugo prefix.
- If easy-hugo is unmaintained or broken: document the issues, assess whether fixing or forking is viable.
- Delete modules/wip.el entirely and remove the commented-out (require 'wip) line at init.el:156.
- Uninstall pomm (remove from elpa/).
- Confirm make compile no longer warns about wip or pomm.
** DONE [#C] Consider Recording Enhancement via post-processing hooks
CLOSED: [2026-04-04 Sat 12:00]
Auto-compress after recording.
Move to cloud sync directory.
Generate transcript (once transcription workflow exists).
** DONE [#B] Implement coverage reporting (per docs/design/coverage.org)
CLOSED: [2026-04-23]
Diff-aware coverage report with pluggable backends. Shipped v1 on 2026-04-23.
Design: [[file:../docs/design/coverage.org][docs/design/coverage.org]]
What shipped:
- modules/coverage-core.el (engine, backend registry, cj/coverage-report, cj/coverage-report-mode)
- modules/coverage-elisp.el (undercover.el backend, auto-registered on load)
- make coverage Makefile target (simplecov JSON output, per-file isolation, .elc cleanup, exclusion list)
- tests/run-coverage-file.el (undercover driver for the Makefile)
- ERT tests for all pure helpers (parse-simplecov, parse-diff, intersect, format-report, backend registry, scope lookup) plus one smoke test for the command
- F7 global binding
- docs/design/coverage.org (design doc with historical LCOV→simplecov pivot note)
Notable pivots during implementation:
- Switched collection format from LCOV to simplecov (undercover's :merge-report t only supports simplecov).
- `make coverage` must delete modules/*.elc first so undercover's source-level instrumentation actually fires.
- Excluded tests/test-all-comp-errors.el from coverage runs (byte-compiles modules, which fails under undercover instrumentation).
Deferred to future tickets:
- Python, TypeScript, Go backends
- Fringe-overlay coverage display (parked over perf concerns)
- Historical coverage tracking
** DONE [#A] Fix "Invalid face attribute :foreground nil" flood :bug:
CLOSED: [2026-04-26 Sun 20:15]
Diagnosed 2026-04-26 — paused at /start-work Gate 2. Full diagnostic, root cause, proposed fix, test plan, and verification path saved to wttrin's inbox (the fix lives in that repo, so the diagnostic does too):
[[file:~/code/emacs-wttrin/inbox/wttrin-face-flood-diagnosis.txt][~/code/emacs-wttrin/inbox/wttrin-face-flood-diagnosis.txt]]
Summary: root cause is =wttrin--make-emoji-icon= in =/home/cjennings/code/emacs-wttrin/wttrin.el:598-608=. Builds a face spec with =:foreground foreground= unconditionally when =wttrin-mode-line-emoji-font= is set; the caller passes nil when the cache is fresh, producing =(:family ... :foreground nil)= which Emacs treats as invalid on every redisplay.
Fix lives in the wttrin repo (cross-repo), not =.emacs.d=. Two-commit scope: regression test + fix.
** DONE [#B] Test Slack desktop notifications (DM and @mention) :tests:
CLOSED: [2026-04-26 Sun]
Notifications were silently failing due to two bugs in =cj/slack-notify=:
1. =slack-room-im-p= (nonexistent) → =slack-im-p= (correct EIEIO predicate)
2. =slack-message-to-string= (propertized) → =slack-message-body= (plain text)
Verified in actual Slack use: desktop notifications fire correctly for DMs and @mentions, with the title and message body rendering as expected.
*File:* modules/slack-config.el (cj/slack-notify function)
** DONE [#C] Clean up ai-config.el
CLOSED: [2026-03-06 Fri]
Cleaned up assorted issues in =modules/ai-config.el=:
- Stale model list updated to current IDs (=claude-opus-4-6=, =claude-sonnet-4-6=, etc.).
- Removed duplicate =gptel-backend= setq (lines 284 and 295 both did the same set).
- Deleted the unused =cj/gptel-backends= defvar (duplicated =cj/gptel--available-backends=).
- Moved helpers (=cj/gptel--fresh-org-prefix=, =cj/gptel--refresh-org-prefix=, =cj/gptel-backend-and-model=, =cj/gptel-insert-model-heading=) outside the use-package =:config= block for visibility and byte-compilation.
- Changed =gptel-include-reasoning= from ='ignore= to a buffer name (=*AI-Reasoning*=) so reasoning lands in a separate buffer, isn't re-sent as context, and can be toggled per-session via the gptel menu (=C-; a M=).
- Switched =gptel-magit= loading from a hook to lazy autoloads via =with-eval-after-load 'magit= so it only loads on key press.
- Moved Rewrite from =&= to =C-; a r= and Clear context to =C-; a c= for clearer mnemonics.
** DONE [#B] Use file basename, not buffer name, when moving buffer files :review:bug:quick:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 19:24
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review custom editing utility modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=cj/--move-buffer-and-file= builds the destination as =(concat dir "/" name)=,
where =name= is =(buffer-name)=. If the buffer has been renamed, uniquified
(e.g. =foo.txt<2>=), or otherwise differs from the file basename, the move can
write an unexpected destination filename.
Expected outcome:
- Use =(file-name-nondirectory filename)= for the destination basename unless
the interactive command explicitly asks for a new name.
- Add regression tests for:
- renamed buffer visiting =original.txt=,
- duplicate buffer names / uniquified names,
- target directory with and without trailing slash.
Done 2026-05-03:
- =cj/--move-buffer-and-file= now derives the destination basename from
=buffer-file-name=.
- =cj/move-buffer-and-file= uses the same basename when checking/prompting for
overwrite.
- Added regression coverage for renamed and uniquified buffer names.
** DONE [#B] Fix malformed drill capture template in =org-capture-config.el= :review:bug:quick:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 19:28
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review Org workflow modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
The ="d"= drill capture template appears to have a malformed source link:
#+begin_src org
Source: [[%:link][%:description]
nCaptured On: %U
#+end_src
It is missing the closing =]]= and has a literal leading =n= before "Captured".
Expected outcome:
- Fix the template string.
- Add a narrow test that expands or inspects the template and confirms the
source link plus "Captured On" line are well-formed.
Done 2026-05-03:
- Closed the source link in the regular drill capture template.
- Removed the stray literal =n= before =Captured On=.
- Added =tests/test-org-capture-config-drill-template.el=.
** DONE [#B] Disable auth-source debug logging by default :review:security:quick:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 19:40
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review integrations and application modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=auth-config.el= sets =auth-source-debug= to =t=. Debug output is helpful while
fixing GPG/auth-source issues, but credential lookup debug logging should not be
the steady-state default for a config that handles Slack, AI, REST, mail, and
transcription credentials.
Expected outcome:
- Default =auth-source-debug= to nil.
- Add an explicit troubleshooting command or variable to enable auth debugging
temporarily.
- Confirm no module logs secret values directly on auth failure.
Done 2026-05-03:
- Defaulted =auth-source-debug= to nil via =cj/auth-source-debug-enabled=.
- Added =cj/set-auth-source-debug= and =cj/toggle-auth-source-debug= for
temporary troubleshooting.
- Added =tests/test-auth-config-debug.el=.
- Scanned nearby auth callers; obvious failure messages name hosts/logins but
do not print secret values directly.
** DONE [#B] Quote F6 current-file test commands in =dev-fkeys.el= :review:bug:quick:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 19:44
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review programming workflow modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=cj/--f6-test-runner-cmd-for= builds shell command strings from relative paths,
directories, and source stems:
#+begin_src emacs-lisp
(format "pytest %s" rel-path)
(format "make test-name TEST=^test-%s-" stem)
(format "go test ./%s" rel-dir)
#+end_src
This is fine for the current repo's simple filenames, but it will break or
misbehave for paths with spaces or shell metacharacters. Since these commands
feed =compile=, either quote each dynamic argument or move to a command-builder
that returns argv plus a shell-rendering function.
Expected outcome:
- Quote =rel-path=, =stem= / test regex, and =rel-dir= appropriately.
- Add regression tests for:
- Python test file under a directory with spaces,
- Elisp module stem containing shell-significant characters,
- Go package directory with spaces.
- Keep existing command strings unchanged for ordinary paths.
Done 2026-05-03:
- Added =cj/--f6-shell-quote-argument= so F6 command strings escape dynamic
paths and test regexes only when needed.
- Quoted Python rel-paths, generated Python test paths, Elisp =FILE= /
=TEST= values, and Go package paths.
- Added regression coverage for Python paths with spaces, Elisp stems with
shell metacharacters, and Go package directories with spaces.
- Confirmed ordinary command strings remain unchanged.
** DONE [#B] Disable mail transport debug logging and validate dependencies :review:security:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 19:57
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review integrations and application modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=mail-config.el= sets =smtpmail-debug-info= to =t= and builds mail commands from
=executable-find= results at config time. If =msmtp= or =mbsync= is missing, the
configuration can silently produce unusable command values. Mail debug output is
also too sensitive to leave enabled by default.
Expected outcome:
- Default =smtpmail-debug-info= to nil.
- Add an explicit mail troubleshooting variable/command for temporary SMTP
debug logging.
- Validate =msmtp= and =mbsync= before assigning send/sync commands, and show a
clear warning or disable the dependent feature when missing.
- Add a module-load test with stubbed =executable-find= results.
Done 2026-05-03:
- Defaulted =smtpmail-debug-info= to nil via =cj/smtpmail-debug-enabled=.
- Added =cj/set-smtpmail-debug= and =cj/toggle-smtpmail-debug= for temporary
troubleshooting.
- Added validation helpers for =msmtp= and =mbsync= so missing executables
warn and do not produce unusable command values.
- Added =tests/test-mail-config-transport.el= with stubbed executable lookup.
** DONE [#B] Make test scratch paths sandbox- and CI-friendly :refactor:tests:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 19:59
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#A] Architecture review follow-up from 2026-05-03
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: refactor
:END:
=tests/testutil-general.el= hardcodes =~/.temp-emacs-tests/=. That caused the
first =make coverage= run to fail under the default workspace sandbox because
tests attempted to write outside the repo and =/tmp=.
Confirmed again 2026-05-03 with =make test=: the default sandbox run reported
32 failing test files across custom-buffer, custom-line, music, Org, undead
buffers, and recording cleanup tests. Rerunning the same command with approval
outside the sandbox passed all 311 test files. This is a test-environment
contract problem, not a regression in those modules.
Expected outcome:
- Let tests honor an env var, for example =CJ_EMACS_TEST_DIR=.
- Default to =(make-temp-file ... t)= or a stable directory under
=temporary-file-directory=.
- Keep an option for a stable local directory when debugging manually.
- Ensure cleanup is robust and guarded against deleting outside the selected
test root.
Acceptance criteria:
- =make test-file FILE=test-custom-line-paragraph-join-line-or-region.el=
works without special home-directory write permission.
- =make coverage= works in a clean sandbox/CI environment.
- Update any docs or Makefile notes that assume =~/.temp-emacs-tests/=.
Done 2026-05-03:
- Changed =cj/test-base-dir= to honor =CJ_EMACS_TEST_DIR= for stable local
debugging and otherwise create a unique directory under
=temporary-file-directory=.
- Replaced prefix-string path checks with =file-in-directory-p= and added a
deletion guard that refuses broad roots such as =temporary-file-directory=.
- Updated =make clean-tests= to clean the new temp-root pattern and the legacy
=~/.temp-emacs-tests= directory.
- Added =tests/test-testutil-general.el=.
- Confirmed default sandbox =make test= passes: 312 test files.
** DONE [#B] Fix C single-file compile command path handling :review:bug:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 20:11
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review programming workflow modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=prog-c.el= builds the fallback single-file compile command from =(buffer-name)=:
#+begin_src emacs-lisp
(format "gcc -Wall -Wextra -g -o %s %s"
(file-name-sans-extension (buffer-name))
(buffer-name))
#+end_src
This breaks for renamed buffers, duplicate buffer names, paths with spaces, and
files outside =default-directory=.
Expected outcome:
- Use =buffer-file-name= for source path and derive output from the file path.
- Shell-quote both paths.
- If the buffer is not visiting a file, show a clear message or use a safe temp
target.
- Add regression tests for filenames with spaces and renamed buffers.
Done 2026-05-03:
- Added =cj/c--single-file-compile-command= and changed the fallback path to
use =buffer-file-name= instead of =(buffer-name)=.
- Shell-quoted source and output paths.
- Made non-file buffers signal a clear =user-error=.
- Added =tests/test-prog-c-compile-command.el= for spaces, shell
metacharacters, renamed buffers, and non-file buffers.
** DONE [#B] Replace shell-based coverage git diff calls with argv process calls :review:robustness:refactor:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 20:11
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review programming workflow modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=coverage-core.el= uses =shell-command-to-string= for git diff scopes, including
forms with command substitution:
#+begin_src emacs-lisp
git diff $(git merge-base HEAD main)..HEAD --unified=0
#+end_src
The inputs are mostly fixed, but this code is central tooling and should avoid
shell parsing entirely.
Expected outcome:
- Use =process-file= / =call-process= with argv lists.
- Compute merge bases with a separate git invocation.
- Surface git failures as clear =user-error= messages.
- Preserve the existing parser and report formatting tests.
Done 2026-05-03:
- Added argv-boundary tests before the implementation change.
- Replaced =shell-command-to-string= with =process-file= based git helpers.
- Compute merge-base with a separate =git merge-base HEAD <base>= invocation
before running =git diff <merge-base>..HEAD --unified=0=.
- Surface non-zero git exits as =user-error= messages that include the git
argv, exit status, and command output.
- Updated the interactive coverage report smoke test to stub =process-file=.
** DONE [#B] Cache or cheapen VC work in the custom modeline :review:perf:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 20:24
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review UI and navigation modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=modeline-config.el= computes VC branch/state in a mode-line =:eval= form using
=vc-backend=, =vc-working-revision=, =vc-git--symbolic-ref=, and =vc-state=.
Even though it only displays for the selected window, this can become expensive
in large repositories, remote/TRAMP buffers, or slow filesystems.
Expected outcome:
- Measure the current cost in normal git repos and a TRAMP/remote-like case if
available.
- Cache branch/state per buffer and invalidate on buffer/file save, VC refresh,
or timer.
- Avoid VC calls for remote files unless explicitly enabled.
- Add tests around any pure formatting/cache invalidation helpers.
Pitfalls:
- Mode-line code runs often; avoid anything that can block redisplay.
- Do not lose the useful active-window-only behavior.
Done 2026-05-03:
- Added buffer-local VC modeline caching with a short TTL, plus cache clearing
on save and revert.
- Kept the active-window-only modeline rendering behavior.
- Skipped VC work for remote files by default, with a custom option to opt in.
- Added focused tests for cache reuse, TTL refresh, remote-file bypass, cache
clearing, and VC rendering metadata.
- Measured on this repo after the change: uncached reads were about 2.4 ms
each, cached reads were about 0.0025 ms each, and remote-skipped reads avoid
VC calls while still paying the cheap =file-remote-p= check.
** DONE [#B] Make Projectile command-cache revert state compilation-local :review:robustness:bug:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 21:11
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review programming workflow modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=dev-fkeys.el= protects Projectile's compile/test/run command caches by
capturing prior state in the global =cj/--projectile-revert-state= and reverting
on failed compile when the cached command changed. The idea is useful and well
covered, but the state is global while compilation processes are asynchronous.
Risk:
- Starting another Projectile compile/test/run before the first finish hook
fires can overwrite the state.
- The finish hook is installed even when no project/cache state was captured.
- A failure from one compilation buffer could theoretically act on state from a
later command.
Expected outcome:
- Store revert metadata on the compilation buffer/process where possible, or
close over immutable state in a one-shot hook instead of using one global
variable.
- Only install the revert hook when state was captured.
- Add a test that simulates two overlapping compile processes finishing out of
order.
Done 2026-05-03:
- Changed Projectile command-cache revert capture to return immutable state
instead of storing live compile metadata in one global variable.
- Installed one-shot buffer-local compilation finish hooks on the compilation
buffer returned by Projectile, so overlapping compiles keep separate revert
metadata.
- Avoided installing revert hooks when no project/cache state was captured.
- Added regression coverage for two overlapping compiles finishing out of order.
** DONE [#C] Tighten =dev-fkeys.el= load-order contract with Projectile :review:cleanup:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 21:17
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review programming workflow modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=init.el= loads =dev-fkeys.el= before =prog-general.el=, while =prog-general.el=
owns the =projectile= setup. =dev-fkeys.el= currently works through autoloads,
=fboundp= checks, and top-level advice, but the dependency is implicit.
Expected outcome:
- Either require/load Projectile before installing advice, or move the
=dev-fkeys= require after Projectile setup.
- Keep direct batch requiring of =dev-fkeys.el= test-friendly.
- Add a module-load smoke test for "Projectile not loaded yet" and "Projectile
loaded after dev-fkeys".
Done 2026-05-03:
- Replaced raw top-level Projectile =advice-add= calls with named advice
wrappers and an explicit idempotent installer.
- Registered advice immediately when Projectile is already loaded, otherwise
delayed installation with =eval-after-load=.
- Kept direct batch requiring of =dev-fkeys.el= from forcing Projectile to load.
- Added smoke tests for deferred registration, already-loaded registration, and
bounded installation behavior when Projectile functions are unavailable.
** DONE [#B] Retire legacy =cj/--projectile-revert-on-fail= and global revert state :review:chore:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 21:32
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review programming workflow modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
After scoping the projectile cache-revert state to each compile (commit
=31edc86=), =cj/--projectile-revert-on-fail= and the global
=cj/--projectile-revert-state= are production-dead. They survive only so
=tests/test-dev-fkeys--projectile-revert-on-fail.el= keeps exercising the
inner decision logic via the legacy wrapper.
Expected outcome:
- Delete =cj/--projectile-revert-on-fail= and =cj/--projectile-revert-state=
from =modules/dev-fkeys.el=.
- Re-point the existing =test-dev-fkeys--projectile-revert-on-fail.el= cases
at =cj/--projectile-revert-state-on-fail= (or rename the file to match
the new target).
- Confirm the broader dev-fkeys test set still passes after the rename.
Done 2026-05-03:
- Removed the production-dead legacy wrapper and global revert state from
=dev-fkeys.el=.
- Repointed the existing revert tests at =cj/--projectile-revert-state-on-fail=.
- Removed stale test bindings/assertions that only existed for the legacy global
state.
** DONE [#C] Review duplicate or competing search/keybinding setup in =selection-framework.el= :review:cleanup:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 23:27
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review UI and navigation modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=selection-framework.el= binds =C-s= to =consult-line= and later rebinds it to
=cj/consult-line-or-repeat=. The final behavior is probably intended, but the
earlier binding is dead configuration and makes the file harder to reason about.
Expected outcome:
- Remove the intermediate =C-s= binding or explain it.
- Add a small test or smoke check that =C-s= resolves to
=cj/consult-line-or-repeat= after the module loads.
Verify 2026-05-03:
- Removed the intermediate global =C-s= binding to =consult-line=.
- Kept the final =C-s= binding to =cj/consult-line-or-repeat=.
- Added a smoke test that loads =selection-framework.el= with package setup
stubbed and asserts =C-s= resolves to =cj/consult-line-or-repeat=.
** DONE [#C] Move and test theme persistence behavior :review:tests:refactor:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 23:46
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review UI and navigation modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=ui-theme.el= persists theme names to =theme-file= and loads fallback themes
when the file is absent or invalid. The current default path is built from
=org-dir= as =emacs-theme.persist=, which makes UI theme persistence depend on
Org-directory configuration and keeps an Emacs preference outside the Emacs
home directory.
Desired direction:
- Make the persisted theme file a dotfile inside =user-emacs-directory=, e.g.
=.emacs-theme= or another clear dotfile name.
- Remove the runtime need for =org-dir= from theme persistence.
- Keep the theme persistence code self-contained in =ui-theme.el= unless an
existing constants helper is a better local fit.
- Preserve the current user-facing behavior: chosen themes persist, unreadable
or invalid saved themes fall back, and literal ="nil"= means no enabled theme.
- Refactor the current large theme-load function into smaller helpers for:
reading persisted theme names, disabling enabled themes, loading one named
theme, applying a persisted theme value, and loading fallback themes.
- Prefer =defcustom= for user-facing persistence/fallback settings.
- Replace generic =cj/read-file-contents= / =cj/write-file-contents= names with
theme-specific helpers or move generic helpers elsewhere.
- Prefer =write-region= over visiting the file with =write-file= for persistence.
- Decide whether the top-level =(cj/load-theme-from-file)= side effect should
remain in the module or become an explicit init call; preserve startup behavior
either way.
Useful tests:
- The default =theme-file= expands under =user-emacs-directory= and does not
depend on =org-dir=.
- Reading a missing/unreadable theme file returns nil.
- Writing to a writable temp theme file succeeds.
- Invalid theme name triggers fallback path without leaving multiple themes
enabled.
- The literal ="nil"= disables themes.
- Loading a valid persisted theme uses that theme and does not also load the
fallback.
- Theme application disables existing themes before loading a valid or fallback
theme, so themes do not stack.
- Theme writes use the configured =theme-file= and do not visit that file in a
temp buffer.
Keep tests isolated by binding =theme-file= to a temp file and mocking
=load-theme= / =disable-theme= where appropriate. Avoid mutating the real
=custom-enabled-themes= state in tests.
Pitfalls:
- =ui-theme.el= currently calls =cj/load-theme-from-file= at module load time,
so tests should either bind =theme-file= before loading or mock file/theme
effects carefully.
- If changing the persisted filename, consider whether a migration path from
the old =org-dir/emacs-theme.persist= location is worth doing now or should
be a separate compatibility task.
Verify 2026-05-03:
- Moved the default =theme-file= to =(expand-file-name ".emacs-theme"
user-emacs-directory)=.
- Removed the =org-dir= / =user-constants= dependency from =ui-theme.el= theme
persistence.
- Split theme persistence into theme-specific helpers for read/write,
disabling themes, named theme loading, fallback loading, and applying a
persisted value.
- Switched persistence writes to =write-region=.
- Moved startup theme loading out of module load side effects and into
=init.el= immediately after requiring =ui-theme=.
- Added focused tests for the default path, missing reads, writes,
=write-region= use, valid persisted themes, invalid fallback, missing
fallback, and literal ="nil"=.
- Verified with =make test-file FILE=test-ui-theme-persistence.el=,
=make test-file FILE=test-all-comp-errors.el=,
=make test-file FILE=test-dupre-theme.el=, and full =make test=.
** DONE [#B] Make test-runner focus state project-scoped :review:tests:bug:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 23:46
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review programming workflow modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=test-runner.el= stores =cj/test-focused-files= and =cj/test-mode= globally.
When switching between projects, focused test filenames and mode can bleed into
the next project.
Expected outcome:
- Scope focused files and mode by project root.
- Keep the current UI commands unchanged.
- Coordinate with the existing [#B] "Add project-aware ERT test isolation when
switching projects" task so test registration and focus state follow the same
project boundary.
Verify 2026-05-03:
- Added per-project test-runner state keyed by Projectile project root, with
focused files and all/focused mode tracked independently per project.
- Kept the existing interactive commands and legacy public variables mirrored
to the current project state.
- Removed the hard test-time dependency on requiring Projectile before project
root calls can be mocked.
- Added regression tests proving focused files and mode do not bleed across
projects.
- Verified with =make test-file FILE=test-test-runner.el=,
=make test-file FILE=test-all-comp-errors.el=,
=make test-file FILE=test-dev-fkeys--f6-test-runner.el=,
=make test-file FILE=test-dev-fkeys--f6-current-file-tests-impl.el=, and
full =make test=.
** DONE [#B] Add project-aware ERT test isolation when switching projects :tests:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 23:46
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:END:
When switching between elisp projects (e.g., emacs.d to Chime), previously loaded
ERT tests remain in memory causing confusion and wrong tests to run.
**Problem:**
- ERT tests globally registered in Emacs session
- `M-x ert RET t RET` runs ALL loaded tests from ALL projects
- Can accidentally run emacs.d tests when working on Chime
- Current workaround: restart Emacs (loses session state)
**Solution:**
Create `cj/ert-clear-tests` and `cj/ert-run-current-project-tests`:
- Clear tests when switching projects (hook into project-switch)
- Use test name prefixes to selectively clear (cj/ vs chime-)
- Only run current project's tests
**Success Criteria:**
- Switch projects -> old tests cleared
- Only current project's tests run with `M-x ert`
- Works with both interactive and batch runs
Verify 2026-05-03:
- Added =cj/ert-clear-tests= to delete ERT tests loaded by this runner from
other known project roots while keeping the current project's tests.
- Added =cj/ert-run-current-project-tests= and routed =cj/test-run-all= through
a current-project selector, so the test runner's "all" path runs all tests
for the current project rather than every loaded ERT test in the session.
- Hooked =cj/test-project-switch-reset= into
=projectile-after-switch-project-hook= after Projectile loads.
- Added regression tests for clearing other-project ERT tests and selecting
only current-project test names.
- Verified with =make test-file FILE=test-test-runner.el=,
=make test-file FILE=test-all-comp-errors.el=,
=make test-file FILE=test-dev-fkeys--f6-test-runner.el=,
=make test-file FILE=test-dev-fkeys--f6-current-file-tests-impl.el=, and
full =make test=.
** DONE [#B] Sanitize calendar-generated Org headings and properties :review:bug:
CLOSED: [2026-05-03 Sun]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-03 Sun 23:52
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review integrations and application modules
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review
:END:
=calendar-sync--event-to-org= sanitizes description body text against accidental
Org headings, but event summaries, locations, organizers, statuses, and URLs are
inserted into headings/property drawers directly. Calendar text containing
newlines, leading stars, or property drawer markers can corrupt the generated
Org structure.
Expected outcome:
- Add separate sanitizers for Org heading text and property values.
- Preserve readable event text while escaping or flattening structural
characters.
- Add tests for summaries with newlines/stars and locations with property-like
lines.
Verify 2026-05-03:
- Added separate sanitizers for Org heading text and Org property values.
- Event summaries now flatten newlines and convert leading heading stars to
dashes before being inserted as Org heading text.
- Location, organizer, status, and URL values now collapse structural
whitespace into single-line property values before insertion into the
property drawer.
- Added regression tests for summaries with newlines/stars and property values
containing =:END:=, property-looking text, and heading-looking text.
- Verified with =make test-file FILE=test-calendar-sync--event-to-org.el=,
=make test-file FILE=test-calendar-sync--sanitize-org-body.el=,
=make test-file FILE=test-all-comp-errors.el=,
=make test-file FILE=test-calendar-sync.el=,
=make test-file FILE=test-calendar-sync--parse-event.el=,
=make test-file FILE=test-calendar-sync--event-start-time.el=, and full
=make test=.
** DONE [#B] Add a no-config startup test for =calendar-sync.el= :review:security:refactor:
CLOSED: [2026-05-04 Mon]
:PROPERTIES:
:ARCHIVE_TIME: 2026-05-04 Mon 00:05
:ARCHIVE_FILE: ~/.emacs.d/todo.org
:ARCHIVE_OLPATH: Emacs Open Work/PROJECT [#B] Module-by-module review and hardening/Review Org workflow modules/PROJECT [#A] Split personal calendar configuration from =calendar-sync.el=
:ARCHIVE_CATEGORY: todo
:ARCHIVE_TODO: DONE
:ARCHIVE_ITAGS: review security refactor
:END:
Bind =calendar-sync-calendars= to nil and verify:
- requiring the module does not start a timer,
- =calendar-sync-status= reports the missing configuration cleanly,
- no network process is started.
Verify 2026-05-03:
- Removed the tracked top-level personal calendar plist from =calendar-sync.el=,
leaving =calendar-sync-calendars= nil by default.
- Added an ignored private config path, =calendar-sync.local.el=, loaded when
readable so local calendar definitions can stay outside git.
- Added =calendar-sync.local.el= to =.gitignore= and moved the current local
calendar plist into that ignored file to preserve this machine's workflow.
- Gated top-level auto-start behind =(not noninteractive)= so batch/test loads
do not start timers or network fetches, even when private config exists.
- Added startup tests for no-config loads, missing-config status reporting,
private config loading, and private config not auto-starting in batch.
- Verified with =make test-file FILE=test-calendar-sync-no-config-startup.el=,
=make test-file FILE=test-calendar-sync.el=,
=make test-file FILE=test-all-comp-errors.el=, and full =make test=.
** DONE [#C] Add focused tests for early startup archive construction :tests:
CLOSED: [2026-05-10 Sun]
=tests/test-early-init-paths.el= covers path constants, but not archive
selection, archive priorities, refresh decisions, or the offline/localrepo
branches that make startup reproducible.
Useful assertions after package bootstrap is extracted:
- Local repo and local mirrors are added only when their directories exist.
- Local archives keep higher priority than online archives.
- =cj/use-online-repos= disables online archives and refresh attempts.
- Stale or missing online archive caches request refresh only through the
extracted bootstrap path, not by loading unrelated modules.
Verify 2026-05-10:
- Extended =tests/test-early-init-paths.el= to cover local archive presence,
local-vs-online priority, offline archive omission, fresh-cache no-refresh,
and missing-cache refresh behavior.
- Ran =make test-file FILE=test-early-init-paths.el=.
** DONE [#C] Move inline GPT tool wiring out of =init.el= :startup:refactor:
CLOSED: [2026-05-10 Sun]
=init.el= contains a =with-eval-after-load 'gptel= block that mutates
=load-path= and requires local files from =~/.emacs.d/gptel-tools=. This is
feature-specific integration code inside the top-level load graph, and it will
be hard to test or defer cleanly while it stays inline.
Expected outcome:
- Move the tool registration into =ai-config.el= or a small dedicated module.
- Guard the local tool directory and individual tool files so missing optional
files produce a clear message rather than breaking startup after =gptel= loads.
- Keep =init.el= limited to coarse module loading until the load-graph refactor
removes most eager =require=s.
- Add a smoke test for the missing-directory path if the helper is pure enough.
Verify 2026-05-10:
- Moved optional GPTel tool loading into =ai-config.el= via
=cj/gptel-load-local-tools=.
- Removed the inline =with-eval-after-load 'gptel= tool block from =init.el=.
- Added =tests/test-ai-config-gptel-local-tools.el= for missing-directory,
present-tool, and missing-file behavior.
- Ran focused AI config tests and checked parens for =init.el= and
=modules/ai-config.el=.
** DONE [#C] Clean up Org keymap ownership and duplicate maps :cleanup:refactor:
CLOSED: [2026-05-10 Sun]
=org-config.el= creates =cj/org-map= under =cj/custom-keymap=, then later
creates a separate =cj/org-keymap= under =C-; O=. Other Org modules bind their
own global prefixes directly. This works with the current eager load order, but
it makes the intended owner of Org commands less clear.
Expected outcome:
- Pick one owner for the Org command prefix.
- Move module-specific menus under that owner or document why they remain
separate (=C-c n= for org-roam may be worth keeping).
- Avoid duplicate definitions for =C-; O= and =cj/org-map=.
- Coordinate with the broader custom keymap/load-order architecture task.
Verify 2026-05-10:
- Removed the duplicate =cj/org-keymap= and kept =cj/org-map= as the single
owner of =C-; O= through =cj/custom-keymap=.
- Kept =C-; O c= bound to =cj/org-clear-element-cache=, which handles all Org
buffers by default and only the current Org buffer with a prefix argument.
- Added =tests/test-org-config-keymap-ownership.el= and updated the existing
Org sort test to load newer source in the presence of ignored =.elc= files.
- Ran =make test-file FILE=test-org-config-keymap-ownership.el= and
=make test-file FILE=test-org-sort-by-todo-and-priority.el=.
** DONE [#A] Make repo reconciliation non-destructive by default :data:refactor:
CLOSED: [2026-05-10 Sun]
Before this refactor, =reconcile-open-repos.el= recursively scanned repos and,
for dirty repos, ran
=git stash --quiet=, =git pull --rebase --quiet=, and =git stash pop --quiet=
before opening Magit. That is high blast radius for a convenience command: stash
pop conflicts, untracked files, submodules, and worktrees can all create messy
states.
Verify 2026-05-10:
- Dirty repos now open Magit for review without running stash, pull, or stash
pop.
- Clean repos still pull with =git pull --rebase --quiet= via =process-file=.
- Git calls now use argv lists through =cj/reconcile--git=.
- Reconcile results distinguish =pulled=, =needs-review=, =skipped=,
=pull-failed=, and =status-failed=.
- Repo discovery prunes heavy/generated directories and stops at repo roots by
default.
- HTTP/HTTPS remote skipping is explicit and configurable via
=cj/reconcile-skipped-remote-regexp=.
- Ran all reconcile ERT files and byte-compiled =reconcile-open-repos.el=.
*** DONE [#A] Change dirty repo handling to review-first :bug:
Expected outcome:
- Clean repos may still pull automatically if desired.
- Dirty repos should open Magit or a review buffer before any stash/pull/pop.
- If an auto-reconcile mode is kept, require an explicit prefix argument or
separate command name.
- Update the current dirty-repo tests so they assert the new review-first
behavior instead of encoding =git stash= / =git pull= / =git stash pop= as the
desired path.
*** DONE [#A] Replace shell git calls with process helpers and parse statuses :refactor:
Expected outcome:
- Use =process-file= / =call-process= with argv lists.
- Capture stdout/stderr per repo for a final report.
- Distinguish clean, dirty, skipped, pull-failed, and needs-review states.
- Add tests with stubbed git command results.
*** DONE [#A] Prune expensive directories while discovering repos :refactor:
=cj/find-git-repos= recursively walks the configured project/code roots and
checks every directory for a nested =.git=. That can wander through
=node_modules=, =.venv=, =target=, vendored source, build output, and nested
dependency checkouts.
Expected outcome:
- Add a configurable prune list for heavy/generated directories.
- Stop descending once a repo root has been found unless explicitly requested.
- Add tests for nested repos and ignored heavy directories.
*** DONE [#A] Make remote skip policy explicit and configurable
=cj/reconcile--reference-clone-p= treats HTTP/HTTPS remotes as reference clones
and skips them. That may be right for this machine, but the behavior is encoded
as a naming mismatch and can skip ordinary repos.
Expected outcome:
- Rename the predicate to reflect the actual policy, or make the policy
configurable.
- Report skipped repos with the reason in the final reconcile output.
- Keep tests for SSH remotes, HTTP remotes, and local/file remotes.
** DONE [#B] ai-vterm: occasional wrong-edge replay after buffer-move dance :bug:
CLOSED: [2026-05-10 Sun]
Shipped 2026-05-09 in commit =26e9763= "fix(ai-vterm): harden F9 toggle across multi-window and buffer-move". The fix maps cardinal directions to frame-edge variants on replay (=right= → =rightmost=, =below= → =bottom=), switches captured units from frame-fractions to absolute body-cols / body-lines, wraps replay sizes in =(body-columns . N)= / =(body-lines . N)= cons forms so dividers don't shift the body, and uses =delete-window= (with =one-window-p= guard) instead of =quit-window= so buffer-moved windows don't leak. 7 regression tests added covering each scenario; 80 ai-vterm tests pass.
Surfaced 2026-05-09. After an extended sequence with both vterm and
ai-vterm visible, switching orientations, buffer-moving claude
between positions, and toggling each independently, claude
eventually replayed at the right side when its captured direction
should have been =below= (it had just been buffer-moved to the
bottom and toggled there).
The full sequence that hit it:
1. F9 to open claude (right side).
2. F12 to open vterm. M-S-t to flip vterm to right-side -- gives
dashboard | vterm | claude. Toggle each off/on; both behave.
3. F12 vterm off. M-S-t flips claude to left half. Toggle both
off/on; both behave.
4. Toggle both off. F12 vterm on. M-S-t flips vterm to bottom.
Toggle both on/off; both behave.
5. Buffer-move claude to the bottom.
6. Toggle claude there -- claude pops up at the right instead of
at the bottom.
** DONE [#B] Scope F12 (vterm-toggle) to non-claude vterm buffers, preserve user orientation :refactor:bug:
CLOSED: [2026-05-10 Sun]
Shipped 2026-05-09 in commit =554b32d= "feat(vterm): F12 toggle that excludes claude and preserves geometry". F12 now binds =cj/vterm-toggle= (replaces the =vterm-toggle= package binding). =cj/--vterm-toggle-buffer-p= excludes =claude [= prefixed buffers from the candidate set; =cj/--vterm-toggle-capture-state= records direction + body size at toggle-off; =cj/--vterm-toggle-display-saved= replays via =(body-columns . N)= / =(body-lines . N)= cons forms with cardinal direction mapped to frame-edge variant. Toggle-off uses =delete-window= (with =one-window-p= guard) so buffer-move scenarios don't leak ghost windows. The hard-coded =(window-height . 0.7)= override is gone — user-resized geometry persists. 19 new tests across buffer-filter, dispatch, and display.
F12 previously ran =vterm-toggle=, which picked the most-recent vterm buffer
as the toggle target. When that target was a =claude [<repo>]= buffer (which
has its own F9/C-F9/M-F9 dispatch via =modules/ai-vterm.el=), F12 ended up
toggling Claude. The display-buffer rule in =modules/eshell-vterm-config.el=
already excluded =claude [= names from the bottom-window placement, but the
exclusion only governed /where/ a buffer landed once vterm-toggle had chosen
it -- not which buffer got chosen.
Two changes shipped:
1. *Filter claude buffers from vterm-toggle's target set* via
=cj/--vterm-toggle-buffer-p=, which ignores buffers whose names start with
"claude [".
2. *Respect user-modified window orientation.* Captured direction + body size
at toggle-off; replayed via =(body-columns . N)= / =(body-lines . N)= cons
forms. The hard-coded =(window-height . 0.7)= override is gone.
** DONE [#C] Move vterm-copy-mode binding off C-c C-t to the personal keymap :chore:quick:
CLOSED: [2026-05-10 Sun 02:02]
Default vterm binding is =C-c C-t=, which collides with the =C-c= space many modes
reach for and is awkward to hit when the terminal is the active buffer. Move it
to the personal keymap (=C-;= prefix) — pick a mnemonic letter (e.g. =C-; V c=
for "vterm copy") and unbind the default in =vterm-mode-map=. Update
=modules/eshell-vterm-config.el= alongside any related vterm bindings.
Implemented with a broader =C-; V= vterm menu, clickable URLs in vterm buffers,
=C-; V c= for raw =vterm-copy-mode=, and =C-; V C= for tmux-pane history
capture into a temporary Emacs buffer.
** DONE [#A] AI-Term-Related Improvements
*** DONE Check for widen/shorten buffer keys.
The keybinding you "thought you had" is =windsize= on =C-s-<arrow>= (Ctrl+Super) — a tiling WM eats Ctrl+Super, which is why it didn't seem to exist. Shipped 2026-05-11 in commit =f837e5f= "feat(window): resize the split with C-; b <arrow>": =C-; b <left>/<right>/<up>/<down>= moves the active window's divider that way (via =windsize=), then keeps =cj/window-resize-map= active so bare arrows keep nudging until any other key (or =C-g= / =<escape>=); =C-u N C-; b <right>= resizes by N. The old =C-s-<arrow>= bindings were dropped; =windsize= is now =:commands=-deferred with =windsize-cols=/=windsize-rows= at 2. =cj/window-resize-sticky= (in ui-navigation.el) dispatches on the arrow that triggered it and arms the loop. New ERT tests; all green.
*** DONE Evaluate this buffer should be in personal keybindings also.
=eval-buffer= is now on =C-; b e= (it already had =C-c b=). =e= had been =cj/view-email-in-buffer= and the requested fallback =C-; b m= is =cj/move-buffer-and-file=, so email-view moved to =C-; b E= (docstring + which-key updated too). All in =modules/custom-buffer-file.el=.
*** DONE Last ai-project used should be topmost in completing-read.
Shipped 2026-05-11 in commit =c14d6c8= "feat(ai-vterm): order the project picker by most-recently-used". The picker's active group (projects with a live tmux session) now leads with projects opened this session, most-recent first (=cj/--ai-vterm-mru=, pushed by =cj/--ai-vterm-show-or-create=), then the rest of the active group alpha, then the no-session group alpha. Bundled fix: =cj/--ai-vterm-tmux-session-name= now sanitizes =.= / =:= → =_= the way tmux does, so =.emacs.d= (real session =aiv-_emacs_d=) is correctly matched to its session and shows up in the active group (and crash-recovery reattaches instead of spawning a duplicate). New tests + updated tests; all green.
*** DONE Kill other window that leaves the split where it is.
Didn't exist (the closest, =cj/kill-other-window= on =M-S-o=, *deletes* the other window). Shipped 2026-05-11 in commit =0ddbcde= "feat(window): kill the other window's buffer with C-; b K": =cj/kill-other-window-buffer= (in undead-buffers.el, on =C-; b K=) kills or buries the buffer shown in the other window and leaves that window and the split alone — the window then shows whatever bury/kill surfaces next. Reuses =cj/kill-buffer-or-bury-alive= so =cj/undead-buffer-list= buffers (=*scratch*= etc.) are buried; with 3+ windows it acts on =next-window=; errors with "No other window" if there's only one. =M-S-o= / =cj/kill-other-window= kept as-is (different op). 4 new ERT tests; all green.
*** DONE Kill this buffer/window that leaves the split.
Yes — the command is =cj/kill-buffer-and-window= (in =modules/undead-buffers.el=), bound to =C-; b k= (keymap entry in =modules/custom-buffer-file.el=, under the "buffer and file menu"). It does =(delete-window)= on the current window unless it's the only one, then kills (or buries, for "undead" buffers like =*scratch*=) the buffer — so in a 3-column split, =C-; b k= in column 2 leaves columns 1 and 3 as a normal 2-column split. No code change needed.
Footnote on the =M-S-c= memory: =M-S-c= was Emacs's default =capitalize-word= and is now =time-zones= (=modules/chrono-tools.el=) — it was never this command. The =M-S-= window-killing family is =M-S-o= → =cj/kill-other-window= and =M-S-m= → =cj/kill-all-other-buffers-and-windows=.
*** DONE M-w shouldn't close the buffer or copy-mode
Shipped 2026-05-11 in commit =949bdeb= "feat(vterm): unify the keys in vterm copy-mode and tmux history". Both scrollback surfaces (=vterm-copy-mode= and the tmux-history buffer) now share one key story: =M-w= copies the active region and stays put (copy several things in a row); =C-g=, =<escape>=, or =q= leaves without copying; =RET= is unbound (no "copy and exit" — vterm's default =RET → vterm-copy-mode-done= binding removed). Dropped the now-dead =cj/vterm-tmux-history-copy-and-quit= (=M-w= then =q= is the equivalent). Also moved =cj/vterm-tmux-history= from =C-; x C= to =C-; x h= (unshifted, frees =C=) and refreshed the file's stale commentary header. Tests updated.
*** DONE cursor still orange after hitting return.
Shipped 2026-05-11 in commit =a70bb98= "fix(ui-config): use the writeable cursor color in a live vterm". Root cause: =vterm-mode= sets =buffer-read-only=, so the post-command cursor-color hook painted the cursor the read-only color (orange) any time point was in a vterm — copy-mode and the live terminal alike. Fix: a live vterm (=vterm-mode= and not =vterm-copy-mode=) now reports =unmodified= (white); =vterm-copy-mode= still reports =read-only= (orange), which Craig confirmed he wants. Extracted =cj/--buffer-cursor-state= for testability; 7 new ERT tests.
*** DONE open in other window question/issue
Shipped 2026-05-11 in commit =071fb5e= "feat(ai-vterm): keep emacsclient files out of the agent window". =server-start= left =server-window= nil, so =emacsclient -n= opened files in the selected window — which is the agent window when you're typing in it. Fix in ai-vterm.el: =server-window= now points at =cj/--ai-vterm-server-display=, which routes the file to a non-agent window (splitting one off the agent when it's the only window); emacsclient from anywhere else still goes through =pop-to-buffer=. Helper =cj/--ai-vterm-non-agent-window= picks the target (skips the minibuffer, dedicated windows, agent windows). 7 new ERT tests. Confirmed working — direction-agnostic, picks the "other" window whichever side the agent is on.
** DONE [#A] Optimize org-capture target building performance :perf:
CLOSED: [2026-05-11 Mon 13:05]
15-20 seconds every time capturing a task (12+ times/day).
Major daily bottleneck - minutes lost waiting, plus context switching cost.
Implemented 2026-05-11: cache validated =file+headline= target markers in
=org-capture-config.el= so repeated task captures into =Inbox= skip Org's
full-file headline scan. Added regression coverage in
=tests/test-org-capture-config-target-cache.el=.
** DONE [#A] Fix Slack reaction workflow (C-; S !) :bug:
CLOSED: [2026-05-11 Mon 14:08]
Reactions via ~C-; S !~ (~slack-message-add-reaction~) have two problems:
1. *Emoji picker only shows GitHub-style names* — without the ~emojify~ package,
~slack-select-emoji~ falls back to a flat ~completing-read~ over 1600+ names
fetched from GitHub's iamcal/emoji-data. Common names like ~thumbsup~ and ~pray~
are buried. A curated shortlist of common reactions would fix the UX.
2. *CRITICAL: post-command-hook bug traps user in Slack buffer* —
~slack-reaction-echo-description~ is added to ~post-command-hook~ (buffer-local)
in all Slack buffers. When the cursor lands on a reaction widget, it reads the
~reaction~ text property and calls ~slack-reaction-help-text~. If the reaction
EIEIO object is malformed, the error fires on *every keystroke*, making it
impossible to switch buffers, run M-x, or even C-g. The only escape is killing
Emacs externally (~pkill emacs~).
The fix must address this hook FIRST before any other reaction work.
Approach: advise ~slack-reaction-echo-description~ with ~condition-case~ to
silently catch errors, or remove it from ~post-command-hook~ entirely.
Relevant code in emacs-slack:
- ~slack-buffer.el:399~ — adds hook
- ~slack-buffer.el:374~ — ~slack-reaction-echo-description~ definition
- ~slack-reaction.el:72~ — ~slack-reaction-help-text~ method
Implemented 2026-05-11:
- Added a safe advice around ~slack-reaction-echo-description~. If malformed
reaction data errors from the buffer-local ~post-command-hook~, the hook is
removed for that buffer and a single message is shown instead of trapping
every keystroke.
- Rebound ~C-; S !~ to ~cj/slack-message-add-reaction~, which presents a short
common reaction list first and keeps an ~Other...~ fallback to upstream
~slack-message-reaction-input~.
- Added regression coverage in =tests/test-slack-config-reactions.el=.
**Discovered:** 2026-03-06
** DONE [#B] Coverage audit: untested and lightly-tested modules :tests:
CLOSED: [2026-05-11 Mon 14:38]
Snapshot of test-coverage gaps as of 2026-04-26. The existing [#A] "Continue coverage push" task already targets =keybindings.el=, =config-utilities.el=, =org-noter-config.el=, and =host-environment.el=; this entry catalogs the rest so future sessions have a working list.
*Methodology.* 102 modules in =modules/=, cross-referenced against =tests/= using fuzzy name matching (full module name, drop =-config=/=-setup= suffix, first hyphen segment). Categorized by likely test value.
**High-value untested (substantial logic, real test value):**
- =ai-conversations= — gptel persistence + autosave; 13 functions
- =quick-video-capture= — yt-dlp queue, org-protocol; 5 functions
- =dashboard-config= — custom commands (=cj/dashboard-only=, etc.)
- =external-open= — partially refactored; helpers covered, commands still bare
- =keyboard-compat= — terminal vs GUI Meta+Shift translation
- =help-config= and =help-utils= — interactive help and lookup commands
- =mail-config= — helpers (some covered via transcription tests; rest bare)
- =show-kill-ring= — kill-ring UI logic
- =system-commands= — shell command wrappers
- =ui-navigation= and =ui-theme= — navigation + theme switching
- =wrap-up= — init-finalize helpers
**Lightly covered (1–2 tests, likely many uncovered functions):**
- =modeline-config= (2 tests)
- =org-agenda-config= (2)
- =org-capture-config= (2)
- =org-reveal-config= (2)
- =transcription-config= (1) — helpers tested, start/stop loop bare
- =jumper= (1)
- =keyboard-macros= (1)
**Likely low-value (mostly use-package wrappers):**
About 28 modules are dominated by use-package + hooks + keybinds — testing them would mostly test Emacs/use-package itself. Examples: =auth-config=, =diff-config=, =dirvish-config=, =elfeed-config=, =erc-config=, =eww-config=, the =prog-*= language modules, etc. For each, review whether the file has any helper functions beyond use-package. If yes, write characterization tests. If not, document as "no unit tests appropriate" so the next audit skips it.
*Approach.* Pick 2–3 modules per session from the high-value list. Refactor-first if needed (split interactive wrapper from pure helper per =.claude/rules/elisp-testing.md=), then write Normal/Boundary/Error coverage. Re-run =cj/coverage-report= (F7, project scope) after each batch so progress is measurable.
**Cross-references:**
- [[file:.ai/sessions/2026-04-22-09-49-coverage-v1-shipped-system-utils-tested.org][2026-04-22 session]] — coverage v1 shipped, 59.6% baseline
- [[file:.claude/rules/elisp-testing.md][.claude/rules/elisp-testing.md]] — per-function test files, refactor-first, three required categories
**2026-05-11 refresh.** Re-ran =make coverage= after excluding timing-sensitive
=tests/test-lorem-optimum-benchmark.el= from coverage instrumentation. The
benchmark file still runs in normal test-file/unit flows, but Undercover slows
timing assertions enough to make it unsuitable for coverage. Low-coverage means
instrumented modules below 50% executable-line coverage, plus modules missing
from SimpleCov entirely. For missing modules, first decide whether the file has
testable project logic; if it is just use-package/keybinding glue, document it
as intentionally low-value instead of forcing brittle tests.
*** TODO [#B] Add coverage for =prog-python.el= (0.0%, 0/20) :tests:
Focus on formatter/setup helpers and any Python command-building logic. Avoid
testing Emacs package glue directly; split pure helpers first if needed.
*** TODO [#B] Add coverage for =selection-framework.el= (0.0%, 0/3) :tests:
Add a smoke test for the final binding/setup behavior or document why the three
instrumented lines are configuration-only.
*** TODO [#B] Add coverage for =keyboard-compat.el= (3.4%, 1/29) :tests:
Cover terminal-vs-GUI translation predicates and key normalization paths. Keep
tests table-driven so future terminal quirks are easy to add.
*** TODO [#B] Add coverage for =prog-webdev.el= (4.8%, 1/21) :tests:
Cover formatter wiring and web-mode helper behavior without invoking external
formatters.
*** TODO [#B] Add coverage for =system-defaults.el= (8.3%, 1/12) :tests:
Characterize the platform/default-setting helpers with stubs around system
calls. Do not assert machine-specific defaults directly.
*** TODO [#B] Add coverage for =ui-navigation.el= (8.7%, 4/46) :tests:
Extend the existing window-resize tests to cover navigation commands,
window-selection behavior, and boundary cases around missing/side windows.
*** TODO [#B] Add coverage for =prog-go.el= (11.1%, 3/27) :tests:
Cover Go formatting/test command wiring and any path/build helper behavior with
external commands stubbed.
*** TODO [#B] Add coverage for =system-commands.el= (12.2%, 6/49) :tests:
Cover shell command wrapper construction, missing executable behavior, and
interactive command smoke paths with process execution stubbed.
*** TODO [#B] Add coverage for =external-open.el= (15.2%, 5/33) :tests:
The library helpers already have some coverage; add smoke/characterization tests
for user-facing open commands and error paths while stubbing launcher calls.
*** TODO [#B] Add coverage for =org-webclipper.el= (16.9%, 10/59) :tests:
Cover URL/content parsing, manual URL prompt behavior, protocol URL handling,
and aborted capture cleanup.
*** TODO [#B] Add coverage for =system-utils.el= (19.2%, 5/26) :tests:
Review remaining utilities not covered by =eval-buffer= tests. Add focused
Normal/Boundary/Error tests for pure helpers; stub process/system calls.
*** TODO [#B] Add coverage for =org-reveal-config.el= (20.0%, 9/45) :tests:
Extend existing header-template/title tests to cover export command setup and
option-building helpers.
*** TODO [#B] Add coverage for =coverage-elisp.el= (26.3%, 5/19) :tests:
The detector is covered; add tests for report-path/project-root behavior and a
stubbed run callback path if it can be tested without launching compilation.
*** TODO [#B] Add coverage for =org-noter-config.el= (27.3%, 27/99) :tests:
Build on the existing predicate/template tests. Target note-file placement,
preferred split behavior, and interactive wrapper smoke tests.
*** TODO [#B] Add coverage for =ai-config.el= (27.7%, 53/191) :tests:
Prioritize model/backend selection edge cases, gptel local-tool registration,
and command helpers. Stub network/model calls.
*** TODO [#B] Add coverage for =dirvish-config.el= (30.4%, 48/158) :tests:
Existing utility tests cover several helpers. Add focused coverage for remaining
playlist/quick-access/display-path branches and document config-only areas.
*** TODO [#B] Add coverage for =slack-config.el= (32.0%, 24/75) :tests:
Extend reaction workflow coverage to message lookup, workspace/account
configuration, and command error handling with Slack APIs stubbed.
*** TODO [#B] Add coverage for =org-roam-config.el= (32.5%, 26/80) :tests:
Extend existing slug/demote/link tests to cover TODO copy behavior, capture
helpers, and file/path boundary cases.
*** TODO [#B] Add coverage for =custom-text-enclose.el= (35.2%, 51/145) :tests:
Many wrappers are tested, but coverage is still low. Identify untested commands
and add table-driven region/buffer boundary cases.
*** TODO [#B] Add coverage for =hugo-config.el= (39.6%, 38/96) :tests:
Extend metadata/template tests to draft collection, path derivation, and command
wrapper behavior with file/process calls stubbed.
*** TODO [#B] Add coverage for =org-refile-config.el= (41.2%, 21/51) :tests:
Build on target-building tests. Cover org-mode enforcement, missing files, and
refile target edge cases.
*** TODO [#B] Add coverage for =org-contacts-config.el= (45.6%, 36/79) :tests:
Extend email parsing/finalize tests to contact lookup, capture field handling,
and malformed contact data.
*** TODO [#B] Add coverage for =transcription-config.el= (46.3%, 75/162) :tests:
Existing helper tests are strong; add start/stop/process lifecycle tests with
process creation and sentinels stubbed.
*** TODO [#B] Add coverage for =music-config.el= (46.8%, 130/278) :tests:
Coverage is broad but below 50%. Target remaining playlist mutation,
navigation, and MPD side-effect paths with process calls stubbed.
*** TODO [#B] Add coverage for =mail-config.el= (47.4%, 9/19) :tests:
Transport helpers are covered. Add smoke tests for account context data,
maildir shortcuts, bookmarks, and safe command setup without sending mail.
*** TODO [#B] Add or triage first coverage for =ai-conversations.el= (missing from SimpleCov) :tests:
High-value missing module. Cover gptel persistence, autosave path selection, and
load/save error behavior with filesystem calls isolated.
*** TODO [#B] Add or triage first coverage for =auth-config.el= (missing from SimpleCov) :tests:
Review for testable cache/debug helpers versus package glue. Add tests for
helpers; document any config-only surface as intentionally untested.
*** TODO [#B] Add or triage first coverage for =calibredb-epub-config.el= (missing from SimpleCov) :tests:
Review EPUB preference helpers and calibredb/nov hooks. Add tests around pure
helpers; avoid brittle package-load assertions.
*** TODO [#B] Add or triage first coverage for =chrono-tools.el= (missing from SimpleCov) :tests:
Identify date/time helpers and command formatting logic. Add deterministic tests
with current time stubbed.
*** TODO [#B] Add or triage first coverage for =dashboard-config.el= (missing from SimpleCov) :tests:
Cover custom dashboard commands such as single-window/dashboard-only behavior
with buffer/window operations isolated.
*** TODO [#B] Triage =diff-config.el= as missing from SimpleCov :tests:
Mostly likely package/keybinding glue. Add tests only for local helper logic; if
none exists, document as no unit tests appropriate.
*** TODO [#B] Add or triage first coverage for =dwim-shell-config.el= (missing from SimpleCov) :tests:
Review DWIM shell command selection and buffer/process helpers. Stub shell
launches and cover fallback/error cases.
*** TODO [#B] Triage =elfeed-config.el= as missing from SimpleCov :tests:
Check for project-owned feed/search helpers. If it is only elfeed setup,
document as low-value for unit coverage.
*** TODO [#B] Triage =erc-config.el= as missing from SimpleCov :tests:
Check for local IRC command helpers. If the file is package setup only, document
as intentionally untested.
*** TODO [#B] Add or triage first coverage for =eshell-config.el= (missing from SimpleCov) :tests:
Cover local eshell helper functions and command aliases where possible. Avoid
tests that depend on a live shell session.
*** TODO [#B] Triage =eww-config.el= as missing from SimpleCov :tests:
Review for local URL/browser helpers. If configuration-only, document as
low-value for unit coverage.
*** TODO [#B] Triage =flycheck-config.el= as missing from SimpleCov :tests:
Prefer testing only project-owned predicate/setup helpers. Do not test flycheck
package internals.
*** TODO [#B] Triage =flyspell-and-abbrev.el= as missing from SimpleCov :tests:
Look for local dictionary/abbrev helpers. If the file only wires modes/hooks,
document that no unit tests are appropriate.
*** TODO [#B] Triage =font-config.el= as missing from SimpleCov :tests:
Check for font-selection helpers; otherwise classify as environment-specific UI
configuration.
*** TODO [#B] Triage =games-config.el= as missing from SimpleCov :tests:
Check for project-owned game command wrappers. If it is only package setup,
document as low-value.
*** TODO [#B] Add or triage first coverage for =gloss-config.el= (missing from SimpleCov) :tests:
Review glossary lookup/parsing helpers. Add pure tests where possible and smoke
test interactive commands with completion stubbed.
*** TODO [#B] Add or triage first coverage for =help-config.el= (missing from SimpleCov) :tests:
High-value missing module from the original audit. Cover interactive help lookup
commands and buffer-selection behavior with display functions stubbed.
*** TODO [#B] Add or triage first coverage for =help-utils.el= (missing from SimpleCov) :tests:
High-value missing module. Cover lookup/formatting helpers and error behavior
for unknown symbols/topics.
*** TODO [#B] Triage =httpd-config.el= as missing from SimpleCov :tests:
Check for local server helpers. If it only configures simple-httpd, document as
configuration-only.
*** TODO [#B] Triage =latex-config.el= as missing from SimpleCov :tests:
Review for local compile/view helper logic. Avoid asserting package setup unless
there are project-owned predicates.
*** TODO [#B] Triage =ledger-config.el= as missing from SimpleCov :tests:
Check for project-owned ledger helpers; otherwise document as mode setup.
*** TODO [#B] Add or triage first coverage for =local-repository.el= (missing from SimpleCov) :tests:
Review repository path/discovery helpers and add filesystem-backed tempdir tests
for meaningful local logic.
*** TODO [#B] Triage =markdown-config.el= as missing from SimpleCov :tests:
Check for local markdown command helpers. If it is only mode configuration,
document as no unit tests appropriate.
*** TODO [#B] Add or triage first coverage for =media-utils.el= (missing from SimpleCov) :tests:
Original audit called this out with process boundaries. Cover launcher/command
selection helpers with external commands stubbed.
*** TODO [#B] Add or triage first coverage for =mu4e-org-contacts-integration.el= (missing from SimpleCov) :tests:
Cover contact lookup/insert integration with mu4e and org-contacts calls
stubbed.
*** TODO [#B] Add or triage first coverage for =mu4e-org-contacts-setup.el= (missing from SimpleCov) :tests:
Cover setup helpers and contact field defaults where project-owned logic exists.
*** TODO [#B] Triage =org-agenda-config-debug.el= as missing from SimpleCov :tests:
Check for debug helper functions worth testing. If it is ad-hoc diagnostics,
document as low-value.
*** TODO [#B] Triage =org-babel-config.el= as missing from SimpleCov :tests:
Review for project-owned org-babel helper logic. Avoid tests that only assert
language registration.
*** TODO [#B] Triage =org-drill-config.el= as missing from SimpleCov :tests:
Check for local drill helpers beyond package setup. Add characterization tests
only for those helpers.
*** TODO [#B] Triage =org-export-config.el= as missing from SimpleCov :tests:
Review export option/path helpers. If configuration-only, document as no unit
tests appropriate.
*** TODO [#B] Triage =pdf-config.el= as missing from SimpleCov :tests:
Check for local PDF helper commands. Avoid tests tied to external PDF tools
unless command construction can be isolated.
*** TODO [#B] Triage =popper-config.el= as missing from SimpleCov :tests:
Review popup classification helpers. Add tests for predicates; document pure
package setup as intentionally untested.
*** TODO [#B] Triage =prog-general.el= as missing from SimpleCov :tests:
Check for local development command helpers beyond global key setup. Add tests
only for project-owned logic.
*** TODO [#B] Triage =prog-lisp.el= as missing from SimpleCov :tests:
Review Lisp-mode helper behavior. If it is only hooks/mode setup, document as
low-value.
*** TODO [#B] Triage =prog-training.el= as missing from SimpleCov :tests:
Check for exercise/training command helpers and add characterization tests if
present.
*** TODO [#B] Add or triage first coverage for =quick-video-capture.el= (missing from SimpleCov) :tests:
High-value missing module. Cover yt-dlp queue behavior, org-protocol handling,
URL parsing, and process error paths with external commands stubbed.
*** TODO [#B] Add or triage first coverage for =show-kill-ring.el= (missing from SimpleCov) :tests:
High-value missing module. Cover kill-ring formatting, selection behavior, and
empty-ring boundaries.
*** TODO [#B] Triage =text-config.el= as missing from SimpleCov :tests:
Review for local text helper commands. If it only configures packages/hooks,
document as no unit tests appropriate.
*** TODO [#B] Triage =tramp-config.el= as missing from SimpleCov :tests:
Check for local TRAMP path helpers. Avoid tests requiring remote connections.
*** TODO [#B] Add or triage first coverage for =vc-config.el= (missing from SimpleCov) :tests:
Review project-owned VC helpers and command wrappers. Stub git/process calls.
*** TODO [#B] Triage =weather-config.el= as missing from SimpleCov :tests:
Check for request/format helpers. Avoid live network tests; stub weather calls.
*** TODO [#B] Add or triage first coverage for =wrap-up.el= (missing from SimpleCov) :tests:
Cover init-finalize helpers and post-startup behavior with hooks/timers stubbed.
** DONE [#B] Review all config and pull library functions into system-lib file :refactor:
Superseded by =PROJECT [#B] Consolidate shared utility helpers= (the structured version of this, with =docs/design/utility-consolidation.org= as the spec and =docs/design/utility-inventory.org= as the config-wide audit -- 30 candidate helpers across all modules, decided 11 Migrate / 3 Leave / 13 Defer). The system-lib extractions shipped 2026-05-10: =c75e36f= (=cj/executable-find-or-warn= from mail-config), =f1e8f08= (=cj/shell-quote-argument-readable= from dev-fkeys), =57e558c= (=cj/process-output-or-error= + =cj/git-output-or-error= from coverage-core), =aa72245= (=cj/file-from-context= from system-utils), plus the earlier =8e8152e= (=cj/log-silently=) -- each with its own test file. The rest of the 11 Migrate items landed as new =-lib.el= modules in the same marathon (=cj-cache-lib.el=, =cj-org-text-lib.el=, =external-open-lib.el=, =cj-window-geometry-lib.el=, =cj-window-toggle-lib.el=). The 13 deferred candidates remain tracked under the Consolidate-shared-utility-helpers PROJECT, not here.
** DONE [#C] Clean up calibredb-epub-config.el :refactor:bug:
CLOSED: [2026-05-11 Mon 14:55]
1. *Remove ~:defer 1~ from calibredb use-package* — loads calibredb 1 second after
startup even though ~:commands~ and ~:bind~ already handle lazy loading. Free
startup time.
2. *Double rendering on EPUB open* — ~cj/nov-apply-preferences~ calls
~(nov-render-document)~ explicitly, but it runs as a ~nov-mode~ hook which fires
after nov already renders. Every EPUB open renders twice.
3. *visual-fill-column-width doesn't adapt on resize* — calculated once at open
time based on window size. Resizing or splitting the window won't recalculate
text width. Consider hooking ~window-size-change-functions~ or
~window-configuration-change-hook~.
4. *~calibredb-search-page-max-rows 20000~* — effectively disables pagination.
Could slow down the search buffer if library grows large. Monitor or lower.
5. *Anonymous lambda for zathura keybinding* — ~("z" . (lambda ...))~ won't show
a name in which-key or describe-key. Replace with a named function.
*File:* modules/calibredb-epub-config.el
Implemented 2026-05-11: removed the timed calibredb load, removed the explicit
=nov-render-document= call from the =nov-mode= hook to avoid double rendering,
made Nov text width recalculate after window configuration changes, lowered
=calibredb-search-page-max-rows= from 20000 to 500, and replaced the anonymous
zathura binding with =cj/nov-open-external=. Added focused helper coverage in
=tests/test-calibredb-epub-config.el= for the adaptive width calculation and
named external-open command.
** DONE [#C] Update email setup script for the work account :chore:
CLOSED: [2026-05-11 Mon 14:21]
Follow-up to the deepsat mu4e work shipped 2026-04-27. The mu4e config (=modules/mail-config.el=), =.mbsyncrc=, =.msmtprc=, and the encrypted password file (=.config/.dmailpass.gpg=) all gained a third account. There is an "email setup script" (per Craig's mention while wrapping up that work) that needs the equivalent updates so a fresh machine bootstraps with all three accounts. Craig will name the specific script when picking this up.
Likely shape:
- Wherever the script writes / templates =.mbsyncrc=, add the dmail block (5-channel layout, mirroring the gmail block).
- Wherever it writes =.msmtprc=, add the dmail SMTP account (passwordeval against =~/.config/.dmailpass.gpg=).
- Ensure the encrypted password file exists or is sourced correctly during setup.
Implemented 2026-05-11: updated =scripts/setup-email.sh= so the setup flow
handles the deepsat/dmail account alongside gmail and cmail. The script now
creates =~/.mail/dmail=, passes =craig.jennings@deepsat.com= to =mu init=,
and installs/validates =~/.config/.dmailpass.gpg= using the same encrypted-file
pattern as gmail. While there, the credential bootstrap was made explicit:
gmail and dmail keep encrypted =.gpg= files because mbsync/msmtp decrypt them at
use time, while cmail is decrypted to the plaintext ProtonBridge password file.
** DONE [#C] Stand up packaging CI for personal Elisp packages :ci:feature:
CLOSED: [2026-05-11 Mon 14:08]
Get =chime=, =org-msg=, and =wttrin= covered by automated package-quality checks. Three pieces, all aimed at the same set of repos, so tracked together:
1. *melpazoid* — MELPA-submission validator. Run against each package; gives a pre-submission checklist so packages don't bounce on basics.
2. *package-lint* — elisp-specific package linter. Catches header issues, autoload problems, version-spec drift. Can be run locally as part of =make lint= and in CI.
3. *elisp-check GitHub Action* — zero-config CI workflow that wraps the above plus byte-compile and basic tests. One =.github/workflows/elisp.yml= per package.
Order of execution: package-lint first (most actionable, fastest feedback), then elisp-check (CI wiring), then melpazoid (heavier; only matters if/when submitting to MELPA).
** DONE [#D] Optimize lorem-optimum performance and liber-primus.txt size :perf:
CLOSED: [2026-05-11 Mon 14:17]
Lorem-optimum text generation is generally slow but doesn't completely break workflow.
Two benchmark tests were disabled (marked :slow) because they take MINUTES instead of seconds.
**Current State:**
- Tests disabled to unblock test suite (DONE 2025-11-09)
- Performance is acceptable for daily use, but could be better
- liber-primus.txt may be too large for optimal performance
**Investigation:**
1. Profile lorem-optimum to find bottlenecks
2. Check if liber-primus.txt size needs optimization
3. Optimize performance to get tests under 5 seconds
4. Re-enable benchmark tests once performance is acceptable
**Related Files:**
- modules/lorem-optimum.el (needs profiling and optimization)
- tests/test-lorem-optimum-benchmark.el (tests disabled with :tags '(:slow))
- liber-primus.txt (corpus file, may need size optimization)
Implemented 2026-05-11: optimized generation hotspots in =modules/lorem-optimum.el=
by avoiding repeated string/list appends, caching random Markov keys as a vector,
and hardening title generation while preserving empty-chain behavior. Re-enabled
the benchmark tests in =tests/test-lorem-optimum-benchmark.el= by removing their
=:slow= tags and added a title-generation regression test in
=tests/test-lorem-optimum.el=. Checked =assets/liber-primus.txt= directly; it is
36,475 bytes / 5,374 words, so no corpus shrink was needed. The benchmark file
now runs all 10 tests in under one second, with 100K-word learning measured under
200 ms on this machine.
** DONE [#D] Migrate lsp-eldoc-hook to eldoc-documentation-functions :chore:quick:
CLOSED: [2026-05-11 Mon 14:12]
=modules/prog-lsp.el:68= sets =lsp-eldoc-hook= to nil. Byte-compile flags it as obsolete since lsp-mode 9.0.0; replacement is =eldoc-documentation-functions=. Find the lsp-mode-supplied entry there and remove it (or set the variable buffer-locally per the new API). Discovered 2026-04-26 during refactor audit on the file-watch-ignored-extras change.
Implemented 2026-05-11: replaced the obsolete =lsp-eldoc-hook= assignment with
=cj/lsp--disable-eldoc-hover=, installed from =lsp-managed-mode-hook=. The helper
removes =lsp-eldoc-function= from buffer-local
=eldoc-documentation-functions= after lsp-mode adds it. Covered in
=tests/test-prog-lsp--add-file-watch-ignored-extras.el=.
** DONE [#B] Simplify mail attachment save workflow :feature:
Saving attachments out of mu4e is currently a multi-step dance via =mu4e-view-save-attachments= + embark + vertico. The flow documented in =modules/mail-config.el:10-17= goes:
#+begin_quote
After running =mu4e-view-save-attachments=:
- invoke =embark-act-all= in the completion menu, then RET to save all
- OR TAB (=vertico-insert=), comma each file to mark, RET to save selected
#+end_quote
That's four keystrokes for "save all to default dir" and N+2 for "save the one I want." Both common cases should be one keystroke.
Proposed shape:
- =cj/mu4e-save-all-attachments= → save every attachment in current message to a sensible default dir (=~/Downloads/= or per-thread). One keystroke.
- =cj/mu4e-save-attachment-here= → completing-read on attachment names; save selected one. One keystroke + selection.
- Bind both under =C-; e= (the existing email map already has =a= and =d= for attach/delete in compose).
Open question: should the "save all" target be a fixed dir, prompt every time, or use the directory of an associated org-noter / project context? Flagged for design decision when this lands.
Decision: save all should prompt every time.
*Files:* =modules/mail-config.el= (add helpers, wire into mu4e-view-actions and the =C-; e= keymap).
Implemented 2026-05-11: added direct mu4e view attachment save commands in
=modules/mail-config.el=. =cj/mu4e-save-all-attachments= prompts once for a
directory and saves every attachment-like MIME part. =cj/mu4e-save-attachment-here=
prompts for a directory, then uses =completing-read= to save one attachment.
Both reuse mu4e's MIME part metadata, uniquify hook, path joiner, and
=mm-save-part-to-file= save primitive instead of driving the existing
multi-select completion UI. Duplicate filenames are disambiguated by part index.
Bound under =C-; e S= and =C-; e s= with which-key labels. Covered by
=tests/test-mail-config-attachments.el=.
Extended 2026-05-11: added =cj/mu4e-save-some-attachments= on =C-; e m=. It
prompts for the destination directory, opens a dedicated =*mu4e attachments*=
selection buffer, and lets the user mark rows with RET, mark all with =a=,
unmark all with =u=, save marked with =s=, and quit with =q=. The selection
buffer shows labels, MIME types, and approximate sizes while reusing the same
attachment save helpers.
Committed and pushed 2026-05-11 as =1aa8d0f= "feat(mu4e): simpler attachment-save commands on C-; e S/s/m"; 18 ERT tests in =tests/test-mail-config-attachments.el=. (Two small UX follow-ups — `entry-at-point' user-error outside a row, and clearing marks / auto-quit after save — are tracked under "Post-batch review follow-ups (2026-05-11)".)
** DONE [#B] EPUB text renders full-width: visual-fill-column margins not applied in nov-mode :bug:
*** Resolved 2026-05-12
Fixed in =b7c6b2c= "fix(nov): center the EPUB text by setting window margins directly" -- took the "preferred" plan below: `nov-text-width' is now a column count (~80% of the window's natural width) so nov's `shr' fills the text itself, and `cj/nov-update-layout' centers the block with `set-window-margins' directly (plus `set-window-fringes ... t' to push the fringes off the reading area). `visual-fill-column' is dropped from nov entirely -- its margin-setting still mysteriously never applied, but that's moot now. `+'/`=' / `-'/`_' re-flow and re-center; a buffer-local `kill-buffer-hook' resets the margins/fringes. The text-width math factored into `cj/nov--natural-window-width' + `cj/nov--text-width'. Remaining nit: see "EPUB text is slightly left-of-center" below.
*** Problem
Opening an EPUB renders the text filling 100% of the window width, not the configured ~80%. =modules/calibredb-epub-config.el=, =cj/nov-apply-preferences= (on =nov-mode-hook=).
Before the 2026-05-12 work it was the opposite — a too-narrow ~third-of-the-window strip — caused by a feedback loop (=cj/nov--text-width-for-window= computed from =window-body-width=, which is post-margin, so each =cj/nov-update-layout= pass shaved the column by another margin fraction, bottoming out at =cj/nov-min-text-width= = 40). Commit =1c5c8bd= "fix(nov): rework the EPUB reading-width layout" fixed the loop (width now computed from the window's *natural* column count, idempotent) and split out a pure =cj/nov--text-width= helper with a regression test; =4d9a206= set the default =cj/nov-margin-percent= to 10 (= 80% text); both also re-added =b3b537f='s =(nov-render-document)= for the cold open, made =cj/nov-update-layout= a command, and bound =+= / === / =-= / =_= in =nov-mode-map= to adjust the width live (clamp 0..25, i.e. text 50%..100%). The *width computation* and the *loop* are fixed. The *margin application* is not — hence 100%.
*** Why 100% specifically
=cj/nov-apply-preferences= sets =(setq-local nov-text-width t)=. With =nov-text-width= = t, =nov-render-html= renders the text *unfilled* — it swaps =shr-fill-line= for =nov-fill-line=, which only indents, never wraps — so the buffer holds one long logical line per paragraph, and =visual-line-mode= is relied on to wrap it visually at the window's *text-area* width. =cj/nov-update-layout= is supposed to narrow that text area by turning on =visual-fill-column-mode= with =visual-fill-column-width= set to ~80% of the window's columns and letting =visual-fill-column--adjust-window= set the left/right *window display margins*. The margins never get set, so the text area stays the full window width → text wraps at 100%.
*** Diagnostics captured (Craig's running Emacs, in the EPUB buffer, 2026-05-12)
=M-: (list :margin cj/nov-margin-percent :body-w (window-body-width) :vfc-w visual-fill-column-width :vfc-mode (bound-and-true-p visual-fill-column-mode) :vfc-feat (featurep 'visual-fill-column) :wmargins (window-margins) :ntw nov-text-width)= →
=(:margin 10 :body-w 152 :vfc-w 121 :vfc-mode t :vfc-feat t :wmargins (nil . nil) :ntw t)=
So: the new code IS loaded (=cj/nov-margin-percent= 10), =visual-fill-column= IS loaded, =visual-fill-column-mode= IS on, =visual-fill-column-width= IS correct (121 = 80% of 152) — but =(window-margins)= is =(nil . nil)=. =M-x cj/nov-update-layout= (which calls =visual-fill-column--adjust-window=) does NOT change it; =M-: (condition-case e (progn (cj/nov-update-layout) (window-margins)) (error e))= → =(nil . nil)= (no error caught, margins still nil). So =visual-fill-column='s margin-setting path (=visual-fill-column--adjust-window= → =visual-fill-column--set-margins= → =set-window-margins=) is not landing in nov-mode buffers.
*** Why it doesn't apply — UNKNOWN
Code-reading =visual-fill-column-2.7.0= didn't pin it down. =visual-fill-column--adjust-window= does =(with-selected-window window (visual-fill-column--reset-window window) (when visual-fill-column-mode (... (visual-fill-column--set-margins window))))=. For the result to be =(nil . nil)=, either =--set-margins= isn't reached (the =(when visual-fill-column-mode ...)= check is false in whatever buffer =with-selected-window= makes current) or it computed left=right=0 (=set-window-margins window 0 0= → =(window-margins)= = =(nil . nil)=). =--set-margins= computes 0/0 only when =total-width= (≈ window-width) ≤ =visual-fill-column-width= (121) — and window-width is 152, so it shouldn't. Candidate causes not yet ruled out: (a) the =default= face is remapped to "Merriweather" :height 180 in nov buffers (via =face-remap-add-relative= in =cj/nov-apply-preferences=), and =set-window-margins='s units (canonical frame-font columns) vs. the remapped 18pt buffer columns may be confusing the column math; (b) =--adjust-window= being invoked on the wrong window (it defaults to =(selected-window)=, not the EPUB's window — relevant when nov-mode-hook runs before =find-file= switches the window, and possibly later); (c) a =visual-fill-column= 2.7.0 / Emacs 30 regression with =nov-fill-line=-style rendering; (d) something resetting the margins after they're set.
*** Plan forward — preferred: stop delegating the width to visual-fill-column
Set =nov-text-width= to a *computed integer* instead of =t=, so nov's =shr= fills the rendered text to that width itself — no dependence on =visual-fill-column='s window margins working at all. =visual-fill-column= then only *centers* the already-narrow block (if it works; if it still doesn't, the text is left-aligned at ~80%, which is acceptable). Specifically:
- =cj/nov-apply-preferences=: =(setq-local nov-text-width (cj/nov--text-width-for-window))= (integer) instead of =t=.
- =cj/nov-update-layout=: recompute and =setq-local= both =nov-text-width= and =visual-fill-column-width=, then call =(nov-render-document)= so =shr= re-flows the text at the new width (currently it only re-sets the vfc width). Still keep the =visual-fill-column-mode= + =--adjust-window= calls for centering.
- =+= / =-= keep working: they adjust =cj/nov-margin-percent= then call =cj/nov-update-layout=, which now re-renders.
- =cj/nov-min-text-width= (40) stays the absolute column floor.
TDD test-first. Touches =modules/calibredb-epub-config.el= + =tests/test-calibredb-epub-config.el=. ~25 lines.
*** Alternatives considered
(1) Keep =nov-text-width= = t + =visual-fill-column= and keep poking at *why* the margins don't apply — needs more in-Emacs diagnostics (e.g. trace =visual-fill-column--set-margins=, check =(window-margins)= right after =(set-window-margins win 15 16)=, check whether a stray window param clamps it). Higher uncertainty.
(2) Left-align at the computed width with no centering at all (drop =visual-fill-column= from nov entirely) — simpler, but loses the centered look Craig wanted.
Preferred is the =nov-text-width=-as-integer approach because it's robust regardless of what =visual-fill-column= does.
** DONE [#B] Post-batch review follow-ups (2026-05-11) :refactor:tests:
Minor items found while reviewing the 2026-05-11 commit batch (a70bb98..2b88c6a). The major fix (org-capture cache-key consistency) and the coverage gaps were already handled in commits =fc94e5b= / =e0e0ecd= / =2b88c6a=; these are the leftovers.
*** DONE [#B] Give the benchmarks a real home (`make benchmark' or `:tags '(:perf)') :tests:perf:
The 2026-05-11 lorem-optimum perf work (=7f353e9=) dropped the `:slow' tags from the benchmark tests so they run in every `make test', and one (`benchmark-learn-100k-words') gained an absolute wall-clock threshold (`(should (< time 5000.0))'). Then =1f4c692= excluded `test-lorem-optimum-benchmark.el' from `make coverage' because undercover's instrumentation breaks those thresholds. That's a fragmented policy and the thresholds are machine-dependent (a slower CI runner or older laptop could blow 5s). Pick one: (a) restore `:tags '(:perf)' on the benchmark tests and add a `make benchmark' target that runs them, or (b) replace the absolute thresholds with relative checks ("100K is no more than ~20x slower than 10K") that catch O(N^2) regressions without depending on the machine. Either way `make test' should stop running absolute-time benchmarks by default.
*** DONE [#B] Verify Nov EPUB renders at the right width on first open :bug:
There WAS a regression, deeper than =b3b537f=: `cj/nov--text-width-for-window' computed the column from `window-body-width' (post-margin), so `cj/nov-update-layout' (on `window-configuration-change-hook') shrank the column on every pass — a feedback loop bottoming out at `cj/nov-min-text-width' (40 cols) regardless of `cj/nov-margin-percent'. Fixed 2026-05-12 in =1c5c8bd= "fix(nov): rework the EPUB reading-width layout": width now from the window's natural column count (idempotent), pure `cj/nov--text-width' helper + regression test, `cj/nov-margin-percent' default 12 (~76% text), `b3b537f's `(nov-render-document)' re-added for the cold open, `cj/nov-update-layout' made a command, and `+'/`='/`-'/`_' added in `nov-mode-map' to adjust the width live (50%..100%). Visual confirm in real Emacs still pending Craig's restart.
*** DONE [#B] Surface `cj/slack-message-add-reaction' errors outside a Slack buffer :ux:
`cj/slack-message-add-reaction' (C-; S !, added in =bbd1b73=) silently no-ops when `slack-current-buffer' is nil — e.g. if the binding fires outside a Slack buffer. The `when-let*' chain just bails with no feedback. Add a `user-error "Not in a Slack buffer"' (and the same for `slack-buffer-team' returning nil) so the misuse surfaces instead of being swallowed.
*** DONE [#B] Rename `cj/lsp--disable-eldoc-hover' to `cj/lsp--remove-eldoc-provider' :refactor:
The function (added in =96d5d6a=) removes one specific provider — `lsp-eldoc-function' — from the buffer-local `eldoc-documentation-functions'. If lsp-mode ever adds another eldoc provider, the current function wouldn't catch it; the name promises more than it does. Rename to match what it actually does and update the `add-hook' callsite + the regression test.
*** DONE [#B] Add `bats' test infra and cover `scripts/setup-email.sh' helpers :tests:
The 2026-05-11 email-setup work (=eddc103=) added `install_encrypted_password' and `decrypt_password' — cleanly factored (filenames in, file-or-`exit 1' out) but untested, since the repo has no shell-test infrastructure. With a temp `$PASSWORD_DEST_DIR' and mocked `gpg'/`cp', they'd test cleanly. Add `bats' (or pick an alternative), wire a `make test-shell' target, and cover the two helpers plus the dest-exists-skip and missing-source-fails paths.
*** DONE [#B] Split the mu4e attachment workflow out of `mail-config.el' :refactor:
The 2026-05-11 mu4e attachment commit (=1aa8d0f=) added ~247 lines to `mail-config.el' for a self-contained attachment-save UI (helpers + three commands + a `special-mode'-derived selection buffer). None of it depends on the rest of `mail-config'. As that file grows, moving this into `modules/mu4e-attachments.el' (or `mail-attachments-lib.el', matching the `-lib.el' convention) would keep both files easier to read. The seam is clean.
*** DONE [#B] Clear marks (or auto-quit) after `cj/mu4e-attachment-selection-save-marked' :ux:
After saving the marked attachments, the `*mu4e attachments*' buffer (=1aa8d0f=) stays open with the same marks intact — pressing `s' again re-saves the same set silently. Decide what the workflow wants: auto-`quit-window' after a successful save, or clear the marks and stay so the user can save another batch. Right now it does neither.
** DONE [#D] Create print function for dirvish bound to uppercase P :feature:
Add a print function that works on printable files (PDF, txt, org, etc.) and bind it to uppercase P in dirvish-mode. Should detect file type and use appropriate print command (lpr for text files, print dialog for PDFs, etc.).
** DONE [#D] Collapse the duplicated per-file test loop in the Makefile :chore:
=test-unit=, =test-integration=, and =coverage= each carry a near-identical ~40-line shell loop (run each file in its own Emacs, count passes, collect failures, print a summary box). The three drifted once already (the =:perf= tag filter had to be added in three places). Extract a single =define=d shell function or a helper recipe parametrized by test list + extra =-l= args + label, and have the three targets call it. Cosmetic — the Makefile works — so low priority. Noticed 2026-05-12 while adding =make benchmark=.
** DONE [#A] Add Telegram Messaging
https://github.com/zevlg/telega.el
Make sure there is a setup script to run, so that the docker container can be installed post emacs dotfiles repository clone on a fresh install
also, let's add an icon to the dashboard for this. perhaps this is the beginning of the third row? If so, add a child task to review and balance the dashboard icons
Shipped this session:
- =modules/telega-config.el= -- =use-package telega= with
=telega-use-docker t=; launcher on =C-; G= (=C-; t= and =C-; m t=
were both taken).
- Dashboard Row 3 added with the Telegram icon; dashboard-mode-map =g=
key launches =telega=.
- =scripts/setup-telega.sh= -- verifies docker presence + daemon
reachability; pulls =$TELEGA_DOCKER_IMAGE= when set, otherwise
announces =M-x telega-server-build= for the in-Emacs build path.
7 bats tests in =tests/test-setup-telega.bats= (docker stubbed).
- Auth (phone + verification code) is interactive on first =M-x telega=
-- not scripted.
*** DONE [#A] Add =scripts/setup-telega.sh= for TDLib docker container :feature:
Pull or build the telega TDLib container so a fresh-clone install can
run telega without a system-wide TDLib build. Mirror the
=scripts/setup-email.sh= pattern: =main()= wrapped in a
=BASH_SOURCE == 0= guard so the script is sourceable for bats tests;
bats test file =tests/test-setup-telega.bats= with =docker= stubbed.
*** DONE [#A] Review and balance dashboard icon layout :refactor:
CLOSED: [2026-05-14 Thu]
Adding the Telegram icon started a third row that has only one entry.
Decide whether to (a) leave it asymmetric and let the row fill in as
new launchers arrive, (b) move an existing icon down to balance 5/5/2
or similar, or (c) reorganize by category (work / read / chat / play).
Picked (c) -- the categories actually exist and a 4/4/4 grid
balances cleanly:
- Row 1 Work: Code / Files / Terminal / Agenda
- Row 2 Read & Learn: Feeds / Books / Flashcards / Music
- Row 3 Communication: Email / IRC / Slack / Telegram
Drive-by fix in the same commit: Music had an icon but no
`dashboard-mode-map' keybinding, so the visual launcher couldn't be
fired without the mouse. Added =m=. Reordered the existing
`define-key' calls to mirror the row layout so reading the keymap
top-to-bottom matches the icons left-to-right.
Surfaced when Telegram landed in Row 3 alone.
** DONE [#B] Add VERIFY and DOING blocks to the main agenda view :feature:
The main agenda "d" command (=cj/main-agenda-display=, F8) currently
renders four blocks: OVERDUE -> HIGH PRIORITY UNRESOLVED -> SCHEDULE
-> PRIORITY B. Insert two new blocks around SCHEDULE so a glance at
the daily view also surfaces what's in flight and what's waiting on a
manual check:
- Above SCHEDULE: all tasks with TODO state VERIFY (header:
=VERIFICATION=).
- Below SCHEDULE: all tasks with TODO state DOING (header:
=IN-PROGRESS=).
Resulting block order:
OVERDUE -> HIGH PRIORITY -> *VERIFICATION* -> SCHEDULE -> *IN-PROGRESS* -> PRIORITY B
Decisions:
- *Scope*: same as the other blocks -- every entry in
=org-agenda-files=, no per-project filter.
- *Scheduled / deadlined entries*: included. A VERIFY task with a
scheduled date for today appears in both the VERIFICATION block and
the SCHEDULE block. Mirrors the HIGH PRIORITY block's behavior.
- *Habit / PROJECT skips*: skip habits via
=cj/org-skip-subtree-if-habit=. Don't skip PROJECT-keyword entries
(the =(todo "VERIFY")= and =(todo "DOING")= match is keyword-exact
so PROJECT parents wouldn't appear anyway, and a PROJECT in VERIFY
state would be deliberate).
Implementation locations:
- =modules/org-agenda-config.el= -- two new entries inside
=org-agenda-custom-commands= "d" block, each a =(todo "STATE" ...)=
with =org-agenda-overriding-header=, the shared
=cj/--main-agenda-prefix-format=, and the habit skip-function.
- =modules/org-agenda-config.el= -- two header defvars
(=cj/main-agenda-verify-title= / =cj/main-agenda-doing-title=) for
symmetry with =cj/main-agenda-overdue-title= etc.
Regression coverage:
- Extend =tests/test-org-agenda-config-skip-functions.el= with
structural assertions: the "d" command has six blocks in the
expected order, the new VERIFICATION / IN-PROGRESS blocks reference
the shared prefix-format symbol, carry the right
=org-agenda-overriding-header=, and run the habit skip.
** DONE [#A] Org Agenda fixes :bug:
*** 2026-05-13 Wed @ 13:05:21 -0500 Skip CANCELLED entries from main agenda SCHEDULE
see the following screenshot
/home/cjennings/pictures/screenshots/2026-05-13_071428.png
Fix shipped on main: commit =8e57950=. Added an org-agenda-skip-function
to the SCHEDULE block of the "d" command in =org-agenda-custom-commands=
that filters entries with TODO state CANCELLED. Scope is deliberately
narrow -- DONE and FAILED scheduled tasks still render.
Tests in =tests/test-org-agenda-config-skip-functions.el= (Normal +
Boundary) lock in the configuration form on the agenda block and
verify the other blocks aren't accidentally carrying the same skip.
*** DONE [#A] Refactor: extract org-agenda-prefix-format literal :refactor:
=modules/org-agenda-config.el= currently inlines =" %i %-15:c%?-15t% s"=
across four blocks of =org-agenda-custom-commands= (overdue, hi-pri,
schedule, priority-B). Extract into a defvar (e.g.
=cj/--main-agenda-prefix-format=) and reference it from each block.
Surfaced during the audit for the CANCELLED-schedule fix.
Fix: new =cj/--main-agenda-prefix-format= defvar in
=modules/org-agenda-config.el=; all four blocks of the "d" command now
reference the symbol instead of inlining the literal. Regression test
in =tests/test-org-agenda-config-skip-functions.el= walks the blocks
and asserts each =org-agenda-prefix-format= entry resolves to the
shared symbol -- so a future tweak to one block can't silently diverge
from the others.
*** 2026-05-13 Wed @ 13:27:39 -0500 Clear dedicated before toggling window split
Reproduction steps
- open an org file (I was using this projects's todo.org file
- hit the f8 button to open the agenda view. it opens fine.
- toggle-window-split
>>> The agenda displays on both panes after the toggle.
see snapshot below
/home/cjennings/pictures/screenshots/2026-05-13_071603.png
Fix shipped on main: commit =97f0f8e=. Root cause was the dedicated
=*Org Agenda*= window (set via =display-buffer-alist= rule) rejecting
the internal =set-window-buffer= swap. The non-dedicated buffer never
crossed and both panes ended up showing the agenda.
=modules/ui-navigation.el= now clears dedicated on both windows at the
top of =toggle-window-split= before the swap. The toggle is an
explicit layout change, so preserving per-window dedicated through it
would just re-trigger the same wedge on the next invocation.
Tests in =tests/test-ui-navigation--toggle-window-split.el= (5 tests,
Normal + Boundary) cover the no-dedicated baseline, the bug-trigger,
post-toggle cleared state, and the 1-window / 3-window no-op cases.
Verified red against the unfixed code (the bug-trigger test errored
=Window is dedicated to '*test-toggle-b*'=) before applying the fix.
Live verification pending: =M-x load-file modules/ui-navigation.el=,
then walk through F8 + M-S-t in a fresh session.
*** DONE [#A] Enhancement: replace todo indicators with project name
In the overdue section, the high priority section, and the priority B section, each of the entries has a todo: indicator, which is the name of the file.
This is not useful. Based on how I'm using emacs, every entry is likely to come from a file named todo.org.
A much preferrable option would be to have the project's name there instead.
so, for instance this todo.org file would show "emacs.d" as the project name in place of todo.
see snapshot below for an example of the current state.
/home/cjennings/pictures/screenshots/2026-05-13_071840.png
Fix: =cj/--org-todo-category-from-file= +
=cj/--org-set-todo-category= in =modules/org-agenda-config.el=
hook =org-category= buffer-locally to the parent directory's
basename (with a single leading dot stripped, so =.emacs.d= reads
as =emacs.d=) whenever a todo.org file opens. Explicit
=#+CATEGORY:= still wins. 14 tests in
=tests/test-org-agenda-config-category.el= cover normal /
boundary / error paths; full =make test-unit= green.
** DONE [#A] Save journal buffer after marking a task DONE :bug:
CLOSED: [2026-05-14 Thu]
When a task transitions to a done state, =cj/org-roam-copy-todo-to-today=
in =modules/org-roam-config.el= refiles a copy of the heading into the
day's roam journal (creating the file if missing) -- example:
=/home/cjennings/sync/org/roam/journal/2026-05-14.org=. The journal
buffer is left modified-but-unsaved, so closing Emacs always prompts
about open unsaved buffers with no obvious source.
Function intends to save via two routes:
- =org-after-refile-insert-hook= let-bound to =#'save-buffer= -- a
single-function value rather than a list. =run-hooks= calls a bare
function value, so this should fire, but verify it does in the
capture+refile context (and that it runs in the target buffer, not
the source).
- The =:config= block of =use-package org-refile= advises =org-refile=
=:after= with =org-save-all-org-buffers=. That only runs once
=org-refile= is loaded; if the DONE transition fires before
org-refile's =:defer .5= elapses, the advice isn't attached yet.
Fix candidates:
- Drop the let-binding and call =(save-buffer)= explicitly in the
target buffer after the =org-refile= call, before
=save-window-excursion= unwinds. Deterministic, doesn't depend on
hook timing.
- Or eager-load =org-refile= so the =:after= advice attaches before any
DONE transition can fire.
Test: mark a TODO done from a non-journal buffer, then check
=buffer-modified-p= on the dated journal buffer. Should be nil.
** DONE [#B] Extend dired/dirvish =T= to transcribe videos, not just audio :feature:
CLOSED: [2026-05-14 Thu]
Today =T= on an audio file in dired/dirvish triggers
=cj/transcribe-audio-at-point= and only accepts files matching
=cj/audio-file-extensions= (=cj/--audio-file-p= rejects anything
else with a =user-error=). Want the same one-key flow on video
files -- so a =.mp4= or =.mkv= recording can be transcribed without
hand-extracting the audio track first.
Likely shape:
- New =cj/video-file-extensions= in user-constants.el (mp4, mkv,
mov, webm, avi, m4v, ...).
- =cj/--video-file-p= sibling of =cj/--audio-file-p=.
- =cj/--start-transcription-process= (or a wrapper) detects video,
shells out to ffmpeg to extract the audio track to a temp file
(=ffmpeg -i in.mp4 -vn -acodec copy out.m4a= or similar; pick a
codec the backend accepts), then transcribes the temp file and
cleans up.
- =cj/transcribe-audio-at-point= accepts both audio and video via
=(or (cj/--audio-file-p f) (cj/--video-file-p f))=; the
surrounding pipeline knows when to insert the ffmpeg step.
Open design questions:
- Keep the function named =transcribe-audio-at-point= (treats video
as "audio-bearing") or rename to =transcribe-media-at-point= and
add an alias? Rename probably cleaner.
- ffmpeg availability check + =cj/executable-find-or-warn= pattern
on first use.
- Where the temp audio file lives -- alongside the video (visible),
or =temporary-file-directory= (clean). Probably the latter for
videos the user doesn't want to clutter.
- Do we keep the temp audio after transcription, or always delete?
The log file already retains diagnostic info; extracted audio is
derivable. Default to delete; offer a custom to keep.
Test surface: =cj/--video-file-p= happy/edge cases, the ffmpeg
extract step (stub =call-process=), and the dispatch in
=cj/transcribe-audio-at-point= against a video path.
** DONE [#C] Surface org narrowing + sparse-tree under =C-; O= :refactor:
CLOSED: [2026-05-14 Thu]
Final layout flatter than the original proposal: no =n= or =s=
sub-prefixes. Lowercase letters create / narrow / sparse-tree;
the same letter capitalized cancels. `n' / `N' = narrow / widen.
`s' / `S' = match-sparse-tree / show-all. `t' / `T' =
show-todo-tree / show-all (both capitals point at the same
`org-show-all' so the mental model is "capital cancels the
lowercase I just ran"). `R' = `org-reveal' (no lowercase pair --
`r' is the table-row sub-prefix); F2 (the old reveal binding) is
freed up. Sibling-stepping is on `>' / `<' at the top level.
Four new ERT assertions in
=tests/test-org-config-keymap-ownership.el= lock the shape.
The narrowing and sparse-tree commands already exist in
=modules/org-config.el=, but they're bound only inside the
=:bind (:map org-mode-map ...)= block and scattered across `C-c'
shortcuts -- nothing in `cj/org-map' (`C-; O') surfaces them, so
which-key never shows them and discoverability is poor.
Existing bindings worth promoting (org-config.el ~line 141-150):
- =C-\\= =org-match-sparse-tree=
- =C-c N= =org-narrow-to-subtree=
- =C-c >= =cj/org-narrow-forward=
- =C-c <= =cj/org-narrow-backwards=
- =C-c <ESC>= =widen=
- =<f2>= =org-reveal= (the reveal-narrowed-context command,
not org-reveal-config.el)
Proposal:
Add a sub-menu under `C-; O':
- `C-; O n' -- narrow operations (sub-prefix)
- `n s' narrow to subtree
- `n e' narrow to element
- `n >' narrow forward sibling
- `n <' narrow backward sibling
- `n w' widen
- `C-; O s' -- sparse-tree operations (sub-prefix)
- `s s' org-match-sparse-tree (by tag/property/todo match)
- `s t' show all TODOs
- `s p' show entries with a priority
- `s r' org-reveal (open the surrounding context of point)
Add the which-key labels alongside. Keep the existing `C-c'
bindings as-is for muscle memory.
Open question: should `cj/org-narrow-forward' /
`cj/org-narrow-backwards' have their own sub-letters under `n', or
just be under `n >' / `n <' as written above? The arrow-symbol
keys read naturally as "next/previous" so probably keep them.
** DONE [#B] F9 toggle should restore single-window layout for AI-vterm :bug:
When the AI-vterm buffer is the only window in the frame (e.g. after =C-x 1=) and
F9 is pressed, =cj/ai-vterm= buries the buffer (correct), but the next F9
redisplays the agent in a split rather than restoring the single-window full-frame
layout. F9 should toggle off/on while preserving the lone-window state.
Fix: new =cj/--ai-vterm-last-was-bury= flag in =modules/ai-vterm.el=.
The toggle-off branch sets it to t when =one-window-p= is true (bury
path) or nil when =delete-window= runs. =cj/--ai-vterm-display-saved=
checks the flag at toggle-on: if t and the frame is still single-window,
it replaces the selected window's buffer in place via =set-window-buffer=
rather than splitting via =display-buffer-in-direction=. Flag is
consumed (cleared) by either branch so it never stays stale.
5 tests in =tests/test-ai-vterm--single-window-toggle.el= cover:
flag set on bury, flag cleared on delete-window, flag respected only
when still one-window, flag not set when bury didn't run, and the
end-to-end roundtrip. Full =make test-unit= green.
** DONE [#B] AI-vterm scrollback history should replace agent buffer in place :feature:
When viewing the scrollback history of an AI-vterm buffer, the history view should
replace the live agent buffer in the same window rather than splitting or popping
a separate window. Goal: read past output without losing the agent's frame slot,
then snap back to the live buffer when done.
Decisions on the open questions:
- *Trigger*: reused the existing =cj/vterm-tmux-history= command (=C-; x h=).
No new command -- it already captures the tmux pane and runs from any
vterm buffer including agents.
- *Round-trip*: =q= / =<escape>= / =C-g= already restore the origin in
the same window via =cj/vterm-tmux-history-quit=. Same key as the
scrollback mode's other exits.
- *F9 integration*: deferred. Pressing F9 in history mode now treats the
history buffer as non-agent (its name is =*vterm tmux history: ...*=,
not =agent [...]=) so dispatch falls through to redisplay-recent + a
saved-direction split. A user who wants to toggle agent off should
press =q= first, then F9. Filed as a follow-up if it bites.
Fix: =modules/vterm-config.el= -- one line. =pop-to-buffer buffer=
became =switch-to-buffer buffer= so the history view replaces the origin
in the selected window instead of going through display-buffer's split
logic. Quit was already in-place via =set-window-buffer=.
New test in =tests/test-vterm-tmux-history.el= asserts the selected
window's buffer becomes the history buffer with no extra window
created (=one-window-p= still t). Existing tests dropped their
=pop-to-buffer= stub since =switch-to-buffer= works directly in batch.
Full =make test-unit= green.
** DONE [#B] Add ERT coverage for modules below 70% :tests:
CLOSED: [2026-05-14 Thu]
Coverage snapshot from =make coverage= on 2026-05-14 (post-push):
=5958/6861= executable lines covered (=86.8%=) across 73 tracked module files.
All tracked modules now sit at 70% or above. The two stragglers
(=system-defaults.el= and =system-commands.el=) were resolved by
attacking the instrumentation pattern rather than adding more tests:
- =system-defaults.el= 8.3% -> 100%: switched the helper-functions
test from per-test =(load ...)= reloads inside =cl-letf= to a
single top-level =(require 'system-defaults)= wrapped in stubs,
so undercover sees one load instead of N reloads.
- =system-commands.el= 69.4% -> 100%: switched =cj/system-cmd='s
=(interactive (list (read-shell-command ...)))= to the equivalent
string spec =(interactive "sSystem command: ")=, which lets
undercover instrument the function body that was previously
showing as 0 hits, plus added one test that captures and invokes
the =run-at-time= lambda body directly.
Lesson for future coverage work: when ERT tests exercise a function
but the body shows 0 hits, suspect undercover/edebug instrumentation
failing on a specific Lisp form (=interactive= with a destructured
spec, backquote-destructured =pcase-let=, etc.), not the tests.
*** DONE [#B] Add ERT tests for =modules/prog-python.el= (21/21, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/selection-framework.el= (3/3, 100.0%) :tests:
*** DONE [#B] Add ERT tests for =modules/keyboard-compat.el= (29/29, 100.0%) :tests:
*** DONE [#B] Add ERT tests for =modules/prog-webdev.el= (21/21, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/calibredb-epub-config.el= (95/133, 71.4%) :tests:
*** DONE [#B] Add ERT tests for =modules/system-defaults.el= (12/12, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
Rewrote =tests/test-system-defaults-functions.el= to call
=(require 'system-defaults)= once at top level (with the
side-effecting primitives stubbed via =cl-letf= wrapping the
require) instead of looping per-test =(load ...)= reloads inside
=cl-letf=. Undercover only saw the first load, so the function
bodies showed as uncovered even though every test ran them. Loading
once -- with the same stubs -- fixed the gauge and pulled coverage
to 12/12. Added two more tests to exercise the previously-unhit
list-without-comp guard and the non-string-message format branch.
*** DONE [#B] Add ERT tests for =modules/ui-navigation.el= (46/48, 95.8%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/prog-go.el= (24/27, 88.9%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/system-commands.el= (51/51, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
The =interactive= form on =cj/system-cmd= was =(interactive (list
(read-shell-command "...")))= -- a destructured list form. Edebug-
based undercover instrumentation didn't see past it, so the function
body registered 0 hits even though the tests called it directly.
Switched to the equivalent string spec =(interactive "sSystem
command: ")= and the body instrumented as expected. Added one more
test that captures the =run-at-time= lambda inside
=cj/system-cmd-restart-emacs= and invokes it directly so the inner
=call-process-shell-command= branch registers as covered.
*** DONE [#B] Add ERT tests for =modules/external-open.el= (31/33, 93.9%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/org-webclipper.el= (59/59, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/system-utils.el= (26/26, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/org-reveal-config.el= (68/81, 84.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/coverage-elisp.el= (19/19, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/org-noter-config.el= (72/99, 72.7%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/ai-config.el= (160/191, 83.8%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/slack-config.el= (70/74, 94.6%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/org-roam-config.el= (80/80, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/custom-text-enclose.el= (145/145, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/dirvish-config.el= (174/185, 94.1%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/hugo-config.el= (88/96, 91.7%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/org-refile-config.el= (50/51, 98.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/org-contacts-config.el= (64/79, 81.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/transcription-config.el= (150/162, 92.6%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/music-config.el= (213/278, 76.6%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/mail-config.el= (14/19, 73.7%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/custom-buffer-file.el= (167/212, 78.8%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/org-agenda-config.el= (103/104, 99.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/host-environment.el= (53/57, 93.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/custom-ordering.el= (101/101, 100.0%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/ui-theme.el= (39/40, 97.5%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/custom-comments.el= (317/358, 88.5%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/ui-config.el= (28/31, 90.3%) :tests:
*** DONE [#B] Add ERT tests for =modules/custom-whitespace.el= (80/82, 97.6%) :tests:
*** DONE [#B] Add ERT tests for =modules/jumper.el= (97/99, 98.0%) :tests:
*** DONE [#B] Add ERT tests for =modules/test-runner.el= (160/222, 72.1%) :tests:
CLOSED: [2026-05-14 Thu]
*** DONE [#B] Add ERT tests for =modules/browser-config.el= (62/76, 81.6%) :tests:
** DONE [#A] Fix Python tree-sitter font-lock query syntax error :bug:
CLOSED: [2026-05-14 Thu]
Diagnosed 2026-04-26 — paused at /start-work Gate 2. Root cause was system-level, not in =.emacs.d=: Emacs 30.2 + tree-sitter library 0.26.x predicate-syntax mismatch. Emacs sent =#match= (no =?= suffix), tree-sitter 0.26 rejected anything but =#match?=. Affected every =:match=, =:equal=, =:pred= predicate in every treesit-aware mode, not just Python.
Full investigation, reproduction, and fix-option analysis in:
[[file:docs/python-treesit-predicate-mismatch.txt][docs/python-treesit-predicate-mismatch.txt]]
Resolved 2026-05-14 by an upstream emacs Arch-package revision bump (=30.2-2= → =30.2-3=, shipped 2026-05-03) — most likely carrying a downstream patch to =treesit.c='s predicate translation. Bug no longer reproduces: the exact failing query runs cleanly via =treesit-query-capture=, and =font-lock-ensure= on a real Python file under =python-ts-mode= completes with no =treesit-query-error=. No local override applied to =modules/prog-python.el=. Matches option A from the investigation's fix-options ("WAIT FOR UPSTREAM EMACS FIX").
** DONE [#C] EPUB text is slightly left-of-center (shr word-wrap shortfall) :bug:
CLOSED: [2026-05-14 Thu 23:39]
[2026-05-12] Visual review of the reading-width rework is done -- it's good. Not sure I actually need this nit fixed; the left-of-center bias is minor and the `+'/`-' keys let me nudge it. Parking here until I decide it bothers me enough.
After =b7c6b2c=, the EPUB text block is centered with `set-window-margins' at `(natural - nov-text-width) / 2' each side -- but the *rendered* text is a bit narrower than `nov-text-width' columns, because `shr' wraps at word boundaries, so the typical line ends a few columns short of the fill width. The text is left-aligned within its `nov-text-width'-wide fill region, so the unused tail of that region adds to the right margin -- the block reads as shifted left of center. Adjusting `cj/nov-margin-percent' (the `+'/`-' keys) re-flows and happens to look better at some widths (probably the line-ending pattern lands tighter), which is the same effect, not a real difference.
Plan: in `cj/nov-update-layout', after the render, measure the actual widest line (`(save-excursion (goto-char (point-min)) (let ((m 0)) (while (not (eobp)) (end-of-line) (setq m (max m (current-column))) (forward-line 1)) m))') and center on *that* instead of on `nov-text-width'. Or, cheaper but coarser: bias the left margin by a small fudge (a column or two). The measure-the-text approach is correct; do it if it's not too slow on big chapters (it scans the buffer once per render -- the buffer's already in memory, so likely fine). =modules/calibredb-epub-config.el=, =tests/test-calibredb-epub-config.el=.
** DONE [#B] Write spec on what's needed for music-config not to depend on EMMS
CLOSED: [2026-05-15 Fri]
What if we were writing this as it's own package and couldn't use EMMS. What would that look like?
The spec should be in docs/
Another task should be created to implement the spec
Spec written in [[file:docs/design/music-config-without-emms.org][Design: music-config Without EMMS]].
** DONE [#B] Update gptel models :chore:
CLOSED: [2026-05-14 Thu]
Anthropic side: bumped Opus 4.6 → 4.7 (current frontier); Sonnet 4.6
and Haiku 4.5 stay (still current). Default model setq also bumped
to =claude-opus-4-7= in both places (=cj/ensure-gptel-backends= and
the =use-package gptel :config= block).
OpenAI side: bigger refresh. Old menu (=gpt-4o=, =gpt-5= original,
=gpt-4.1=, =o1=) was all in the cohort retired from ChatGPT on
2026-02-13 -- still callable via API but no longer the path forward.
New menu: =gpt-5.5= (current flagship), =gpt-5.4-mini= (fast/cheap),
=o3= (reasoning).
Stale docstring example in =cj/gptel--current-model-selection=
also bumped to match.
gptel's bundled =:models= list only goes through May-2025 model IDs
but the constructor passes whatever string you supply straight to the
API, so newer model names work fine without a gptel upgrade.
** DONE [#B] Add gptel toggle to M-F9 :refactor:
CLOSED: [2026-05-15 Fri]
Rebound =M-<f9>= from =cj/ai-vterm-pick-buffer= to =cj/toggle-gptel=
in both the global keymap and =vterm-mode-map=. The pick-buffer
command and its helper =cj/--ai-vterm-pick-buffer-candidates= were
deleted entirely along with the candidates test file.
F9 family after this change:
- =<f9>= ai-vterm toggle (unchanged)
- =C-<f9>= ai-vterm project picker (unchanged)
- =M-<f9>= gptel *AI-Assistant* window toggle (NEW)
Two existing test files updated:
=test-ai-vterm--f9-in-vterm.el= (binding assertions flipped to the
new function).
=test-ai-vterm--pick-buffer-candidates.el= deleted.
Module commentary + the =cj/ai-vterm= docstring updated to describe
the new M-F9 behavior.
*** 2026-05-15 Fri @ 02:21:00 -0500 Add explicit ai-vterm -> ai-config command boundary for cj/toggle-gptel
=make compile= warned that =cj/toggle-gptel= was not known to be
defined when =modules/ai-vterm.el= was byte-compiled. Added an
interactive autoload declaration in =ai-vterm.el= alongside the
other cross-module declarations:
#+begin_src elisp
(autoload 'cj/toggle-gptel "ai-config" nil t)
#+end_src
The dependency is now explicit, =make compile= is clean, and
requiring =ai-vterm= in isolation leaves =cj/toggle-gptel= fboundp
as an autoload sigil pointing at =ai-config=. Added a regression
test in =test-ai-vterm--f9-in-vterm.el=:
=test-ai-vterm-toggle-gptel-autoloaded-without-ai-config=. Verified
with =make compile= (no warning) and
=make test-file FILE=test-ai-vterm--f9-in-vterm.el= (5/5 pass).
** DONE [#B] Modify C-; b p :feature:
CLOSED: [2026-05-15 Fri]
- (EWW) copy EWW url when in an EWW buffer.
- (calibre) copy path to an epub or pdf or other document if those are shown in docview or pdfview
Shipped this session: =cj/copy-buffer-source-as-kill= replaces the
old =cj/copy-path-to-buffer-file-as-kill= (kept as a =defalias= for
backwards compat). Dispatch alist =cj/buffer-source-functions= keys
on =major-mode= → thunk; =buffer-file-name= is the fallback.
Bindings: =C-; b p= now copies whatever is the right "source" for
the current mode. which-key relabeled "copy buffer source" (was
"copy file path").
First-batch dispatches: =eww-mode= (eww URL), =elfeed-show-mode=
(entry link), =dired-mode= / =dirvish-mode= (file at point),
=doc-view-mode= / =pdf-view-mode= (covered by the fallback to
=buffer-file-name=). 10 new ERT tests in
=tests/test-custom-buffer-file-copy-buffer-source.el= cover the
dispatch paths + the alias + the keymap.
Deferred to a follow-up task: =mu4e-view-mode=, =org-mode= at a
heading, =help-mode=, =Info-mode=, =magit-log-mode= /
=magit-commit-mode= / =magit-status-mode=, =xref--xref-buffer-mode=
/ =grep-mode= / =compilation-mode=, =image-mode=, =archive-mode=.
These need format decisions (Message-ID vs link vs subject, id link
vs CUSTOM_ID vs heading text, etc.) before implementation.
** DONE [#C] Extend cj/buffer-source-functions to more modes :feature:
CLOSED: [2026-05-15 Fri]
Followup to =Modify C-; b p=. The first batch covered eww,
elfeed-show, dired/dirvish, and doc-view/pdf-view (via the
buffer-file-name fallback). These modes still need a decision +
implementation:
- =mu4e-view-mode= → Message-ID, =mu4e:msgid:...= link, or
Subject + From?
- =Info-mode= → an org-style =[[info:(manual)Node][label]]= link
Each one is a small addition to =cj/buffer-source-functions= in
=modules/custom-buffer-file.el= plus a test. Pick a format per
mode, then implement.
*** 2026-05-15 Fri @ 02:21:00 -0500 Make Info buffer-source output match the documented org link format
Updated the =Info-mode= thunk in =cj/buffer-source-functions=
(=modules/custom-buffer-file.el=) to return the full org bracket
link =[[info:(manual)Node][(manual) Node]]= instead of the bare
target =info:(manual)Node=. Label format =(manual) Node= keeps the
manual name and node name both grep-friendly in note files.
Existing test
=test-copy-buffer-source-info-mode-formats-as-org-info-link= on a
=.info.gz= file now asserts the bracket form. Added a new boundary
test
=test-copy-buffer-source-info-mode-handles-uncompressed-info-file=
for plain =.info= input so the suffix-stripping branch is locked
in. Verified with
=make test-file FILE=test-custom-buffer-file-copy-buffer-source.el=
(15/15 pass).
*** 2026-05-15 Fri @ 00:11:47 -0500 Brainstorm: additional buffer-source ideas
Today =C-; b p= invokes =cj/copy-path-to-buffer-file-as-kill=, which only
handles file-visiting buffers and errors otherwise. The proposed
extension turns it into a dispatcher: ask the current buffer "what's
your source?" and copy that, falling back to =buffer-file-name=.
Grouping ideas by yield (most useful first) so an implementation can
prioritize:
*Likely highest-leverage (matches Craig's daily workflows):*
- =eww-mode= → =(eww-current-url)= (already in task body).
- =elfeed-show-mode= → entry URL via =(elfeed-entry-link
elfeed-show-entry)=. Closes the loop for "I'm reading this article,
let me share it / open it in browser."
- =mu4e-view-mode= / =mu4e-headers-mode= → either the Message-ID as a
=mu4e:msgid:...= link or the From + Subject as plain text. Useful
for citing emails in org notes.
- =org-mode= on a heading → the heading's =CUSTOM_ID= or =ID= as a
full =[[id:...][title]]= link. Already partly covered by
=org-store-link=; the value here is "give me the link form even
outside an org-store flow."
- =dired-mode= / =dirvish-mode= → =(dired-get-filename)= for the file
at point, not the dired buffer's =default-directory=. Subtly
different from current behavior because dired *is* file-visiting in
a sense.
- =doc-view-mode= / =pdf-view-mode= → the underlying file path. Often
IS =buffer-file-name=, but explicit dispatch makes the behavior
predictable. Calibre integration (task body) is a special case of
this -- calibre wraps the path through a different lookup.
*Useful for occasional workflows:*
- =help-mode= → the symbol being described (=help-xref-following= or
parsing the *Help* buffer header). Pairs with /describe-function/
/describe-variable/.
- =Info-mode= → an org-style =[[info:(manual)Node][label]]= link.
- =magit-log-mode= / =magit-commit-mode= → the commit SHA at point,
optionally as a clickable form for the remote.
- =magit-status-mode= → the project root (or repo URL via
=vc-git-repository-url=).
- =xref--xref-buffer-mode= / =grep-mode= / =compilation-mode= → the
=file:line= location at point.
- =image-mode= → the image file path.
- =archive-mode= (tar/zip) → =archive-file-name= plus the entry name.
*Probably skip:*
- =vterm-mode= / =eshell-mode= → no meaningful "source"; would just
copy the buffer name. Edge case at best.
- =w3m-mode= → covered by EWW for Craig; w3m use is rare here.
- =calc-mode= → "current value" isn't really a "buffer source"; better
served by a dedicated calc keybinding.
*Implementation shape:*
A dispatch alist mapping major-mode → thunk that returns a string
(or nil to fall through), with =buffer-file-name= as the final
fallback. Something like:
#+begin_src emacs-lisp
(defvar cj/buffer-source-functions
'((eww-mode . (lambda () (eww-current-url)))
(elfeed-show-mode . (lambda () (elfeed-entry-link elfeed-show-entry)))
(dired-mode . (lambda () (dired-get-filename nil t)))
...))
(defun cj/copy-buffer-source-as-kill ()
(interactive)
(let* ((handler (alist-get major-mode cj/buffer-source-functions))
(source (or (and handler (funcall handler))
(buffer-file-name)
(user-error "Buffer has no copyable source"))))
(kill-new source)
(message "Copied: %s" source)))
#+end_src
Rename the command (=cj/copy-buffer-source-as-kill=) since it's no
longer specifically about a file path. Keep =C-; b p= binding so
muscle memory survives.
** DONE [#C] Rebind org-noter insert-note to =n= (so it's =C-; n n=) :refactor:
CLOSED: [2026-05-15 Fri]
The org-noter prefix =C-; n= currently has =i= for insert-note and =n=
for sync-next-note. Move insert-note onto =n= -- it's the most-used
action in a noter session and deserves the doubled prefix letter.
Current bindings in =modules/org-noter-config.el= (=cj/org-noter-map=):
- =i= -> =cj/org-noter-insert-note-dwim=
- =n= -> =org-noter-sync-next-note=
- =p= -> =org-noter-sync-prev-note=
- =.= -> =org-noter-sync-current-note=
Proposed bindings
- n -> =cj/org-noter-insert-note-dwim=
- > -> =org-noter-sync-next-note=
- < -> =org-noter-sync-prev-note=
- =.= -> =org-noter-sync-current-note=
Update the =which-key= labels in the same module and any test that asserts the keymap shape.
** DONE [#D] Dedup the doubly-defined functions in calibredb-epub-config.el :cleanup:
CLOSED: [2026-05-15 Fri]
=make compile= flags =calibredb-epub-config.el= for defining =cj/calibredb-clear-filters= (line ~79) and =cj/nov-jump-to-calibredb= (line ~277) twice each — the later definition silently shadows the earlier. Find which copy is current, delete the stale one. Pre-existing; noticed 2026-05-12 while fixing the Nov text-width loop.
Diagnosis: there was no actual duplicate. Only one =(defun ...)=
of each name in the source. The "defined multiple times" warning
fired because use-package's =:bind= expansion makes the
byte-compiler count the referenced symbol as a definition when the
target function is defined in the same file -- then sees the actual
=defun= later and warns about a redefinition.
Fix: reorder so each =defun= appears /before/ the =use-package=
block that references it via =:bind=. Concrete moves:
- =cj/calibredb-clear-filters= moved above =(use-package calibredb
...)=.
- =cj/nov--metadata-get= + =cj/nov--file-path= +
=cj/nov-jump-to-calibredb= (the entire jump-to-calibredb cluster)
moved above =(use-package nov ...)=. Helpers had to move
alongside the public function so the byte-compiler doesn't emit
free-function warnings for them.
After: both "defined multiple times" warnings are gone. All unit
tests still pass. Net line count unchanged (just reordered).
** DONE [#B] Convert <cj structure template to universal yasnippet :feature:refactor:
CLOSED: [2026-05-15 Fri]
Today =<cj= + TAB only expands in org-mode, via =org-structure-template-alist= in =modules/org-babel-config.el:144=. The expansion is the literal text:
#+begin_example
#+begin_src cj: comment
#+end_src
#+end_example
A Claude skill scans for this exact marker across files using a Python helper, so the marker needs to be insertable identically in any buffer (elisp, shell, plain text, anything) regardless of major mode. Language-aware variants (per-mode comment syntax) would break the script.
*** 2026-05-15 Fri @ 12:58:08 -0500 Wired yasnippet for universal availability
In =modules/prog-general.el= replace =:hook (prog-mode . yas-minor-mode)= with =(yas-global-mode 1)= in =:config=, so yasnippet activates in every buffer rather than only =prog-mode= ones. Also add a hook that turns on =fundamental-mode= as an extra mode in every buffer so the universal snippet table is always consulted:
#+begin_src emacs-lisp
(add-hook 'yas-minor-mode-hook
(lambda () (yas-activate-extra-mode 'fundamental-mode)))
#+end_src
Acceptance: =M-: yas-minor-mode= returns =t= in =org-mode=, =text-mode=, =fundamental-mode=, and any =prog-mode= buffer. =yas-extra-modes= contains =fundamental-mode= in every buffer.
*** 2026-05-15 Fri @ 12:58:08 -0500 Created the <cj fundamental-mode snippet
Create =snippets/fundamental-mode/cj-comment-block= (or similar filename) with:
#+begin_src snippet
# -*- mode: snippet -*-
# name: cj-comment-block
# key: <cj
# --
#+begin_src cj: comment
$0
#+end_src
#+end_src
Acceptance: in a scratch buffer, in a =.el= buffer, in a =.sh= buffer, in an =org= buffer — typing =<cj= and hitting TAB expands to the three-line block with the cursor on the empty middle line.
*** 2026-05-15 Fri @ 12:58:08 -0500 Removed the org-tempo cj entry
Once the yasnippet handles every mode, the =org-structure-template-alist= entry at =modules/org-babel-config.el:144= becomes redundant in org-mode and creates a TAB-handler ordering question. Remove the line:
#+begin_src emacs-lisp
(add-to-list 'org-structure-template-alist '("cj" . "src cj: comment"))
#+end_src
Verify =<cj= + TAB still expands in =org-mode= afterwards (now via yasnippet rather than org-tempo).
*** 2026-05-15 Fri @ 15:08:48 -0500 Audited existing per-mode snippets for cross-mode use
Walked =snippets/c-mode/=, =/emacs-lisp-mode/=, =/eshell-mode/=, =/html-ts-mode/=, =/org-mode/=, =/sh-mode/=. Read the body of every snippet. Conclusion: no movers — all 28 existing per-mode snippets contain mode-specific syntax (C =int main=, elisp =defun=, shell =printf= / =[ -f $1 ]=, HTML tags, org =#+STARTUP:= / =:PROPERTIES:= drawers, etc.) and belong where they are. =snippets/fundamental-mode/= correctly holds only the universal =cj-comment-block= marker.
** DONE [#B] Move lsp-file-watch-ignored-directories to global .emacs.d config :chore:refactor:
CLOSED: [2026-05-15 Fri] SCHEDULED: <2026-04-27 Mon>
Shipped 2026-04-26 in commit 781b46e. Implementation: =cj/lsp-file-watch-ignored-extras= (thirteen patterns) and =cj/lsp--add-file-watch-ignored-extras= in =modules/prog-lsp.el=, called from the lsp-mode use-package =:config=. Seven ERT tests in =tests/test-prog-lsp--add-file-watch-ignored-extras.el=, all green.
Manual verify (tomorrow): restart Emacs, open =~/code/deepsat/orchestration_dashboard_mvp/backend/test_mission_image_api.py=, watch for the file-watch prompt. Expected: no prompt, or count well below the previous 1905. If still prompting at ~1905, iterate on the pattern list.
After verification: drop the redundant =lsp-file-watch-ignored-directories= entry from the deepsat MVP's =.dir-locals.el= here and on velox.
Setting =lsp-file-watch-ignored-directories= via the project's =.dir-locals.el= doesn't apply at the buffer level. Confirmed via =M-: lsp-file-watch-ignored-directories= in a Python buffer — value is the lsp-mode default, not the 7 patterns we wrote in dir-locals. The safety prompt was answered with =!= and the dir-locals are otherwise live (the projectile commands take effect).
Fix: move the seven patterns into the lsp config module as a global default with =setq-default= or per-pattern =add-to-list=. The patterns are project-agnostic build/cache directories — safe as defaults for any project.
Patterns to add:
- =[/\\\\]node_modules\\'=
- =[/\\\\]\\.ruff_cache\\'=
- =[/\\\\]dist\\'=
- =[/\\\\]coverage\\'=
- =[/\\\\]test-results\\'=
- =[/\\\\]playwright-report\\'=
- =[/\\\\]tf[/\\\\]\\.terraform\\'=
After landing: =M-x lsp-workspace-shutdown=, reopen a Python file, confirm the directory count drops well below the default threshold of 1000 (currently 1905). Then remove the redundant entries from the deepsat MVP's =.dir-locals.el= here and on velox.
Discovered 2026-04-26 testing dashboard MVP F-key setup.
** DONE [#C] Investigate sqlite finalizer error on init :bug:
CLOSED: [2026-05-15 Fri]
=*Messages*= shows =finalizer failed: (wrong-type-argument sqlitep nil)= during init. A package is finalizing an sqlite handle that's already nil — indicates a teardown bug somewhere. Likely culprits: forge, magit-todos, or any package using the sqlite backend.
Investigation order:
1. =M-x toggle-debug-on-message= with a regex matching =finalizer failed=.
2. Restart Emacs to capture the backtrace.
3. Check =modules/git-config.el= (forge) and any other sqlite-using module.
Single occurrence per session, no visible impact yet. Track in case it grows.
Discovered 2026-04-26 in =*Messages*=.
Resolution 2026-05-15: confirmed gone. Live session (2h uptime): no
=finalizer= / =sqlitep= / =wrong-type-argument sqlite= match in
=*Messages*= (3966 bytes) or =*Warnings*=. Fresh namespaced daemon
(=emacs --daemon=sqlite-verify=): forced =forge= load, ran 10 GC
cycles with =sit-for= pauses, =sqlite-available-p= and
=forge-database-file= both confirmed live -- still zero hits across
1282 bytes of =*Messages*=. If it recurs, arm
=toggle-debug-on-message= on the regex =finalizer failed= to capture
a backtrace.
** DONE [#A] org-element--list-struct issue when using gptel magit :bug:
CLOSED: [2026-05-16 Sat]
Launch Emacs
Stage a file using magit
Commit using magit
Use gptel magit to generate a commit message
Commit the file
>>> commit is successful
Stage another file using magit
Commit using magit
Use gptel magit to generate a commit message
Commit the file
>>> error org-element--list-struct: Tab width in Org files must be 8, not 4. Please adjust your ‘tab-width’ settings for Org mode
** DONE [#A] transient-setup error when running gptel magit :bug:
CLOSED: [2026-05-15 Fri]
When running gptel magit during a commit message on this machine, I get the following error consistently:
transient-setup: Cannot open load file: No such file or directory, gptel-magit
|