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
|
=== Emacs Config Tasks ===
* Emacs Config Inbox
** TODO Review these Web Page tools for Org-mode
[[https://github.com/alphapapa/org-web-tools][alphapapa/org-web-tools: View, capture, and archive Web pages in Org-mode]]
Captured On: [2024-04-15 Mon 22:55]
** TODO Review Zzamboni's Emacs Config
[[https://zzamboni.org/post/my-emacs-configuration-with-commentary/][zzamboni.org | My Emacs Configuration, With Commentary]]
Captured On: [2024-04-15 Mon 22:54]
** TODO Review Howard Abrams Dotfiles
[[https://github.com/howardabrams/dot-files/blob/master/emacs-org.org][dot-files/emacs-org.org at master · howardabrams/dot-files]]
Captured On: [2024-04-15 Mon 22:45]
** TODO Investigate Org Mode's Web Archiver
[[https://github.com/charlesroelli/org-board][charlesroelli/org-board: Org mode's web archiver.]]
Captured On: [2024-04-15 Mon 22:33]
** TODO read throguh capturing content for emacs
[[https://howardism.org/Technical/Emacs/capturing-content.html][Capturing Content for Emacs]]
Captured On: [2024-04-15 Mon 22:27]
* DOING Emacs Config v0.7 [2/5]
** DONE Supplement Existing Functionality [9/9]
*** DONE [#B] Make sure eshell has same path as other shells
CLOSED: [2024-03-27 Wed 14:02]
it couldn't find build.emacs.src.sh in the path for instance
*** DONE [#B] Create Topic Org-Roam Template in Capture Templates
CLOSED: [2023-12-03 Sun 14:59]
*** DONE [#C] Put Eshell on F12 and Vterm on C-F12
CLOSED: [2024-03-04 Mon 14:54]
*** DONE [#C] Save Destination Buffer Post Refile
CLOSED: [2024-04-03 Wed 16:27]
**** 2024-04-03 Wed @ 16:11:32 -0500 Saving All Org Buffers Instead
It appears there are several ways that refile occurs. One is through org-capture, and another directly (i.e., interactively). There may be more.
After some searching, I found a way to save only the target file after an org-capture;
https://emacs.stackexchange.com/questions/19292/org-refile-locks-up-file-when-used-from-org-capture
#+begin_src emacs-lisp
(defun save-after-capture-refile ()
(with-current-buffer (marker-buffer org-capture-last-stored-marker)
(save-buffer)))
(advice-add 'org-capture-refile :after 'save-after-capture-refile)
#+end_src
This uses org-capture-last-stored-marker, which wouldn't work calling org-refile interactively.
The only other way that looked safe, was to simply save all org buffers after a refile. This isn't as desirable, but I will need to use it before I know of any negative impacts.
https://github.com/rougier/emacs-gtd/issues/9
and a discussion
https://emacs.stackexchange.com/questions/26923/org-mode-getting-errors-when-auto-saving-after-refiling
**** Goal
I've had Emacs lock up and as a result of killing it, I lost data in the refile in the unsaved buffer. Like cj/bookmark-set-and-save, I think a refile should save the target file it's refiling to.
https://github.com/rougier/emacs-gtd/issues/9
*** DONE [#B] Change the Name of an Elfeed Feed
CLOSED: [2024-04-03 Wed 15:01]
**** 2024-04-03 Wed @ 15:02:41 -0500 Done With Elfeed-org
Learned you can do that with elfeed-org and adopted it
**** Goal:
#+BEGIN_QUOTE
For others looking to change the name of a feed - it seems that this is now possible by using M-x elfeed-search-set-feed-title, as described here.
#+END_QUOTE
[[https://emacs.stackexchange.com/questions/38718/how-do-i-set-a-custom-name-for-a-feed-in-elfeed][How do I set a custom name for a feed in elfeed? - Emacs Stack Exchange]]
Captured On: [2023-10-30 Mon 10:49]
*** CANCELLED [#A] Move from Dired-Sidebar to Treemacs
CLOSED: [2024-03-14 Thu 06:21]
Treemacs doesn't give me the functionality I wanted.
I actually wanted to be able to navigate the methods within a source code file.
*** CANCELLED [#B] Warn when leaving dirty repository
This doesn't appear to work when tested.
Installed according to README
CLOSED: [2024-03-15 Fri 14:01]
https://github.com/thisirs/vc-check-status#vc-check-status
*** CANCELLED [#C] Investigate Yeetube
CLOSED: [2024-04-03 Wed 15:06]
Decided I wasn't going to use Yeetube
[[https://michal.sapka.me/emacs/watching-youtube-with-emacs/][[Michał Sapka's website] Emacs: watching YouTube with Yeetube and mpv]]
Captured On: [2024-03-15 Fri 17:02]
*** CANCELLED [#C] Look Into Github Elpa
CLOSED: [2024-04-03 Wed 15:08]
Not needed with local elpa-mirror setup
[[https://github.com/10sr/github-elpa][10sr/github-elpa: Build and Publish Your Own ELPA Repositories with GitHub Pages]]
Captured On: [2023-10-20 Fri 13:28]
** DONE Stabilize Existing Functionality [9/9]
*** DONE [#A] Error When Attempting to Launch Dirvish Go Menu
CLOSED: [2024-04-02 Tue 00:06]
*** DONE [#A] Move All Bugs and Todos in Code Into Project Todo.org
CLOSED: [2024-04-03 Wed 16:52]
*** DONE [#B] Bug: Scan Project Directories for Refiling Candidates Fails!
Fixed as of today!
CLOSED: [2024-03-30 Sat 19:10]
*** DONE [#B] Eshell Should Pick Up Aliases and Environment Variables
CLOSED: [2024-03-27 Wed 14:31]
*** DONE [#B] Side Arrows No Longer Change Todo State
CLOSED: [2024-04-04 Thu 10:29]
error: Command not allowed on this line
functions are: org-todo-nextset and org-todo-previouset
*** DONE [#B] Split Windows Should Show Buffer List and Not Show Current Buffer Twice
CLOSED: [2024-03-27 Wed 14:35]
Note: this was completed much earlier than the timestamp
#+BEGIN_QUOTE
Split functions which open the previous buffer in the new window instead of showing the current buffer twice.
(defun ph/vsplit-last-buffer ()
(interactive)
(split-window-vertically)
(other-window 1 nil)
(switch-to-next-buffer))
(defun ph/hsplit-last-buffer ()
(interactive)
(split-window-horizontally)
(other-window 1 nil)
(switch-to-next-buffer))
#+END_QUOTE
[[https://github.com/pascal-huber/emacs.d#packages][pascal-huber/emacs.d: My emacs setup]]
Captured On: [2023-10-22 Sun 02:16]
*** DONE [#C] Check Eshell-visual-commands for Common Apps
CLOSED: [2024-03-04 Mon 14:53]
- [X] gotop
- [X] ncmpcpp
- [X] nmtui
*** DONE Regression: 'C-x k' Immediately Kills Current Buffer
CLOSED: [2024-04-04 Thu 10:35]
Emacs -Q behavior displays a completing read containing all buffers with the current buffer selected.
This is the result of overriding that function in cj/invincible-buffers in system-utils.
**** 2024-04-04 Thu @ 10:35:09 -0500 Solution
#+begin_src emacs-lisp
;; ----------------------------- Invincible Buffers ----------------------------
;; buries buffers on the 'invincible-buffer' list rather than killing them.
;; The keybinding for kill-buffer is remapped to this function.
(defvar cj/invincible-buffers '("*scratch*" "*Messages*")
"Buffers that should not be killed, but buried instead.")
(defun cj/kill-buffer ()
"Bury buffers on invincible-buffers list rather than killing them."
(interactive)
(let ((target-buffer (completing-read "Kill buffer: "
(mapcar 'buffer-name (buffer-list)))))
(with-current-buffer target-buffer
(if (member (buffer-name (current-buffer)) cj/invincible-buffers)
(bury-buffer)
(kill-buffer (current-buffer))))))
(global-set-key [remap kill-buffer] #'cj/kill-buffer)
#+end_src
*** DONE [#C] Bookmark-save-flag Replaces Bookmark-set-and-save
CLOSED: [2024-04-03 Wed 15:00]
remove cj/bookmark-set-and-save if setting bookmark-save-flat to 1 saves when adding/modifying a bookmark
** DOING Open v0.7 Fit and Finish (ends 2024.04.18) [0/6]
*** TODO [#B] Save All Attachments Working in Mu4e
https://etienne.depar.is/emacs.d/mu4e.html
(defun ed/mu4e-view-save-all-attachments (&optional arg)
"Save all attachments of a given message.
If ARG is nil, all attachments will be saved in
`mu4e-attachment-dir'. When non-nil, user will be prompted to
choose a specific directory where to save all the files."
(interactive "P")
(when (and (eq major-mode 'mu4e-view-mode)
(derived-mode-p 'gnus-article-mode))
(let ((parts (mu4e--view-gather-mime-parts))
(handles '())
(files '())
(directory (if arg
(read-directory-name "Save to directory: ")
mu4e-attachment-dir)))
(dolist (part parts)
(let ((fname (or (cdr (assoc 'filename (assoc "attachment" (cdr part))))
(cl-loop for item in part
for name = (and (listp item) (assoc-default 'name item))
thereis (and (stringp name) name)))))
(when fname
(push `(,fname . ,(cdr part)) handles)
(push fname files))))
(if files
(cl-loop for (f . h) in handles
when (member f files)
do (mm-save-part-to-file
h (let ((file (expand-file-name f directory)))
(if (file-exists-p file)
(let (newname (count 1))
(while (and
(setq newname
(format "%s-%s%s"
(file-name-sans-extension file)
count
(file-name-extension file t)))
(file-exists-p newname))
(cl-incf count))
newname)
file))))
(mu4e-message "No attached files found")))))
(define-key mu4e-view-mode-map "X" #'ed/mu4e-view-save-all-attachments)
*** TODO [#B] Get queued email working with this msmtp feature
**** using sendmail
#+BEGIN_QUOTE
Queuing mails for sending it later
Mu4e supports a very nice feature which is mail queueing from smtpmail emacs client. To enable it, it requires two easy steps:
In ~/.emacs:
(setq
smtpmail-queue-mail t
smtpmail-queue-dir "~/Mail/queue/cur")
In your shell:
$ mu mkdir ~/Mail/queue
$ touch ~/Mail/queue/.noindex
Then, mu4e will be aware of the queueing, in the home screen of mu4e, you will be able to switch from queuing to direct sending by pressing m and flushing the queue by pressing f.
Note: there is a bug (not sure it’s really a bug). When sending a mail into the queue, if your mail contains special characters, you will be asked to send it raw or to add a header containing the encoding.
#+END_QUOTE
[[https://dataswamp.org/~solene/2018-05-22-mu4esmtp.html][Solene'% : Sending mail with mu4e]]
Captured On: [2024-04-13 Sat 05:23]
**** with msmtp
on archwiki: https://wiki.archlinux.org/title/msmtp#Using_msmtp_offline (read the whole page anyway)
also here: https://www.reddit.com/r/emacs/comments/q2gl5h/queuing_emails_and_sending_them_autmatically/
#+BEGIN_QUOTE
Using msmtp offline
Although msmtp is great, it requires that you be online to use it. This is not ideal for people on laptops with intermittent connections to the Internet or dialup users. Several scripts have been written to remedy this fact, collectively called msmtpqueue.
The scripts are installed under /usr/share/doc/msmtp/msmtpqueue. You might want to copy the scripts to a convenient location on your computer, (/usr/local/bin is a good choice).
Finally, change your MUA to use msmtp-enqueue.sh instead of msmtp when sending e-mail. By default, queued messages will be stored in ~/.msmtpqueue. To change this location, change the QUEUEDIR=$HOME/.msmtpqueue line in the scripts (or delete the line, and export the QUEUEDIR variable in .bash_profile like so: export QUEUEDIR="$XDG_DATA_HOME/msmtpqueue").
When you want to send any mail that you have created and queued up run:
$ /usr/local/bin/msmtp-runqueue.sh
Adding /usr/local/bin to your PATH can save you some keystrokes if you are doing it manually. The README file that comes with the scripts has some handy information, reading it is recommended.
#+END_QUOTE
[[https://wiki.archlinux.org/title/msmtp#Using_msmtp_offline][msmtp - ArchWiki]]
Captured On: [2024-04-13 Sat 09:35]
*** TODO [#B] Neither Feebleline nor Moodline Displays on Archsetup Fresh Install
*** TODO [#B] Move org-todo items into org-config use-package statement
*** TODO [#B] Separate org-agenda items into use-package statement
add after: org-roam for the function references
*** TODO [#C] Maybe Articles Should Be Saved Under todo.org TO READ Heading
*** TODO [#C] Remove all unnecessarily hardcoded filenames and paths
**** DONE Fix hardcoded in org-roam
(defconst roam-dir (concat sync-dir "roam/")
"The location of org-roam files.")
./modules/org-roam-config.el:16: (org-roam-directory "~/sync/org/roam/")
./modules/org-roam-config.el:27: ("v" "v2mom" plain (file "~/sync/org/roam/templates/v2mom.org")
./modules/org-roam-config.el:30: ("r" "recipe" plain (file "~/sync/org/roam/templates/recipe.org")
./modules/org-roam-config.el:33: ("p" "project" plain (file "~/sync/org/roam/templates/project.org")
./modules/org-roam-config.el:36: ("t" "topic" plain (file "~/sync/org/roam/templates/topic.org")
./modules/org-roam-config.el:116: (cj/org-roam-find-node "Topic" "t" "~/sync/org/roam/templates/topic.org"))
./modules/org-roam-config.el:121: (cj/org-roam-find-node "Recipe" "r" "~/sync/org/roam/templates/recipe.org"))
./modules/org-roam-config.el:126: (cj/org-roam-find-node "Project" "p" "~/sync/org/roam/templates/project.org"))
./modules/org-roam-config.el:146: :if-new (file+head+olp "~/sync/org/roam/inbox.org"
**** TODO Create constant for ~/.authinfo.gpg
./modules/ai-config.el:52: (setq auth-sources '((:source "~/.authinfo.gpg")))
./modules/epa-config.el:15: (setq auth-sources '("~/.authinfo.gpg")
**** TODO Use constants for search path in prog-general
./modules/prog-general.el:84: (projectile-project-search-path '("~/code"
./modules/prog-general.el:85: "~/projects"))
**** TODO Make initial go menu locations the constants
./modules/dirvish-config.el:55: '(("h" "~/" "home")
./modules/dirvish-config.el:58: ("co" "~/code" "code")
./modules/dirvish-config.el:59: ("df" "~/.dotfiles/" "dotfiles")
./modules/dirvish-config.el:60: ("dn" "~/downloads/" "downloads")
./modules/dirvish-config.el:61: ("dr" "~/sync/org/drill/" "org drill files")
./modules/dirvish-config.el:62: ("dt" "~/downloads/torrents/complete/" "torrents")
./modules/dirvish-config.el:63: ("dx" "~/documents/" "documents")
./modules/dirvish-config.el:64: ("gc" "~/code/golangcourse" "golang course")
./modules/dirvish-config.el:65: ("lt" "~/.local/share/Trash" "trash")
./modules/dirvish-config.el:66: ("mp" "~/sync/playlists/" "playlists")
./modules/dirvish-config.el:67: ("mv" "~/magic/video/" "magic/video")
./modules/dirvish-config.el:68: ("mx" "~/music/" "music")
./modules/dirvish-config.el:69: ("my" "~/magic/youtube/" "magic/youtube")
./modules/dirvish-config.el:70: ("or" "~/sync/org/" "sync")
./modules/dirvish-config.el:71: ("pl" "~/sync/playlists" "playlists")
./modules/dirvish-config.el:72: ("pr" "~/projects/" "projects")
./modules/dirvish-config.el:73: ("ps" "~/pictures/screenshots/" "screenshots")
./modules/dirvish-config.el:74: ("pw" "~/pictures/wallpaper" "wallpaper")
./modules/dirvish-config.el:75: ("px" "~/pictures/" "pictures")
./modules/dirvish-config.el:76: ("tg" "~/sync/org/text.games" "text games")
./modules/dirvish-config.el:77: ("vx" "~/videos/" "videos")))
**** TODO mu4e mail directory constant
./modules/mail-config.el:43: (setq mu4e-root-maildir "~/.mail") ;; root directory for all email accounts
./modules/mail-config.el:207:;; (setq smtpmail-queue-dir "~/.mail/queued-mail/"))
**** TODO create videos constant
./modules/elfeed-config.el:129: (let ((default-directory "~/videos"))
**** full ripgrep results searching for "~/"
./modules/org-roam-config.el:16: (org-roam-directory "~/sync/org/roam/")
./modules/org-roam-config.el:27: ("v" "v2mom" plain (file "~/sync/org/roam/templates/v2mom.org")
./modules/org-roam-config.el:30: ("r" "recipe" plain (file "~/sync/org/roam/templates/recipe.org")
./modules/org-roam-config.el:33: ("p" "project" plain (file "~/sync/org/roam/templates/project.org")
./modules/org-roam-config.el:36: ("t" "topic" plain (file "~/sync/org/roam/templates/topic.org")
./modules/org-roam-config.el:116: (cj/org-roam-find-node "Topic" "t" "~/sync/org/roam/templates/topic.org"))
./modules/org-roam-config.el:121: (cj/org-roam-find-node "Recipe" "r" "~/sync/org/roam/templates/recipe.org"))
./modules/org-roam-config.el:126: (cj/org-roam-find-node "Project" "p" "~/sync/org/roam/templates/project.org"))
./modules/org-roam-config.el:146: :if-new (file+head+olp "~/sync/org/roam/inbox.org"
./modules/modeline-config.el:14:(defvar feebleline-working-directory "~/code/feebleline"
./modules/epa-config.el:15: (setq auth-sources '("~/.authinfo.gpg"))
./modules/prog-general.el:84: (projectile-project-search-path '("~/code"
./modules/prog-general.el:85: "~/projects"))
./modules/prog-go.el:35: (add-to-list 'exec-path "~/go/bin")
./modules/dirvish-config.el:55: '(("h" "~/" "home")
./modules/dirvish-config.el:58: ("co" "~/code" "code")
./modules/dirvish-config.el:59: ("df" "~/.dotfiles/" "dotfiles")
./modules/dirvish-config.el:60: ("dn" "~/downloads/" "downloads")
./modules/dirvish-config.el:61: ("dr" "~/sync/org/drill/" "org drill files")
./modules/dirvish-config.el:62: ("dt" "~/downloads/torrents/complete/" "torrents")
./modules/dirvish-config.el:63: ("dx" "~/documents/" "documents")
./modules/dirvish-config.el:64: ("gc" "~/code/golangcourse" "golang course")
./modules/dirvish-config.el:65: ("lt" "~/.local/share/Trash" "trash")
./modules/dirvish-config.el:66: ("mp" "~/sync/playlists/" "playlists")
./modules/dirvish-config.el:67: ("mv" "~/magic/video/" "magic/video")
./modules/dirvish-config.el:68: ("mx" "~/music/" "music")
./modules/dirvish-config.el:69: ("my" "~/magic/youtube/" "magic/youtube")
./modules/dirvish-config.el:70: ("or" "~/sync/org/" "sync")
./modules/dirvish-config.el:71: ("pl" "~/sync/playlists" "playlists")
./modules/dirvish-config.el:72: ("pr" "~/projects/" "projects")
./modules/dirvish-config.el:73: ("ps" "~/pictures/screenshots/" "screenshots")
./modules/dirvish-config.el:74: ("pw" "~/pictures/wallpaper" "wallpaper")
./modules/dirvish-config.el:75: ("px" "~/pictures/" "pictures")
./modules/dirvish-config.el:76: ("tg" "~/sync/org/text.games" "text games")
./modules/dirvish-config.el:77: ("vx" "~/videos/" "videos")))
./modules/ai-config.el:52: (setq auth-sources '((:source "~/.authinfo.gpg")))
./modules/eww-config.el:24: (setq url-cookie-file "~/.local/share/cookies.txt")
./modules/prog-training.el:25: (setq leetcode-directory "~/code/leetcode")
./modules/games-config.el:27: (setq malyon-stories-directory "~/sync/org/text.games/"))
./modules/prog-lisp.el:24:;; (load (expand-file-name "~/quicklisp/slime-helper.el"))
./modules/mail-config.el:43: (setq mu4e-root-maildir "~/.mail") ;; root directory for all email accounts
./modules/mail-config.el:195: ;; (setq smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg"))
./modules/mail-config.el:207:;; (setq smtpmail-queue-dir "~/.mail/queued-mail/"))
./modules/calibredb-epub-config.el:27: (setq calibredb-root-dir "~/sync/books/")
./modules/calibredb-epub-config.el:28: (setq calibredb-library-alist '(("~/sync/books/")))
./modules/elfeed-config.el:129: (let ((default-directory "~/videos"))
*** [#D] Resolved v0.7 Fit and Finish Work [16/16]
**** DONE [#C] Theme Doesn't Fallback on Wombat Correctly if No Theme Persist File
**** DONE [#A] Remove Keys
CLOSED: [2024-04-07 Sun 13:46]
***** Remove OpenAPI Key From ai-config.el
****** 2024-04-07 Sun @ 13:21:22 -0500 Issue in ai-config.el
;; BUG: .authinfo.gpg not accessed for this key
***** Purge History to Remove Historical Issues
Do this after other secrets are removed
****** Google OAuth file in assets
******* 2024-04-07 Sun @ 13:23:51 -0500 This One's in History. Fix by Purging History
****** OpenAPI Key in help-utils.el
******* 2024-04-07 Sun @ 13:19:10 -0500 Need to Erase History
Originally, I thought this was a duplicate use-package declaration.
Now it appears this is in history. I can simply:
- force delete the .git file
- recommit everything
- force push back to github and git.cjennings.net
- check the security section again to ensure it's gone.
****** Google OAuth Client ID and Client Secret in org-agenda-config.el
**** DONE [#A] S-<right> is Undefined Error in Org Mode
CLOSED: [2024-04-08 Mon 21:30]
(should be org-agenda-todo-nextset)
***** 2024-04-07 Sun @ 11:48:44 -0500 it's simply undefined in org-mode
Looks like I just added it to org-agenda-mode?
**** DONE [#A] Error When Starting org-drill in cj/org-drill-start
CLOSED: [2024-04-10 Wed 16:50]
let: Symbol’s function definition is void: org-drill
**** DONE [#B] Saving an Event for Today and Today's Calendar Doesn't Show the Event
Fix was to include schedule-file alongside inbox in cj/build-org-agenda-list ()
***** 2024-04-11 Thu @ 01:48:07 -0500 Observation
Relaunching Emacs doesn't matter. Is the schedule file included in the agenda targets?
***** 2024-04-11 Thu @ 01:28:15 -0500 Reproduction
- C-c c to bring up the capture templates
- Select 'e' for event
- Enter an event for the same day, then choose some time in the future (11:00pm)
- Once completed, select f8
Actual Behavior: Agenda shows and event isn't listed.
Expected Behavior: Agenda shows with no events.
I checked the schedule file and the event was properly entered.
Tested on a fresh archsetup, but replicates on current laptop.
**** DONE [#B] Rename cj/kill-buffers
CLOSED: [2024-04-04 Thu 19:17]
**** DONE [#B] cj/kill-buffers Doesn't Select Current Buffer in Completing Read by Default
CLOSED: [2024-04-04 Thu 19:17]
**** DONE [#B] cj/kill-buffers Should Allow Adding to Invincible-buffers With C-u Prefix
CLOSED: [2024-04-04 Thu 19:33]
**** DONE [#B] Mu4e Reply All Should Be Default
CLOSED: [2024-04-04 Thu 20:45]
make 'r' reply-all (or wide reply) and 'R' reply
no need to remove 'W' (for wide reply)
***** 2024-04-04 Thu @ 20:36:56 -0500 Solution Tested to Be Working
Need to adjust 'mu4e-view-mode'. Within that mode:
- the reply method is named "mu4e-compose-reply"
- the reply-all method is named "mu4e-compose-wide-reply"
There doesn't seem to be anything already mapped to "R", so adding the following should enable these changes.
#+begin_src emacs-lisp
(:map mu4e-view-mode-map
("r" . mu4e-compose-wide-reply)
("R" . mu4e-compose-reply))
#+end_src
Tested both keys on a mail that had many recipients and it behaved in the way I expected.
**** DONE [#B] Hyphenating Whitespace Should Leave Point Where It Started
CLOSED: [2024-04-04 Thu 22:07]
**** DONE [#B] Kill All Windows Also Kills Invisible Buffers
CLOSED: [2024-04-08 Mon 16:14]
**** DONE [#B] Dictionary Doesn't Work Via C-h d
CLOSED: [2024-04-08 Mon 20:00]
***** 2024-04-08 Mon @ 19:23:13 -0500 There's a Package on Melpa
https://melpa.org/#/sdcv
Also, it mentioned I needed stardict. I installed it, but it didn't change the error
***** 2024-04-08 Mon @ 19:23:01 -0500 Issue
Tried to look up agency and the dictionary failed.
Found 1 items, similar to agency.
-->Webster's Revised Unabridged Dictionary (1913)
===
Above this section the text is displayed.
When copying and pasting the text, the rest of the text is displayed below
===
Found 1 items, similar to agency.
-->Webster's Revised Unabridged Dictionary (1913)
-->Agency
Agency \A"gen*cy\, n.; pl. {Agencies}. [agentia, fr. L. agens,
agentis: cf. F. agence. See {Agent}.]
1. The faculty of acting or of exerting power; the state of
being in action; action; instrumentality.
The superintendence and agency of Providence in the
natural world. --Woodward.
2. The office of an agent, or factor; the relation between a
principal and his agent; business of one intrusted with
the concerns of another.
3. The place of business of am agent.
Syn: Action; operation; efficiency; management.
This was from cut and paste, the actual text didn't show.
**** DONE [#B] Fresh Install: Error When No Macros File Found
CLOSED: [2024-04-11 Thu 01:11]
default location: ~/sync/org/macros.el
**** DONE [#B] Mu4e Doesn't Launch Properly on Fresh Archinstall
CLOSED: [2024-04-11 Thu 01:18]
Error was something about the mu server exiting.
***** DONE Setup Virtualbox Testing
CLOSED: [2024-04-11 Thu 01:18]
****** DONE Create ArchBase and AqrchSetup Images
CLOSED: [2024-04-07 Sun 13:48]
****** DONE Run Archsetup in ArchSetup Image
CLOSED: [2024-04-10 Wed 19:11]
****** DONE Run Mu4e Install Found in ~/.emacs.d/scripts/
CLOSED: [2024-04-11 Thu 01:17]
****** DONE Snapshot the Image
CLOSED: [2024-04-11 Thu 01:18]
**** DONE [#C] Move Non Init Visible Files in Emacs Config Root to Assets
CLOSED: [2024-04-07 Sun 14:21]
***** 2024-04-07 Sun @ 14:07:56 -0500 files to move
abbrev_defs
elfeed-dashboard
**** DONE [#C] Ripgrep Should Finish with Point on Results Buffer
CLOSED: [2024-04-08 Mon 16:14]
**** DONE [#C] Dashboard Icons Aren't Correct or Sized Correctly on Fractal
CLOSED: [2024-04-10 Wed 17:16]
**** DONE [#A] Fix Incorrect Refile Targets After Launch
CLOSED: [2024-04-11 Thu 03:21]
**** DONE [#B] Emacs fails to open .scratch file
CLOSED: [2024-04-11 Thu 09:15]
I don't like peristent scratch as it defeats the purpose and has failed several times so far.
I should remove it.
** DOING Complete v0.7 Release Checklist [8/11]
*** DOING 2 Week Fit and Finish (ends 2024.04.18)
*** TODO Clean Launch from Archsetup
*** TODO Close Release and Create Tag on Repo
*** DONE No Open Work
*** DONE WIP Code Empty/Disabled
*** DONE Emacs Config Inbox Zero
*** DONE Perf Testing: Sub-Second Launch Time
*** DONE Security Check for Keys
*** DONE Clean Launch from Git Clone
*** DONE Merged Cleanly Into Main Branch
*** DONE Main Branch Pushed to github and git.cjennings.net
* Emacs Config v0.8
** TODO Hugo Blogging Workflow
*** 2024-04-04 Thu @ 16:44:40 -0500 Thoughts on Functionality
The whole blogging workflow should happen in Emacs.
- Capturing ideas for what to post
- Working on multiple drafts at once
- Listing all drafts
- Checking into main should update website
- Checking into any other branch name should not update website
** TODO Mu4e Mail Improvements
*** TODO Mail Attachment Adding and Saving All
**** 2024-04-04 Thu @ 21:32:28 -0500 Reminder to Tie Save All With Save
In order to make the mu4e save attachment feel natural, save and save all shouldn't be so separate.
Currently (e) for extract saves an attachment, but just gives you a prompt and colon in the minibuffer.
When choosing save an attachment:
- if mail contains more than one attachment, select one in completing read
- choose the directory
When choosing to save all attachments:
- choose the directory
with a prefix to the method, you would be opening the directory in dired or dirvish.
**** 2024-04-04 Thu @ 13:31:08 -0500 Research
***** Save All Attachments With Vertico and Embark
https://www.reddit.com/r/emacs/comments/p7gvf9/mu4e_how_best_to_save_large_numbers_of/
It's pretty easy if you use vertico+embark. After running mu4e-view-save-attachments, invoke embark-act-all in the completion menu followed by RET (mu4e-view-save-attachments) to save all attachments, or TAB (vertico-insert) followed by , (comma) next to each file you want to save, then RET (vertico-exit), to save selected attachments.
***** Adding Multiple Attachments Using Dired
https://www.reddit.com/r/emacs/comments/nqhyos/how_to_do_mu4e_attachments/
Hi, thanks for responding. I am in a situation similar to : https://emacs.stackexchange.com/questions/14652/attach-multiple-files-from-the-same-directory-to-an-email-message . I would love the possibility of marking multiple files in multiple folders and attaching them all at once.
- xenodium
An option here is to open a dired buffer, mark the files you want, and invoke gnus-dired-attach (I use it with mu4e). It should ask you if you want to attach them all to your mail composition buffer.
- [deleted]
Brilliant! Now I just have to define two keybindings. First one to a lambda which can open a dired buffer with turn-on-gnus-dired-mode, and then another one within the keymap to this mode to run gnus-dired-attach. All this, to avoid a couple of M-x commands, because I feel smart when I use keybindings... =.="
- xenodium
First one to a lambda which can open a dired buffer with turn-on-gnus-dired-mode
If you don't mind keeping the mode on for all dired buffers, this should be enough:
(use-package gnus-dired
:hook (dired-mode . turn-on-gnus-dired-mode))
You have the benefit of launching dired the same way you launch it for any other purpose (ie. easier to remember). No special binding.
***** Deprecated Save All Function
https://gist.github.com/philjackson/aecfab1706f05079aec7000e328fd183
***** [#B] djcbsoftware.dl on attaching via dired
https://www.djcbsoftware.nl/code/mu/mu4e/Dired.html
13.9 Dired
It is possible to attach files to mu4e messages using dired (emacs), using the following steps (based on a post on the mu-discuss mailing list by Stephen Eglen).
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
Then, mark the file(s) in dired you would like to attach and press C-c RET C-a, and you’ll be asked whether to attach them to an existing message, or create a new one.
***** [#B] djcbsoftware.dl on saving and comleting-all attachments
Note: on hitting "e", then C-c C-a, it currently saves all attachments to the home directory. There's likely some directory setting I can use to choose a directory first (creating it if necessary).
https://www.djcbsoftware.nl/code/mu/mu4e/MSGV-Attachments-and-MIME_002dparts.html
5.4 Attachments and MIME-parts
E-mail messages can be though as a series of “MIME-parts”, which are sections of the message. The most prominent is the ’body’, that is the main message your are reading. Many e-mail messages also contains attachments, which MIME-parts that contain files10.
To save such attachments as files on your file systems, the mu4e message-view offers the command mu4e-view-save-attachments; default keybinding is e (think extract). After invoking the command, you can enter the file names to save, comma-separated, and using the completion support. Press RET to save the chosen files to your file-system.
With a prefix argument, you get to choose the target-directory, otherwise, mu4e determines it following the variable mu4e-attachment-dir (which can be file-system path or a function; see its docstring for details.
While completing, mu4e-view-completion-minor-mode is active, which offers mu4e-view-complete-all (bound to C-c C-a to complete all files11.
*** TODO Org Contacts Integrated with Mu4e
*** TODO Visit and Cancel Messages Not-yet-sent
*** TODO Mail Queueing On By Default
*** TODO Periodic Mail Fetch When Online
*** TODO GPG Signed Emails
*** 2024-04-04 Thu @ 16:47:12 -0500 Goals
Not all email workflows are working (attachments, for instance).
There are also some major longstanding bugs (not-yet-sent messages location)
** TODO Calendaring Solution
*** TODO [#B] Get Org Gcal Working
*** 2024-04-04 Thu @ 16:51:25 -0500 Current Requirements
I'm starting from scratch, but here are my (currently simple) requirements
- Download events from online calendar and include them in my agenda.
- CRUD events in Emacs easy w/ propagation to online calendar
Agenda should be starting point, but it doesn't have to work from the Agenda pages.
And yes, this means I also need to find and host an online calendar that sync's with an Android app.
** TODO Ledger Workflow
** TODO Miscellaneous Work
*** TODO Fix Show Kill Ring
*** TODO Consider the Flyspell Correct Ivy Interface for spelling
#+BEGIN_QUOTE
flyspell-correct-ivy interface
In order to use flyspell-correct-ivy interface you have to install flyspell-correct-ivy package in any preferred way and then add following snippet to relevant part of your init.el file.
(require 'flyspell-correct-ivy)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)
Or via use-package.
(use-package flyspell-correct
:after flyspell
:bind (:map flyspell-mode-map ("C-;" . flyspell-correct-wrapper)))
(use-package flyspell-correct-ivy
:after flyspell-correct)
If you do not want any binding, just replace :bind (:map
flyspell-mode-map ("C-;" . flyspell-correct-wrapper)) with :defer t to use lazy loading.
Note that in order to access actions in ivy interface you need to press M-o. More on ivy mini buffer key bindings you can read in official documentation.
#+END_QUOTE
[[https://github.com/d12frosted/flyspell-correct?tab=readme-ov-file#screenshots][d12frosted/flyspell-correct: Distraction-free words correction with flyspell via selected interface.]]
Captured On: [2024-04-05 Fri 13:49]
*** TODO Consider Actively Developed Awesome Tray Instead of Unsupported Feebleline
[[https://github.com/manateelazycat/awesome-tray?tab=readme-ov-file][manateelazycat/awesome-tray: Hide mode-line, display necessary information at right of minibuffer.]]
Captured On: [2024-04-06 Sat 11:09]
** TODO Emacs Config v0.8 Bug Fixes
*** TODO [#C] Check if Including Dired Buffers in Autorevert-mode Slows Tramp
*** TODO [#B] Test Emacs in a Terminal
The number and complexity of bugs will tell me whether terminal Emacs is supported in this tag.
** TODO Emacs Config v0.8 Release Checklist
(add latest release checklist here)
* Emacs Config v0.9
** TODO VC Installs from Github
** TODO Prog Go Workflow
** TODO Prog Python Workflow
** TODO Emacs Config v0.9 Release Checklist [0/9]
- [ ] No Open Work
- [ ] WIP Code Empty/Disabled
- [ ] Empty Emacs Config Inbox of Issues
- [ ] Keep Sub-Second Launch Time
- [ ] Successful Launch from Git Clone
- [ ] Merged cleanly into main branch
- [ ] Main Branch Pushed to github and git.cjennings.net
- [ ] 2 Weeks of Use and Bug Fixing
- [ ] Mark Release as DONE and Create Tag on Repo
* Emacs Config v0.10
** TODO Complete "Localrepo" Functionality
*** 2024-04-04 Thu @ 21:11:04 -0500 Considering Renaming "Localrepo"
I worry that "localrepo" will be confused with elpa-mirrors, both local and remote.
Also, I've named it what it is (it's local and a repo), not after its purpose.
Naming it something like "last-known-good-packages" or "failsafe-packages" would:
- avoid the confusion with elpa mirrors
- avoid the confusion with version control repositories
- make users hesitate before deleting the directory
- make users understand it's purpose (and therefore it's importance)
Candidate Names:
- Last Known Good Pkgs
- Failsafe Pkgs
- Fallback Pkgs
ChatGPT 4 came up with these names:
- SafetyNetPkgs
- StableVaultPkgs
- TrustedBackupPkgs
- SecureStandbyPkgs
- BestCasePkgs
- BufferZonePkgs
- RevertReadyPkgs
- SafeHarborPkgs
- PackagePreserve
- PkgSafeguard
- StableShieldPkgs
- PreparedPkgs
- PkgLifeboat
- BackupStashPkgs
- AssuredAssetsPkgs
- PkgPantry
- RobustRepoPkgs
- SafeSettlePkgs
- ArchiveAnchorage
- PkgFortress
- DependableDepotPkgs
- ReliableReservePkgs
- HealthyHavenPkgs
- PkgBunker
- SolidStorePkgs
- BulletproofBackupPkgs
- PkgPlaza
- SafeStoragePkgs
- PkgCitadel
- RescueRepoPkgs
- ImmutableInstallPkgs
- FortifiedFilesPkgs
- ReviveReadyPkgs
- PackagePillar
- PlatinumPkgs
The word "trusted" resonates with me, of course.
*** 2024-04-04 Thu @ 20:59:43 -0500 Thoughts on Feature Set
Functionality worth considering:
**** update an installed package and update localrepo
(package-and-localrepo-upgrade)
though this one may not be desirable since the idea is to test packages by installing and using them first.
**** update all installed packages and update localrepo
(package-and-localrepo-upgrade-all)
though this one may not be desirable since the idea is to test packages by installing and using them first.
**** diff localrepo packages from the packages currently installed
**** revert package to localrepo version
this would amount to:
- narrowing the package archives to localrepo
- diffing localrepo and elpa to identify upgraded packages
- showing all upgrading packages in completing read
- uninstalling the selected package
- reinstalling the selected package from localrepo
- restarting emacs
**** revert all packages to localrepo version
this would amount to:
- narrowing the package archives to localrepo
- diffing localrepo and elpa to identify upgraded packages
- showing all upgraded packages to confirm
- uninstalling the upgraded packages
- reinstalling the upgraded packages from localrepo
- restarting emacs
**** can you use git to save versions of these packages?
** TODO Prog C Workflow
** TODO Emacs Config v0.10 Release Checklist [0/9]
- [ ] No Open Work
- [ ] WIP Code Empty/Disabled
- [ ] Empty Emacs Config Inbox of Issues
- [ ] Keep Sub-Second Launch Time
- [ ] Successful Launch from Git Clone
- [ ] Merged cleanly into main branch
- [ ] Main Branch Pushed to github and git.cjennings.net
- [ ] 2 Weeks of Use and Bug Fixing
- [ ] Mark Release as DONE and Create Tag on Repo
* Emacs Config Backlog Categories
** Emacs AI Backlog
*** TODO GPT Discussion on package compilation and first run
#+BEGIN_QUOTE
is there a way to tell using emacs-lisp whether Emacs has been launched for the first time (i.e., it's installed new packages)?
There's no direct method to detect if Emacs has been launched for the first time using Emacs Lisp. However, you can use a workaround: create a sentinel file when you first launch Emacs, then check for the existence of this file when Emacs starts.
Here is an example that writes a file =.firstrun= in the =user-emacs-directory= the first time Emacs is run:
#+begin_src elisp
(let ((sentinel (expand-file-name ".firstrun" user-emacs-directory)))
(if (file-exists-p sentinel)
(message "Not the first run of Emacs.")
(message "First run of Emacs.")
(with-temp-buffer (write-file sentinel))))
#+end_src
Then based on the message, you can make decisions (like installing new packages).Note that this only works if Emacs can write to =user-emacs-directory=, and it considers "first run" to be "first run since the sentinel file was created".
You might want to put such code in your init file so it's run every time Emacs starts.
***** Is there a way to tell using emacs-lisp whether packages are done compiling?
Emacs does not offer a built-in functionality to directly detect when package compilation is complete. However, you can create a workaround where you use a hook that gets triggered when Emacs is idle, meaning that it's done with all immediate tasks (including potentially compiling packages).
Here is an example how to use =idle-timer=:
#+begin_src elisp
(run-with-idle-timer
5 ;; idle time in seconds
nil ;; repeat? (t or nil)
(lambda ()
;; your code to be executed when Emacs is idle
(message "Emacs is now idle (finished compiling packages).")))
#+end_src
#+END_QUOTE
[[][]]
Captured On: [2024-04-08 Mon 12:29]
** Emacs Browser Config Backlog [0/3]
*** TODO Toggle Opening Links between External or Internal Browser Emacs-Wide
**** 2023-07-29 @ 10:46:04 -0500 Code that seemed to work
(defun my-eww-open-in-external-browser ()
"Open the link at point in an external browser."
(interactive)
(let* ((url (eww-current-url))
(browse-url-browser-function 'browse-url-default-browser))
(when url
(browse-url url))))
(define-key eww-link-keymap (kbd "RET") 'my-eww-open-in-external-browser)
```
This revised code sets the `browse-url-browser-function` to `browse-url-default-browser`, which ensures that the URL is opened in the system's default external browser. It then opens the URL at point using `browse-url`. By binding the `RET` key to `my-eww-open-in-external-browser` in the `eww-link-keymap`, you should be able to open the link in an external browser.
==================
To toggle the ability to open links in an external browser in EWW, you can use the following Emacs Lisp code:
```emacs-lisp
(defvar my-eww-open-in-external-browser t
"Toggle variable for opening links in an external browser in EWW.")
(defun my-eww-toggle-open-in-external-browser ()
"Toggle opening links in an external browser in EWW."
(interactive)
(setq my-eww-open-in-external-browser (not my-eww-open-in-external-browser))
(if my-eww-open-in-external-browser
(message "Links will now open in an external browser.")
(message "Links will no longer open in an external browser.")))
(defun my-eww-open-in-external-browser ()
"Open the link at point in an external browser."
(interactive)
(when my-eww-open-in-external-browser
(let* ((url (eww-current-url))
(browse-url-browser-function 'browse-url-default-browser))
(when url
(browse-url url)))))
(define-key eww-link-keymap (kbd "RET") 'my-eww-open-in-external-browser)
```
**** 2023-07-28 @ 10:06:17 -0500 playing with some ideas
first attempts are in (user-emacs-directory)/modules/browser-toggle.el
*** STALLED Working with the XWidget Webkit Browser
**** 2024-04-03 Wed @ 15:23:54 -0500 XWidget Webkit no longer able to be built
**** Original Goal
[[https://emacsnotes.wordpress.com/2018/08/18/why-a-minimal-browser-when-there-is-a-full-featured-one-introducingxwidget-webkit-a-state-of-the-art-browser-for-your-modern-emacs/][Why a minimal browser, when there is a full-featured one? Introducing`XWidget Webkit`: A state-of-the-art browser for your modern Emacs – Emacs Notes]]
Captured On: [2023-11-02 Thu 11:44]
*** TODO Investigage shrface
[[https://github.com/chenyanming/shrface][chenyanming/shrface: Extend eww/nov with org-mode features, archive web pages to org files with shr.]]
Captured On: [2024-04-05 Fri 16:14]
*** TODO Mu4e Open a Url in a Firefox Private Window
#+BEGIN_QUOTE
Open an URL in a Firefox private window
Sometime, I want to open an external link in a private window of Firefox. I will reuse here my function ed/cleanup-url
(defun ed/mu4e-view-go-to-private-url (&optional multi)
"Offer to go to url(s) in a private window of Firefox.
If MULTI (prefix-argument) is nil, go to a single one, otherwise,
offer to go to a range of urls."
(interactive "P")
(mu4e~view-handle-urls
"URL to visit" multi
(lambda (url)
(start-process
"private-firefox" nil
"firefox" "--private-window" (ed/cleanup-url url)))))
(define-key mu4e-view-mode-map "G" #'ed/mu4e-view-go-to-private-url)
#+END_QUOTE
[[https://etienne.depar.is/emacs.d/mu4e.html][Mu4e customization]]
Captured On: [2024-04-13 Sat 04:55]
*** TODO Consider uses for shrface Emacs web browsing package
[[https://github.com/chenyanming/shrface][chenyanming/shrface: Extend eww/nov with org-mode features, archive web pages to org files with shr.]]
Captured On: [2024-04-11 Thu 15:57]
** Emacs Calibre / Epub Backlog [0/3]
*** TODO Investigate Visual Fill Column for Ebooks
[[https://melpa.org/#/visual-fill-column][visual-fill-column - MELPA]]
Captured On: [2023-07-31 Mon 17:32]
*** TODO Maybe Virtual Auto Fill for Ebooks?
[[https://github.com/luisgerhorst/virtual-auto-fill/tree/a3991ce02d9a6a1624a3f04da80f4ac966a44092][luisgerhorst/virtual-auto-fill at a3991ce02d9a6a1624a3f04da80f4ac966a44092]]
Captured On: [2023-07-31 Mon 17:36]
*** TODO Pocket Reader to Epub Via Emacs
[[https://blog.dornea.nu/2021/08/15/howto-convert-pocket-reader-links-to-epub-and-upload-to-dropbox/][HowTo: Convert pocket reader links to Epub and upload to Dropbox - blog.dornea.nu]]
Captured On: [2023-10-21 Sat 08:43]
** Emacs Config Utilities Backlog [0/1]
*** TODO Test Emacs Config After Save
#+BEGIN_QUOTE
the Emacs Elements channel demonstrated emacs batch mode for checking your initialization. You can run something like
emacs -batch -l ~/.emacs.d/init.el
from a shell to start emacs, using the above initialization, and just immediately exit. If your configuration is bad, you'll see error messages about. And because it happens outside your existing emacs session, you can fix the errors inside emacs.
But naturally we want to try that right from within emacs:
(defun my-check-init-batch-mode ()
"Use batch mode to check my emacs initialization.
Inspired by https://www.youtube.com/watch?v=5Vume2SETNM."
(interactive)
(shell-command "emacs -batch -l ~/.emacs.d/init.el"))
That's nice because, for me at least, I get lots of warnings, and it's nice to have the shell output buffer to look through and fix things up.
I can confirm this works -- I added the above function to my config, ran it, then made a change from one of the warnings -- and made a typo in my lisp code, and fixed it right away. 🙂
#+END_QUOTE
[[https://emacs.stackexchange.com/questions/78945/run-check-parens-or-similar-when-saving-or-tangling-literate-configuration][org mode - run check-parens or similar when saving or tangling literate configuration? - Emacs Stack Exchange]]
Captured On: [2023-11-18 Sat 08:10]
** Emacs Dashboard Backlog [0/1]
*** TODO Cookie 1 for Fortune Like Emacs Tips
#+BEGIN_QUOTE
It looks like cookie1.el is what I want: just point it to your file with
(setq cookie-file "~/.emacs.d/emacs_tips.txt")
or by customizing the variable. The format of the file is pretty simple -- it seems that the tips/quotes/fortunes are separated by lines with just % or %%:
%
Fortune cookie / emacs tip #1. Somehow this never shows up. *shrug*
%
Try M-r for moving point around the window without moving the text.
%
M-@ marks a word, use it repeatedly to mark more words.
With a negative prefix arg, go backwards. Nice when combined with C-x C-x.
%
A numeric prefix argument X with M-< will move point to X% in the
buffer. (Same thing with M-> moves to X% from the end.)
%
(Somehow the first entry is ignored; I tried some variations but it never showed up.)
Then show one of those entries with M-x cookie.
Above are the first few things I have. I plan to troll through the weekly tips and tricks threads and see what I find.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/17nvwnd/comment/k7xny8r/?utm_source=share&utm_medium=web2x&context=3][(2) emacs package or command to show a "tip/trick of the day"? : emacs]]
Captured On: [2023-11-18 Sat 07:28]
** Emacs Dirvish Backlog [0/3]
*** TODO Add Find-dired (or Fd-dired) to Emacs
[[https://www.masteringemacs.org/article/working-multiple-files-dired][Working with multiple files in dired - Mastering Emacs]]
Captured On: [2023-07-31 Mon 16:36]
*** TODO Enable/Disable Highlight Changes Mode When Entering/Exiting Wdired-mode
#+BEGIN_QUOTE
Excellent idea, here's how you enable and disable highlight-changes-mode automatically when entering and exiting wdired-mode:
(defvar my/wdired-before-finish-editing-hook nil)
(defun my/wdired-before-finish-editing-run-hook (&rest _)
(run-hooks 'my/wdired-before-finish-editing-hook))
(advice-add #'wdired-finish-edit :before #'my/wdired-before-finish-editing-run-hook)
(advice-add #'wdired-abort-changes :before #'my/wdired-before-finish-editing-run-hook)
(add-hook 'wdired-mode-hook (defun my/lambda-1693716265 ()
(highlight-changes-mode 1)))
(add-hook 'my/wdired-before-finish-editing-hook (defun my/lambda-1693716255 ()
(highlight-changes-mode -1)))
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/1658md9/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 08:06]
*** TODO Dired Config with Sorting
#+BEGIN_QUOTE
(use-package dired
:bind (
:map dired-mode-map
("C-a" . my/dired-move-beginning-of-line)
("k" . dired-do-delete)
("D" . nil)
("s" . cc/dired-sort-by))
:hook (dired-mode . dired-hide-details-mode)
:init
(progn
(setq dired-auto-revert-buffer t)
(setq dired-dwim-target t)
(setq dired-listing-switches "-alh")
(setq dired-recursive-deletes 'always)
(setq dired-mouse-drag-files t)
(defun my/dired-move-beginning-of-line ()
(interactive)
(let ((point (point)))
(dired-move-to-filename)
(when (= point (point))
(move-beginning-of-line nil)))))
:config
(progn
;; http://yummymelon.com/devnull/enhancing-dired-sorting-with-transient.html
(defun cc/--dired-sort-by (criteria &optional prefix-args)
"Sort current Dired buffer according to CRITERIA and PREFIX-ARGS.
This function will invoke `dired-sort-other' with arguments built from
CRITERIA and PREFIX-ARGS.
CRITERIA is a keyword of which the following are supported:
:name :date-added :version
:kind :date-metadata-changed :size
:date-last-opened :date-modified
PREFIX-ARGS is a list of GNU ls arguments. If nil, then it will use the value
of `cc-dired-listing-switches'. Otherwise this is typically populated by the
Transient menu `cc/dired-sort-by'.
This function requires GNU ls from coreutils installed.
See the man page `ls(1)' for details."
(let ((arg-list (list "-l")))
(if prefix-args
(nconc arg-list prefix-args)
(nconc arg-list cc-dired-listing-switches))
(cond
((eq criteria :name)
(message "Sorted by name"))
((eq criteria :kind)
(message "Sorted by kind")
(push "--sort=extension" arg-list))
((eq criteria :date-last-opened)
(message "Sorted by date last opened")
(push "--sort=time" arg-list)
(push "--time=access" arg-list))
((eq criteria :date-added)
(message "Sorted by date added")
(push "--sort=time" arg-list)
(push "--time=creation" arg-list))
((eq criteria :date-modified)
(message "Sorted by date modified")
(push "--sort=time" arg-list)
(push "--time=modification" arg-list))
((eq criteria :date-metadata-changed)
(message "Sorted by date metadata changed")
(push "--sort=time" arg-list)
(push "--time=status" arg-list))
((eq criteria :version)
(message "Sorted by version")
(push "--sort=version" arg-list))
((eq criteria :size)
(message "Sorted by size")
(push "-S" arg-list))
(t
(message "Default sorted by name")))
(dired-sort-other (mapconcat 'identity arg-list " "))))
(require 'transient)
(transient-define-prefix cc/dired-sort-by ()
"Transient menu to sort Dired buffer by different criteria.
This function requires GNU ls from coreutils installed."
:value '("--human-readable"
"--group-directories-first"
"--time-style=long-iso")
; TODO: support cc-dired-listing-switches
[["Arguments"
("-a" "all" "--all")
("g" "group directories first" "--group-directories-first")
("-r" "reverse" "--reverse")
("-h" "human readable" "--human-readable")
("t" "time style" "--time-style="
:choices ("full-iso" "long-iso" "iso" "locale"))]
["Sort By"
("n"
"Name"
(lambda () (interactive)
(cc/--dired-sort-by :name
(transient-args transient-current-command)))
:transient nil)
("k"
"Kind"
(lambda () (interactive)
(cc/--dired-sort-by :kind
(transient-args transient-current-command)))
:transient nil)
("l"
"Date Last Opened"
(lambda () (interactive)
(cc/--dired-sort-by :date-last-opened
(transient-args transient-current-command)))
:transient nil)
("a"
"Date Added"
(lambda () (interactive)
(cc/--dired-sort-by :date-added
(transient-args transient-current-command)))
:transient nil)
("m"
"Date Modified"
(lambda () (interactive)
(cc/--dired-sort-by :date-modified
(transient-args transient-current-command)))
:transient nil)
("M"
"Date Metadata Changed"
(lambda () (interactive)
(cc/--dired-sort-by :date-metadata-changed
(transient-args transient-current-command)))
:transient nil)
("v"
"Version"
(lambda () (interactive)
(cc/--dired-sort-by :version
(transient-args transient-current-command)))
:transient nil)
("s"
"Size"
(lambda () (interactive)
(cc/--dired-sort-by :size
(transient-args transient-current-command)))
:transient nil)]])))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 15:15]
*** Use Dired as the Default Desktop File Manager #2
#+BEGIN_QUOTE
This is how to make emacs as default file manager in ubuntu.
First we have to write a script which will act as our file manager.
#!/usr/bin/env python
import os
import sys
def main():
if len(sys.argv) > 1:
dirname = sys.argv[1]
else:
dirname = '~'
os.system('emacs --eval \'(dired "{}")\'%'.format(dirname))
# you can use emacsclient if you are running emacs server
if __name__ == "__main__":
main()
Save this as emacsfm in /usr/bin/. Now in terminal instead of using nautilus or nautilus /foo/bar, we can use emacsfm or emacsfm /foo/bar.
Now we need to set this as default file manager. Install exo-utils using
sudo apt-get install exo-utils
and run it
exo-preferred-applications
It opens a new window. Go to Utilities -> File manager -> Other and enter /usr/bin/emacsfm "%s" in it.
You can goto chrome downloads and if click show in folder it will open emacs dired :-)
#+END_QUOTE
[[https://emacs.stackexchange.com/questions/13927/how-to-set-emacs-as-the-default-file-manager][dired - How to set emacs as the default file manager? - Emacs Stack Exchange]]
Captured On: [2024-04-12 Fri 10:53]
*** Use Dired as the Default Desktop File Manager
#+BEGIN_QUOTE
Dependent on your desktop environment the method to set a default application may differ. That said, many desktop environments respect the associations in ~/.local/share/applications/mimeapps.list, where you can set up an association for the application/x-directory and/or inode/directory types.
My mimeapps.list looks like this now:
[Default Applications]
application/x-directory=emacs-dired.desktop
inode/directory=emacs-dired.desktop
In the same directory I have a file called emacs-dired.desktop with the following contents:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
NoDisplay=true
Exec=emacsclient --eval '(dired "%f")'
Name=Dired
Comment=Emacs Dired
When my long-lived instance of Emacs runs a server (M-x server-start) and I click on, say, the folder icon in the list of Downloads in Icecat a new dired buffer is opened.
This actually works for me now. Thanks for asking the question --- otherwise I would not have set this up.
#+END_QUOTE
[[https://emacs.stackexchange.com/questions/13927/how-to-set-emacs-as-the-default-file-manager][dired - How to set emacs as the default file manager? - Emacs Stack Exchange]]
Captured On: [2024-04-12 Fri 10:51]
*** TODO Read Good Reddit Thread on Dired
Figure out how to do 2 pane and different layouts
[[https://www.reddit.com/r/emacs/comments/je9oha/do_you_use_emacs_as_a_file_manager/][(1) Do you use Emacs as a file manager? : emacs]]
Captured On: [2024-04-12 Fri 11:46]
*** TODO Read Through Dired as Default File Manager and Implement Tips
[[https://truongtx.me/2013/04/24/dired-as-default-file-manager-1-introduction][Dired as Default File Manager - Introduction - TruongTX Blog]]
Captured On: [2024-04-12 Fri 10:56]
*** Recent History in Dired
#+BEGIN_QUOTE
(defun my-recent-directory (&optional n)
"Goto recent directories.
If N is not nil, only list directories in current project."
(interactive "P")
(unless recentf-mode (recentf-mode 1))
(let* ((cands (delete-dups
(append my-dired-directory-history
(mapcar 'file-name-directory recentf-list)
;; fasd history
(and (executable-find "fasd")
(nonempty-lines (shell-command-to-string "fasd -ld"))))))
(root-dir (if (ffip-project-root) (file-truename (ffip-project-root)))))
(when (and n root-dir)
(setq cands (delq nil (mapcar (lambda (f) (path-in-directory-p f root-dir)) cands))))
(dired (completing-read "Directories: " cands))))
#+END_QUOTE
[[https://github.com/redguardtoo/emacs.d/blob/02a5680d082375e6ef4c7c93bac2e19d2b2e66a8/lisp/init-ivy.el#L149][emacs.d/lisp/init-ivy.el at 02a5680d082375e6ef4c7c93bac2e19d2b2e66a8 · redguardtoo/emacs.d]]
Captured On: [2024-04-12 Fri 10:55]
** Emacs Ediff Backlog [0/2]
*** TODO Improve Ediff Configuration
#+BEGIN_QUOTE
I also found that ediff has numerous hooks over its functions and I try to make ediff a little handy over window operations. What I want is a window-configuration restore after ediff exits, so I will have window layout just as before ediff, also I want easily to restore ediff window layout after I break it (for example switch to other buffer in one of diffed window). So we get:
;; Some custom configuration to ediff
(defvar my-ediff-bwin-config nil "Window configuration before ediff.")
(defcustom my-ediff-bwin-reg ?b
"*Register to be set up to hold `my-ediff-bwin-config'
configuration.")
(defvar my-ediff-awin-config nil "Window configuration after ediff.")
(defcustom my-ediff-awin-reg ?e
"*Register to be used to hold `my-ediff-awin-config' window
configuration.")
(defun my-ediff-bsh ()
"Function to be called before any buffers or window setup for
ediff."
(setq my-ediff-bwin-config (current-window-configuration))
(when (characterp my-ediff-bwin-reg)
(set-register my-ediff-bwin-reg
(list my-ediff-bwin-config (point-marker)))))
(defun my-ediff-ash ()
"Function to be called after buffers and window setup for ediff."
(setq my-ediff-awin-config (current-window-configuration))
(when (characterp my-ediff-awin-reg)
(set-register my-ediff-awin-reg
(list my-ediff-awin-config (point-marker)))))
(defun my-ediff-qh ()
"Function to be called when ediff quits."
(when my-ediff-bwin-config
(set-window-configuration my-ediff-bwin-config)))
(add-hook 'ediff-before-setup-hook 'my-ediff-bsh)
(add-hook 'ediff-after-setup-windows-hook 'my-ediff-ash 'append)
(add-hook 'ediff-quit-hook 'my-ediff-qh)
This kind of configuration will do the following. WindowConfiguration before any ediff operations will be saved to a register defined in my-ediff-bwin-reg and window configuration after ediff complete on window layout will be saved to my-ediff-awin-reg, so in ediff mode you may restore the old window configuration by jumping to my-ediff-bwin-reg and jump back to ediff window configuration by jumping to my-ediff-awin-reg (see WindowConfiguration). After ediff quits, the old (before ediff) window configuration will be restored.
#+END_QUOTE
[[https://www.emacswiki.org/emacs/EdiffMode][EmacsWiki: Ediff Mode]]
Captured On: [2023-10-22 Sun 02:34]
*** TODO Ediff From the Command Line
#+BEGIN_QUOTE
From The Command Line
bojohan wrote on gnu.emacs.help:
(defun command-line-diff (switch)
(let ((file1 (pop command-line-args-left))
(file2 (pop command-line-args-left)))
(ediff file1 file2)))
(add-to-list 'command-switch-alist '("diff" . command-line-diff))
;; Usage: emacs -diff file1 file2
That version is nice, but it opens a new Emacs for every diff. If you do not want that then there were other suggestions on the list that instead uses GnuClient.
With GNU Emacs 23.1.1 on Ubuntu 10.04, I was obliged to add a dash like below:
(add-to-list 'command-switch-alist '("-diff" . command-line-diff))
#+END_QUOTE
[[https://www.emacswiki.org/emacs/EdiffMode][EmacsWiki: Ediff Mode]]
Captured On: [2023-10-22 Sun 02:38]
** Emacs Elfeed Backlog [0/6]
*** TODO Document Elfeed Workflow in Comments
*** TODO Elfeed Login to Site Suggestion From Skeeto
#+BEGIN_QUOTE
- SKEETO
Assuming you're using the curl backend (you really should), you can rely on whatever features curl has for this, like netrc. For example, put your credentials in .netrc, then add "--netrc" to elfeed-curl-extra-arguments.
- ALRABAN
Thanks for the suggestion. I am using the curl backend. Does that work correctly with an encrypted .netrc? Last time I tried that with curl it didn't work, but that was (admittedly) years ago. It works fine with plaintext, but that's what I'm trying to avoid.
In any case I'll give it a shot.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/8mcpd9/elegant_way_to_provide_encrypted_credentials_to/][(3) Elegant way to provide encrypted credentials to elfeed or elfeed-protocol? : emacs]]
Captured On: [2023-10-30 Mon 10:49]
*** TODO Make Your Rss Enjoyable in Elfeed
[[https://tsdh.org/posts/2021-08-12-make-your-rss-enjoyable-in-feed-readers-such-as-elfeed.html][Make Your RSS Enjoyable in Feed Readers Such as Elfeed]]
Note: This has article shows how to alter key
**** Article
Article Link: https://tsdh.org/posts/2021-08-12-make-your-rss-enjoyable-in-feed-readers-such-as-elfeed.html
Captured On: [2022-09-07 Wed 15:06]
Make your RSS enjoyable in feed readers such as elfeed
published: 2021-08-12
Yesterday Michael Eliachevitch (check out [[https://meliache.srht.site/][his blog]]) made me aware of the fact that [[https://www.tsdh.org/rss.xml][my RSS feed]] didn't contain the full postings but only excerpts, i.e., the first paragraph of each post. That means that if you read it with a feed reader such as [[https://github.com/skeeto/elfeed][elfeed]] (which I highly recommend!), you only can read that excerpt and have to visit the web page in order to read the complete post. (That might make sense if you have advertising on your page but I'm just happy if someone reads and likes one or another of my posts no matter how they consume it.)
As it turns out, putting just an excerpt in the feed seems to be pretty much standard behavior. So better check your feed!
In order to put your complete post content in the feed, you have to change
<description>{{ .Summary | html }}</description>
to
<description>{{ .Content | html }}</description>
in your RSS template in case you are using [[https://gohugo.io/][Hugo]]. If you are using [[https://cobalt-org.github.io/][cobalt]] like me, add
default:
# default value is "\n\n"
excerpt_separator: ""
to your _cobalt.yml.
Make Elfeed use the secondary browser
While we're at it: I read feeds using [[https://github.com/skeeto/elfeed][elfeed]] and don't want to leave emacs for reading complete posts in case the feed has only an excerpts. At least, there's [[https://www.gnu.org/software/emacs/manual/html_node/eww/index.html#Top][EWW, the Emacs Web Wowser]].
To read the rss contents, you just hit RET. In order to browse the post's web page, you hit b (elfeed-search-browse-url) which opens the page with browse-url-browser-function. If hit with prefix arg (C-u), it'll instead invoke the function bound to browse-url-generic.
Normally, clicking an URL in emacs should call browse-url-button-open-url which usually calls browse-url-browser-function (browse-url-firefox for me), or, if a prefix arg is given, calls browse-url-secondary-browser-function (which I've set to eww). That's a convention used in vanilla emacs and other packages and I wish that elfeed conforms! So here's the .emacs snippet for doing so:
#+begin_src emacs-lisp
(defun th/elfeed-search-browse-url-maybe-with-scndry-browser
(orig-fn &rest args)
(cl-letf (((symbol-function 'browse-url-generic) #'browse-url-button-open-url))
(apply orig-fn args)))
(advice-add
'elfeed-search-browse-url
:around
#'th/elfeed-search-browse-url-maybe-with-scndry-browser
'((name "Make browse-url-generic call browse-url-button-open-url")))
#+end_src
What doas that do? Well, it makes browse-url-button-open-url the function in the function slot of the symbol browse-url-generic during calls of elfeed-search-browse-url, i.e., when elfeed-search-browse-url calls browse-url-generic it'll actually call browse-url-button-open-url.
So now I can hit b in elfeed to open a posting in firefox and C-u b will open it in EWW. Ah, what a relief!
EDIT: 2021-08-13: Michael Eliachevitch just made me aware that this advice should also be added to elfeed-show-visit which gets called with b from inside an elfeed buffer that already shows the RSS description of a posting. So that would be:
#+begin_src emacs-lisp
(advice-add
'elfeed-show-visit :around
#'th/elfeed-search-browse-url-maybe-with-scndry-browser
'((name "Make browse-url-generic call browse-url-button-open-url")))
#+end_src
Works like a charm. Thanks Michael!
*** TODO More Elfeed Ideas
[[https://blog.dornea.nu/2022/06/29/rss/atom-emacs-and-elfeed/][RSS/Atom, Emacs and elfeed - blog.dornea.nu]]
Captured On: [2023-10-21 Sat 08:50]
*** TODO RSS and Emacs
[[https://blog.dornea.nu/2022/06/13/rss-and-atom-for-digital-minimalists/][RSS and Atom for digital minimalists - blog.dornea.nu]]
Captured On: [2023-10-21 Sat 08:47]
*** TODO Web-clip an Elfeed Entry Via a Single Keybinding
also consider an immediate refile
also consider moving the contents to an org-roam entry, asking for the title.
*** TODO Elfeed doesn't appear to update properly. Needs testing.
** Emacs ERC Backlog [0/1]
*** TODO Fix Gist Creation on Paste > 5 Lines in ERC
** Emacs Eshell / Vterm / EAT Backlog [0/11]
*** TODO Check Into Multi-vterm
[[https://github.com/suonlight/multi-vterm][suonlight/multi-vterm: Managing multiple vterm buffers in Emacs]]
Captured On: [2023-07-16 Sun 07:46]
*** TODO Get Remote Connections Working From Eshell
The following two servers should work without error and with tolerable speed.
Currently, they will hang/freeze Emacs in an apparent loop (reentrant Tramp issues)
- cd /sshx:cjennings@obelisk.usbx.me:/home/cjennings
- cd /sshx:cjennings@cjennings.net:/var/cjennings
*** TODO Look Into Eat.el for Terminal Usage
[[https://codeberg.org/akib/emacs-eat/][akib/emacs-eat: Emulate A Terminal, in a region, in a buffer and in Eshell - Codeberg.org]]
Captured On: [2024-03-17 Sun 00:43]
*** TODO Look Into Eat With Eshell
https://www.reddit.com/r/emacs/comments/17a628r/using_eat_eshell/
Eat-eshell-mode turns the eshell buffer itself into an eat terminal. Since top is in eshell-visual-commands list, it gets run in a separate term mode buffer. To switch this out for an eat buffer, use eat-eshell-visual-command-mode.
(use-package eat
:custom
(eat-term-name "xterm")
:custom-face
(ansi-color-bright-blue ((t (:foreground "#00afff" :background "#00afff"))))
:config
(evil-set-initial-state 'eat-mode 'emacs)
(eat-eshell-mode)
(eat-eshell-visual-command-mode))
also... you can set eat-term-name to xterm-256color and don't worry about the colors
[[https://codeberg.org/akib/emacs-eat][akib/emacs-eat: Emulate A Terminal, in a region, in a buffer and in Eshell - Codeberg.org]]
Captured On: [2024-03-27 Wed 14:15]
*** TODO Look Into This Vterm Workflow
#+BEGIN_QUOTE
My configs are not public currently, but I'm a migrant from vim so I have a "leader" key which all of my keybindings are under. Currently this is implemented through Transient. I have it bound to ,, and then all hotkeys build off that kinda like spacemacs or doom. , n will toggle the last vterm window with vterm-toggle, , i is a new transient for my work stuff, , i s is a second new transient for my work server, and finally , i s s will launch the work server. All of my other keybindings are like that too. I have a few helper functions to run a command in a new vterm buffer, and then I bind those commands to the transient. You can also get fancy with passing arguments, which I do for my work server. Apologies, but I'd rather not share that setup, but I did learn it mostly from reading the magit code. I can share some of the other helper functions.
(defun jg/new-or-existing-vterm (buffer-name)
"Open an existing buffer or create one with the BUFFER-NAME given."
(or (get-buffer buffer-name) (vterm buffer-name)))
(defun jg/vterm-send-command (command)
"Sends COMMAND to a REPL running in vterm."
(vterm-send-string command)
(vterm-send-return))
I would then use this like so:
(defun jg/tuple ()
(interactive)
(with-current-buffer (jg/new-or-existing-vterm "*tuple*")
(jg/vterm-send-command "flatpak run app.tuple.app")))
Then I bind this jg/tuple function to the transient, and now I have it as a hotkey.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/104ud8k/how_do_you_use_the_terminal_during_a_coding/][(1) How do you use the terminal during a coding session? : emacs]]
Captured On: [2024-03-27 Wed 14:29]
*** TODO Make Eshell Command Open New Eshell Instead of Reusing Existing
(defun buffer-exists (bufname)
(not (eq nil (get-buffer bufname))))
(defun make-shell (name)
"Create a shell buffer named NAME."
(interactive "sName: ")
(if (buffer-exists "*eshell*")
(setq eshell-buffer-name name)
(message "eshell doesn't exist; using the default name: *eshell*"))
(eshell))
or
(defun make-shell (name)
"Create a shell buffer named NAME."
(interactive "sName: ")
(setq name (concat "$" name))
(eshell)
(rename-buffer name))
https://stackoverflow.com/questions/2540997/create-more-than-one-eshell-instance-in-emacs
*** TODO Verify Ability to Call Dired From Tramp / Eshell on Remote Server
could happen either in minibuffer or eshell
*** TODO Workflow Test: Use Elisp Function on Files in Directory
https://www.masteringemacs.org/article/complete-guide-mastering-eshell
https://www.reddit.com/r/emacs/comments/k5zrlb/somehow_eshell_is_working_perfectly/
https://github.com/dieggsy/esh-autosuggest#esh-autosuggest
https://emacs.stackexchange.com/questions/59862/unable-to-find-files-with-ssh-and-environment-variables
https://github.com/emacs-jupyter/jupyter/issues/172
*** TODO Look into eshell prompt extras to help your eshell prompt
[[https://github.com/zwild/eshell-prompt-extras][zwild/eshell-prompt-extras: Display extra information and color for your eshell prompt.]]
Captured On: [2024-04-05 Fri 07:15]
*** TODO Look into implementing function to jump to directories in Emacs + Eshell
[[https://karthinks.com/software/jumping-directories-in-eshell/][Jumping directories in eshell | Karthinks]]
Captured On: [2024-04-02 Tue 09:28]
*** TODO Review Mastering Eshell again for tips
[[https://www.masteringemacs.org/article/complete-guide-mastering-eshell][Mastering Eshell - Mastering Emacs]]
Captured On: [2024-04-05 Fri 07:22]
** Emacs Flycheck Config Backlog [0/3]
*** TODO Flycheck Hydra
#+BEGIN_QUOTE
Hydra / Flycheck
Group Flycheck commands.
(pretty-hydra-define hydra-flycheck
(:hint nil :color teal :quit-key "q" :title (with-faicon "plane" "Flycheck" 1 -0.05))
("Checker"
(("?" flycheck-describe-checker "describe")
("d" flycheck-disable-checker "disable")
("m" flycheck-mode "mode")
("s" flycheck-select-checker "select"))
"Errors"
(("<" flycheck-previous-error "previous" :color pink)
(">" flycheck-next-error "next" :color pink)
("f" flycheck-buffer "check")
("l" flycheck-list-errors "list"))
"Other"
(("M" flycheck-manual "manual")
("v" flycheck-verify-setup "verify setup"))))
#+END_QUOTE
[[https://github.com/rememberYou/.emacs.d/blob/master/config.org][.emacs.d/config.org at master · rememberYou/.emacs.d]]
Captured On: [2023-11-19 Sun 17:24]
*** TODO Flycheck Show Diagnostics Tip
#+BEGIN_QUOTE
with the latest flycheck (elpa):
(setq flymake-show-diagnostics-at-end-of-line 'short)
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/17vp0o1/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 07:19]
*** TODO Make proselinting more visible to user when needed (org, text, md modes) in flycheck-config
** Emacs Flyspell Config Backlog [0/3]
*** TODO Nice Emacs Abbrevs Table
#+BEGIN_QUOTE
hellwolf_rt
·
5 mo. ago
I had fun generating abbrev_defs using chatgpt4: https://chat.openai.com/share/441c339e-1032-463d-afcb-9ca65f38d5e8
(result at https://github.com/hellwolf/.emacs.d/blob/master/abbrev_defs)
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/14l3jn8/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 08:59]
*** TODO Fix Flyspell keybindings
*** TODO removing flyspell keybindings should be placed with personal keymap definition
** Emacs Font Config Backlog [0/10]
*** TODO Emacs Emoji Tips
#+BEGIN_QUOTE
Step 2 is to ensure you have a font which supports emoji, and that font is used for emoji by your fontset. I did this with an Emacs lisp function:
(defun init-my-font ()
(set-face-font
'default
(font-spec
:family "<your default font>"
:size 10.3
:weight 'normal
:width 'normal
:slant 'normal))
(set-face-attribute 'default nil :height 103)
;; emoji font
(set-fontset-font
t 'symbol
(font-spec
:family "Noto Color Emoji"
:size 10.3
:weight 'normal
:width 'normal
:slant 'normal))
;; fallback font
(set-fontset-font
t nil
(font-spec
:family "DejaVu Sans Mono"
:size 10.3
:weight 'normal
:width 'normal
:slant 'normal)))
If you use Emacs without a daemon, I think it is sufficient to call this function in your init file by writing (init-my-font). But I use a daemon and it seems to require that you wait until you have a gui frame before setting up the fonts. I have this hook for that:
(add-hook
'server-after-make-frame-hook
(let (done)
(lambda ()
(unless done
;; still set done to true even if we hit a bug (otherwise we
;; can never open a frame to see the problem)
(setq done t)
(init-my-font)))))
Note that this snippet requires lexical scoping in your init file.
#+END_QUOTE
[[https://emacs.stackexchange.com/questions/62219/how-do-i-get-colour-emoji-to-display-in-emacs][fonts - How do I get colour emoji to display in Emacs - Emacs Stack Exchange]]
Captured On: [2023-11-04 Sat 17:55]
*** TODO Examine Textsize Package
[[https://github.com/WJCFerguson/textsize/tree/master][WJCFerguson/textsize: Emacs package textsize.el to automatically choose a font point size for the Emacs default face.]]
Captured On: [2023-11-04 Sat 17:17]
*** TODO Font Discussion
[[https://emacs.stackexchange.com/questions/5689/force-a-single-font-for-all-unicode-glyphs][Force a single font for all unicode glyphs - Emacs Stack Exchange]]
Captured On: [2023-11-04 Sat 17:27]
*** TODO How to Use Bold on Some Font-lock Keywords
#+BEGIN_QUOTE
I liked the light version of JetBrainsMono and I like to use bold on some font-lock (keywords for example).
(set-face-attribute 'default nil :font "JetBrainsMono Nerd Font Mono" :height 170 :weight 'light)
(set-face-attribute 'fixed-pitch nil :font "JetBrainsMono Nerd Font Mono" :height 170 :weight 'light)
(set-face-attribute 'variable-pitch nil :font "Iosevka Aile" :height 170 :weight 'light)
(custom-set-faces '(font-lock-comment-face ((t (:font "Iosevka Aile" :italic t :height 1.0)))))
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/13q0841/what_font_config_do_you_use_on_emacs/][(2) What font config do you use on emacs? : emacs]]
Captured On: [2023-11-04 Sat 17:21]
*** TODO Interesting Early-init.el Regarding Emacs Fonts
[[https://github.com/Eason0210/.emacs.d/blob/master/early-init.el#L33-L82][.emacs.d/early-init.el at master · Eason0210/.emacs.d]]
Captured On: [2023-11-04 Sat 17:22]
*** TODO Look at Default-font-presets
[[https://codeberg.org/ideasman42/emacs-default-font-presets][ideasman42/emacs-default-font-presets: Switch between a user defined list of fonts as well as scaling functionality. - emacs-default-font-presets - Codeberg.org]]
Captured On: [2023-11-04 Sat 17:15]
*** TODO New Emoji Support in Emacs 29
#+BEGIN_QUOTE
Nice. Maybe worth a mention is that Emacs 29 includes now it's own package to select (and preview) emojis.
From the NEWS file:
**** Emoji
+++
***** Emacs now has several new methods for inserting Emojis.
The Emoji commands are under the new 'C-x 8 e' prefix.
+++
***** New command 'emoji-insert' (bound to 'C-x 8 e e' and 'C-x 8 e i').
This command guides you through various Emoji categories and
combinations in a graphical menu system.
+++
***** New command 'emoji-search' (bound to 'C-x 8 e s').
This command lets you search for Emojis based on names.
+++
***** New command 'emoji-list' (bound to 'C-x 8 e l').
This command lists all Emojis (categorized by themes) in a special
buffer and lets you choose one of them.
---
***** New command 'emoji-recent' (bound to 'C-x 8 e r').
This command lets you choose among the Emojis you have recently
inserted.
+++
***** New command 'emoji-describe' (bound to 'C-x 8 e d').
This command will tell you the name of the Emoji at point. (This
command also works for non-Emoji characters.)
***** New input method 'emoji'.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/sufy5z/native_emojis_in_emacs/][(2) Native Emojis in Emacs : emacs]]
Captured On: [2023-11-04 Sat 18:04]
*** TODO Testing Unicode Tips
#+BEGIN_QUOTE
Step 1 is to make sure that you have Cairo and Harfbuzz enabled. You can run this elisp and check the results to test this:
(featurep 'cairo) ; should evaluate to t
(frame-parameter (selected-frame) 'font-backend) ; should be a list starting with ftcrhb
#+END_QUOTE
[[https://emacs.stackexchange.com/questions/62219/how-do-i-get-colour-emoji-to-display-in-emacs][fonts - How do I get colour emoji to display in Emacs - Emacs Stack Exchange]]
Captured On: [2023-11-04 Sat 17:54]
*** TODO Various Font-related Config
[[https://www.reddit.com/r/emacs/comments/ll8mlz/share_your_fontrelated_config/][(2) Share your font-related config : emacs]]
Captured On: [2023-11-04 Sat 17:24]
*** TODO Review Interesting Modus Themes Settings for Ideas
#+BEGIN_QUOTE
(use-package modus-themes
:demand t
:init
(progn
(setq modus-themes-bold-constructs t)
(setq modus-themes-org-blocks 'greyscale)
(setq modus-themes-italic-constructs t)
(setq modus-themes-headings
'((1 . (1.6))
(2 . (background 1.5))
(3 . (background bold 1.2))
(4 . (1.1))
(t . ())))
(load-theme 'modus-operandi))
:config
(progn
(with-eval-after-load 'pdf-tools
;; Configure PDF page colors. The code below comes from Modus
;; Info manual (Backdrop for pdf-tools (DIY)).
(defun my/pdf-tools-backdrop ()
"Change background to be different from standard background."
(face-remap-add-relative
'default
`(:background ,(modus-themes-color 'bg-alt))))
(defun my/pdf-tools-midnight-mode-toggle ()
"Change background of pdf-view-mode to adapt to current Modus theme."
(when (eq major-mode 'pdf-view-mode)
(if (eq (car custom-enabled-themes) 'modus-vivendi)
(pdf-view-midnight-minor-mode 1)
(pdf-view-midnight-minor-mode -1))
(my/pdf-tools-backdrop)))
(add-hook 'pdf-tools-enabled-hook #'my/pdf-tools-midnight-mode-toggle)
(add-hook 'modus-themes-after-load-theme-hook #'my/pdf-tools-midnight-mode-toggle))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:30]
** Emacs Games Backlog [0/5]
*** TODO Convert Alternate Chess Pieces Into Proper Format
*** TODO Eradio Channels Should Leverage ~/music/*.m3u and *.pls Files
should pull in m3u files in ~/music directory
*** TODO Investigate Chess instability
*** TODO Make Chess Display Colors Configurable
;; map the following
;; chess-display-retract
;; LICHESS
;; light squares: #F0D9B5
;; dark squares: #B58863
;; CHESS.COM
;; light squares: #779556
;; dark squares: #EBECD0
*** TODO Make Chess Engine Selectable
; do a completing-read with gnuchess, fruit, crafty, stockfish, etc.
;; (ideally based on what's found on the system's path)
** Emacs General Backlog [0/31
*** TODO Consider Collapsing Code and Project Directories Into One List
You don't actually treat them any differently.
Ideally, code-dir is where cloning repositories would go to, but even then, the user should choose as there are non-code git repositories.
Having a list would also make the setup more flexible in case you wanted to use another directory in your agenda or as a refile target.
*** TODO Add Current Directory Into Load-path in Emacs
#+BEGIN_QUOTE
Add current directory into load-path in Emacs
10 years ago | Source
Tags : elisp emacs en programming
Useful when developing emacs plugin:
(defun add-pwd-into-load-path ()
"add current directory into load-path, useful for elisp developers"
(interactive)
(let ((dir (expand-file-name default-directory)))
(if (not (memq dir load-path))
(add-to-list 'load-path dir)
)
(message "Directory added into load-path:%s" dir)
)
)
#+END_QUOTE
[[https://blog.binchen.org/posts/add-current-directory-into-load-path-in-emacs/][Add current directory into load-path in Emacs | Chen's blog]]
Captured On: [2024-01-09 Tue 16:09]
*** TODO Check Out This Replace Workflow Using Ripgrep, Consult, Embark and Wgrep
#+BEGIN_QUOTE
I love the combination of consult, ripgrep, embark, and wgrep:
recursive grep-as-you-type with consult-ripgrep
then save that to a buffer with embark export
then make that buffer writable with C-x C-q (wgrep)
then edit the output of ripgrep
then save those edits with C-c C-c
For example, if I have a url http://example.com/ in a bunch of note files, I can ripgrep to find them all, then put that in a buffer, query-replace to change them all to http://anothersite.com/, then save them. It will go out to all the files where it was found and change the url.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/1benj4g/things_you_do_in_emacs_that_will_make_nonemacs/][(1) Things you do in Emacs that will make non-Emacs users go WOW? : emacs]]
Captured On: [2024-03-24 Sun 16:47]
*** TODO Consider Changing Emacs Kill Buffer to 'Kill Buffer and Delete Its Windows'
#+BEGIN_QUOTE
Kill Buffer and Delete Its Windows
Command ‘kill-buffer-and-its-windows’, available in library Lisp:misc-cmds.el, kills the buffer and deletes all of its windows. The default buffer to kill is ‘current-buffer’. The argument to the command may be either a buffer or its name (a string).
This command is especially useful as a replacement for command ‘kill-buffer’ when using Emacs Frames – see OneOnOneEmacs. Used with other frame-oriented functions, it also deletes the frame if the buffer is alone in the frame.
Motivation:
Command ‘kill-buffer’ displays a different buffer in the window, in place of one you’ve killed. With frames this is more annoying than useful.
Command ‘kill-buffer-and-window’ just complains if you try to delete the sole window in a frame.
Note: You can use ‘substitute-key-definition’ to replace all key bindings for ‘kill-buffer’ with bindings to ‘kill-buffer-and-its-windows’:
(substitute-key-definition 'kill-buffer 'kill-buffer-and-its-windows global-map)
#+END_QUOTE
[[https://www.emacswiki.org/emacs/KillingBuffers#h5o-12][EmacsWiki: Killing Buffers]]
Captured On: [2023-10-22 Sun 02:25]
*** TODO Consider Literate DevOps
[[https://howardism.org/Technical/Emacs/literate-devops.html][Literate DevOps]]
Captured On: [2023-10-02 Mon 00:58]
*** TODO Emacs Startup Tips
#+BEGIN_QUOTE
Tiny bootup speed tip: if you are on linux and use the gtk build of emacs, but you don't actually use any gtk stuff (menu, toolbar, scrollbar, etc. are hidden), then try the lucid build (or even, the "no" toolkit, --with-x-toolkit=no), emacs may boot up faster with it. On my pc, lucid build starts up ~150 msec faster than the gtk build.
Another tip related to this: on my pc, non-gtk builds have an unnecessary wait during bootup. It turned out, emacs waits for some event from the X server, with the timeout of 0.1 sec. On my machine this makes bootup time 0.1 sec longer than it should be. I fixed this with (only one of these two is needed)
(setq x-lax-frame-positioning t)
(setq x-wait-for-event-timeout nil)
in my early-init.el.
Now, my fully configured emacs starts in 200 msec, which less than the stock gtk-build (emacs -Q).
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/14377k9/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 08:41]
*** TODO Fix Blocking Error "Key Sequence C-c M-g Starts With Non-prefix Key C-c Esc"
**** TODO Grep source for keybinding for emacs C-c M-g boot error
**** 2023-07-18 @ 15:05:01 -0500 Problem description and the fix that wasn't.
I believe I may have fixed a longstanding issue with this emacs config where
invoking projectile before the init had finished would cause it to produce this error:
Error running timer ‘require’: (error "Key sequence C-c M-g starts with non-prefix key C-c ESC")
I believe this was caused by a :bind statement in use-package where the bind statement
had double-parenthesis, e.g.,
:bind
(("C-x g" . magit-status))
became
:bind
("C-x g" . magit-status)
After making the statement single-parenthesis, I can't reproduce the issue casually,
so it's time to see if I can reproduce it intentionally/methodically.
*** TODO Interesting Emacs Functions in Bashrc
#+BEGIN_QUOTE
emacs -nw is old, these days better to run emacs as deamon and connect through emacsclient, here is what I add to my .bashrc:
# Emacs please
if type emacs >/dev/null 2>/dev/null; then
export ALTERNATE_EDITOR=""
export VISUAL="emacsclient -c -a ''" # $VISUAL opens in GUI and waits
export EDITOR="$VISUAL"
function e() { emacsclient -c -a '' --eval "(progn (select-frame-set-input-focus (selected-frame)) (find-file \"$1\"))"; }
function et() { emacsclient -t -a '' --eval "(progn (find-file \"$1\"))"; }
function ediff() { emacsclient -c -a '' --eval "(progn (select-frame-set-input-focus (selected-frame)) (ediff-files \"$1\" \"$2\"))"; }
function edired() { emacsclient -c -a '' --eval "(progn (select-frame-set-input-focus (selected-frame)) (dired \"$1\"))"; }
function emagit() { emacsclient -c -a '' --eval "(progn (select-frame-set-input-focus (selected-frame)) (magit-status \"$1\"))"; }
function ekill() { emacsclient --eval '(save-buffers-kill-emacs)'; }
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/16w9bvh/using_emacs_as_editor/][(2) Using Emacs as $EDITOR : emacs]]
Captured On: [2023-12-03 Sun 15:26]
*** TODO Investigate Nand2tetris Emacs Mode
[[https://github.com/CestDiego/nand2tetris.el/tree/master][CestDiego/nand2tetris.el: Major Mode for HDL files in nand2tetris.]]
Captured On: [2023-10-02 Mon 00:31]
*** TODO Look into Emacs Collaborative Editing Environment
[[https://github.com/zaeph/crdt.el][zaeph/crdt.el]]
Captured On: [2023-10-02 Mon 00:06]
*** TODO Look into Philip Lord's Emacs Packages
[[http://homepages.cs.ncl.ac.uk/phillip.lord/emacs.html][Emacs Packages]]
Captured On: [2023-11-23 Thu 12:33]
*** TODO Look Into Vmtouch for Emacs Speed
https://blog.binchen.org/posts/emacs-speed-up-1000/
[[https://github.com/hoytech/vmtouch/blob/master/vmtouch.pod][vmtouch/vmtouch.pod at master · hoytech/vmtouch]]
Captured On: [2024-01-09 Tue 16:16]
*** TODO Toggle full view of window in Emacs
#+BEGIN_QUOTE
Toggle full view of window in Emacs
10 years ago | Source
Tags : emacs en
Add below code into your ~/.emacs:
(defun toggle-full-window()
"Toggle the full view of selected window"
(interactive)
;; @see http://www.gnu.org/software/emacs/manual/html_node/elisp/Splitting-Windows.html
(if (window-parent)
(delete-other-windows)
(winner-undo)
))
#+END_QUOTE
[[https://blog.binchen.org/posts/toggle-full-view-of-window-in-emacs/][Toggle full view of window in Emacs | Chen's blog]]
Captured On: [2024-01-09 Tue 16:12]
*** TODO Update and Create File Headers in Emacs Lisp
[[https://www.emacswiki.org/emacs/header2.el][EmacsWiki: header2.el]]
Captured On: [2023-10-02 Mon 00:35]
*** TODO Using Emacs as $EDITOR
#+BEGIN_QUOTE
30 Sep 2023
Using Emacs as $EDITOR
Continuing on from my experiment with using Emacs as for scrollback in my terminal multiplexer I thought I'd try to use it as my
$EDITOR as well.
The two main cases where I use $EDITOR is
1 The occasional use of git on the command line, rebasing or writing a commit message, and
2 Use of ZSH's edit-command-line functionality.
To make sure Emacs is starting up quickly enough I'm using the same small setup I created for the scrollback editing, so I'm now
setting EDITOR like this
export EDITOR="emacs -nw --init-directory ~/.se.d"
Now that I want to use the same setup for editing I can't really jump into view-mode every time Emacs starts so I have to be a bit
more clever. The following bit won't do
(add-hook 'find-file-hook #'view-mode)
I need to somehow find out what starts Emacs and then only modify the hook when needed. Unfortunately I haven't found
anything that reveals that Emacs is started by zellij. Creating a separate little script that zellij uses would be an option, of course,
but for now I've opted to make it the default and instead refrain from adding the hook in the other two use cases.
ZSH doesn't make it easy to find out that it's edit-command-line either, but as I've observed that the command line sometimes
doesn't look right after leaving the editor I wanted to call redisplay to fix it up. That means I need to have a function anyway, so
using an environment variable becomes an easy way to check if Emacs is being used to edit the command line.
function se-edit-command-line() {
export SE_SKIP_VIEW=y
zle edit-command-line
unset SE_SKIP_VIEW
zle redisplay
}
zle -N se-edit-command-line
bindkey -M vicmd '^V' se-edit-command-line
bindkey -M viins '^V' se-edit-command-line
Unfortunately is seems zle edit-command-line doesn't pass on non-exported environment variables, hence the explicit export and
unset.
When git starts an editor it sets a few environment variables so it was easy to just pick one that is set in both cases I care about. I
picked GIT_EXEC_PATH.
With these things in place I changed the slim setup to only add the hook when neither of the environment variables are present
(unless (or (getenv "SE_SKIP_VIEW")
(getenv "GIT_EXEC_PATH"))
(add-hook 'find-file-hook #'view-mode))
Hopefully this works out well enough that I won't feel a need to go back to using Neovim as my $EDITOR.
Tags: emacs zsh
Comment here.
#+END_QUOTE
[[https://magnus.therning.org/2023-09-30-using-emacs-as-$editor.html][Using Emacs as $EDITOR]]
Captured On: [2023-10-11 Wed 21:42]
*** TODO Look into MPDel for Music and Playlist Management
[[https://github.com/mpdel/mpdel][mpdel/mpdel: Emacs user interface for MPD]]
Captured On: [2024-04-05 Fri 14:05]
*** TODO Research X-apply-session-resources Setting for Early Init
#+BEGIN_QUOTE
;; Ignore X resources; its settings would be redundant with the other settings
;; in this file and can conflict with later config (particularly where the
;; cursor color is concerned).
(advice-add #'x-apply-session-resources :override #'ignore)
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/early-init.el][emacs.d/early-init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:12]
*** TODO Deactivate Beeping in system-defaults.el
#+BEGIN_QUOTE
;; Deactivate beeping
(setq ring-bell-function (lambda ()))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:14]
*** TODO Investigate face-near-same-color-threshold setting for init.el
#+BEGIN_QUOTE
;; Apply recommendation from modus Info manual:
(setq face-near-same-color-threshold 45000)
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:14]
*** TODO Consider this setting for more readable stacktraces
#+BEGIN_QUOTE
User Option: debugger-stack-frame-as-list ¶
If this variable is non-nil, every stack frame of the backtrace is displayed as a list. This aims at improving the backtrace readability at the cost of special forms no longer being visually different from regular function calls.
With debugger-stack-frame-as-list non-nil, the above example would look as follows:
----------- Buffer: backtrace-output ------------
(backtrace)
(list 'testing (backtrace))
(progn ...)
(eval (progn (1+ var) (list 'testing (backtrace))))
(setq ...)
(save-excursion ...)
(let ...)
(with-output-to-temp-buffer ...)
(eval (with-output-to-temp-buffer ...))
(eval-last-sexp-1 nil)
(eval-last-sexp nil)
(call-interactively eval-last-sexp)
----------- Buffer: backtrace-output ------------
#+END_QUOTE
[[https://www.gnu.org/software/emacs/manual/html_node/elisp/Internals-of-Debugger.html][Internals of Debugger (GNU Emacs Lisp Reference Manual)]]
Captured On: [2024-04-05 Fri 14:20]
*** TODO Print larger lists before abbreviating in edebug
#+BEGIN_QUOTE
(use-package edebug
:init
(setq edebug-print-length 5000))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:24]
*** TODO Unify the Way Emacs Opens Files Across Packages
[[https://github.com/DamienCassou/unify-opening][DamienCassou/unify-opening: Emacs package to make everything use the same mechanism to open files]]
Captured On: [2024-04-05 Fri 15:28]
*** TODO Evaluate saveplace mode for Emacs
#+BEGIN_QUOTE
(use-package saveplace
:demand t
:config
(progn
(save-place-mode)))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:33]
*** TODO Avy config for issuing other commands
#+BEGIN_QUOTE
(use-package avy
:bind* (("C-," . avy-goto-char-timer)
:map isearch-mode-map
("C-," . avy-isearch))
:bind (("M-g g" . avy-goto-line))
:init
(progn
;; home row on a Colemak keyboard:
(setq avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?o))
;; Let me easily use actions beyond jump:
(setq avy-single-candidate-jump nil)
(setq avy-flyspell-correct-function #'ispell-word)
(setq avy-timeout-seconds 0.4))
:config
(progn
(defmacro my/avy-without-moving-point (point &rest body)
"Move point to POINT than execute BODY and restore previous location."
(declare (indent 1))
`(unwind-protect
(save-excursion
(goto-char point)
,@body)
(select-window (cdr (ring-ref avy-ring 0)))))
(defun my/avy-action-help (point)
"Show the Emacs help for thing at POINT."
(my/avy-without-moving-point point
(helpful-at-point)))
(defun my/avy-action-kill-whole-line (point)
"Kill the whole line at POINT."
(my/avy-without-moving-point point
(kill-whole-line)))
(defun my/avy-action-embark (point)
"Start `embark-act' at POINT."
(my/avy-without-moving-point point
(embark-act)))
(setq avy-dispatch-alist
'(
;; (?a) in avy-keys
;; (?b)
;; (?c)
;; (?d) in avy-keys
;; (?e) in avy-keys
;; (?f)
;; (?g)
;; (?h) in avy-keys
;; (?i) in avy-keys
;; (?j)
;; (?k)
;; (?l)
;; (?m)
;; (?n) in avy-keys
;; (?o) in avy-keys
;; (?p)
;; (?q)
;; (?r) in avy-keys
;; (?s) in avy-keys
;; (?t) in avy-keys
;; (?u)
;; (?v)
;; (?w)
;; (?x)
;; (?y)
;; (?z)
;; (?A)
;; (?B)
;; (?C)
;; (?D)
;; (?E)
;; (?F)
;; (?G)
;; (?H)
;; (?I)
;; (?J)
;; (?K)
;; (?L)
;; (?M)
;; (?N)
;; (?O)
;; (?P)
;; (?Q)
;; (?R)
;; (?S)
;; (?T)
;; (?U)
;; (?V)
;; (?W)
;; (?X)
;; (?Y)
;; (?Z)
(?$ . avy-action-ispell)
(?? . my/avy-action-help)
(?\C-w . avy-action-kill-stay)
(?\C-k . my/avy-action-kill-whole-line)
(?\M-w . avy-action-copy)
(?\C-\S-a . my/avy-action-embark)))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 16:04]
*** TODO Investigate auto-compile package
#+BEGIN_QUOTE
(use-package auto-compile
:demand t
:init
(progn
(setq auto-compile-display-buffer nil)
(setq auto-compile-source-recreate-deletes-dest t)
(setq auto-compile-toggle-deletes-nonlib-dest t)
(setq auto-compile-update-autoloads t))
:hook (auto-compile-inhibit-compile . auto-compile-inhibit-compile-detached-git-head)
:config
(progn
(auto-compile-on-load-mode)
(auto-compile-on-save-mode)
(auto-compile-use-mode-line-set nil nil)))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:16]
*** TODO Investigate make executable if script
Looks like it makes scripts executable on save
#+BEGIN_QUOTE
(use-package executable
:hook (after-save . executable-make-buffer-file-executable-if-script-p))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:25]
*** TODO Investigate Drag-stuff to Replace Moving Regions Up/Down
perhaps you can also move it across to a specific column?
#+BEGIN_QUOTE
(use-package drag-stuff
:demand t
:config
(progn
(drag-stuff-global-mode)
(drag-stuff-define-keys)
(dolist (mode '(org-mode rebase-mode emacs-lisp-mode mpdel-playlist-current-playlist-mode))
(add-to-list 'drag-stuff-except-modes mode))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 15:26]
*** TODO Goggles eye-candy for modified region
[[https://github.com/minad/goggles][minad/goggles: goggles.el - Pulse modified region]]
Captured On: [2024-04-05 Fri 15:23]
*** TODO Investigate runner for issuing common commands in dired
[[https://github.com/thamer/runner][thamer/runner: Improved "open with" suggestions for dired mode in Emacs]]
(use-package runner
:demand t
:after dired
:init
(progn
(setq runner-run-in-background t)))
Captured On: [2024-04-05 Fri 15:16]
*** TODO Investigate lin package for hl-highlighting
#+BEGIN_QUOTE
Package lin is available.
Status: Available from gnu-local -- Install
Archive: gnu-local
Version: 1.0.0
Commit: 09cf249c78385502a2ead30c4fa1468cf96939f7
Summary: Make `hl-line-mode' more suitable for selection UIs
Requires: emacs-27.1
Website: https://git.sr.ht/~protesilaos/lin
Keywords: convenience faces theme
Maintainer: Lin Development <~protesilaos/lin@lists.sr.ht>
Author: Protesilaos Stavrou <info@protesilaos.com>
Other versions: 1.0.0 (gnu).
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
LIN IS NOTICEABLE (LIN.EL)
Protesilaos Stavrou
info@protesilaos.com
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This manual, written by Protesilaos Stavrou, describes the specifics of
`lin.el'.
The documentation furnished herein corresponds to stable version 1.0.0,
released on 2022-09-08. Any reference to a newer feature which does not
yet form part of the latest tagged commit, is explicitly marked as such.
Current development target is 1.1.0-dev.
⁃ Package name (GNU ELPA): `lin'
⁃ Official manual: <https://protesilaos.com/emacs/lin>
⁃ Change log: <https://protesilaos.com/emacs/lin-changelog>
⁃ Git repo on SourceHut: <https://git.sr.ht/~protesilaos/lin>
• Mirrors:
⁃ GitHub: <https://github.com/protesilaos/lin>
⁃ GitLab: <https://gitlab.com/protesilaos/lin>
⁃ Mailing list: <https://lists.sr.ht/~protesilaos/lin>
Table of Contents
─────────────────
1. COPYING
2. Overview LIN
3. Installation
.. 1. GNU ELPA package
.. 2. Manual installation
4. Sample configuration
5. Acknowledgements
6. GNU Free Documentation License
7. Indices
.. 1. Function index
.. 2. Variable index
.. 3. Concept index
1 COPYING
═════════
Copyright (C) 2021-2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify
this document under the terms of the GNU Free
Documentation License, Version 1.3 or any later version
published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover Texts being “A
GNU Manual,” and with the Back-Cover Texts as in (a)
below. A copy of the license is included in the section
entitled “GNU Free Documentation License.”
(a) The FSF’s Back-Cover Text is: “You have the freedom to
copy and modify this GNU manual.”
2 Overview LIN
══════════════
Lin is a stylistic enhancement for Emacs’ built-in `hl-line-mode'. It
remaps the `hl-line' face (or equivalent) buffer-locally to a style
that is optimal for major modes where line selection is the primary
mode of interaction.
The idea is that `hl-line-mode' cannot work equally well for contexts
with competing priorities: (i) line selection, or (ii) simple line
highlight. In the former case, the current line needs to be made
prominent because it carries a specific meaning of some significance
in the given context: the user has to select a line. Whereas in the
latter case, the primary mode of interaction does not revolve around
the line highlight itself: it may be because the focus is on editing
text or reading through the buffer’s contents, so the current line
highlight is more of a reminder of the point’s location on the
vertical axis.
`lin-mode' enables `hl-line-mode' in the current buffer and remaps the
appropriate face to the `lin-face'. The `lin-global-mode' follows the
same principle, though it applies to all hooks specified in the user
option `lin-mode-hooks'.
Users can select their preferred style by customizing the user option
`lin-face'. Options include the faces `lin-red', `lin-green',
`lin-yellow', `lin-blue' (default), `lin-magenta', `lin-cyan',
`lin-mac', `lin-red-override-fg', `lin-green-override-fg',
`lin-yellow-override-fg', `lin-blue-override-fg',
`lin-magenta-override-fg', `lin-cyan-override-fg',
`lin-mac-override-fg', or any other face that preferably has a
background attribute. The Lin faces with the `-override-fg' suffix
set a foreground value which replaces that of the underlying text.
Whereas the others only specify a background attribute.
3 Installation
══════════════
3.1 GNU ELPA package
────────────────────
The package is available as `lin'. Simply do:
┌────
│ M-x package-refresh-contents
│ M-x package-install
└────
And search for it.
GNU ELPA provides the latest stable release. Those who prefer to
follow the development process in order to report bugs or suggest
changes, can use the version of the package from the GNU-devel ELPA
archive. Read:
<https://protesilaos.com/codelog/2022-05-13-emacs-elpa-devel/>.
3.2 Manual installation
───────────────────────
Assuming your Emacs files are found in `~/.emacs.d/', execute the
following commands in a shell prompt:
┌────
│ cd ~/.emacs.d
│
│ # Create a directory for manually-installed packages
│ mkdir manual-packages
│
│ # Go to the new directory
│ cd manual-packages
│
│ # Clone this repo, naming it "lin"
│ git clone https://git.sr.ht/~protesilaos/lin lin
└────
Finally, in your `init.el' (or equivalent) evaluate this:
┌────
│ ;; Make Elisp files in that directory available to the user.
│ (add-to-list 'load-path "~/.emacs.d/manual-packages/lin")
└────
Everything is in place to set up the package.
4 Sample configuration
══════════════════════
┌────
│ (require 'lin)
│
│ (setq lin-face 'lin-blue) ; check doc string for alternative styles
│
│ ;; You can use this to live update the face:
│ ;;
│ ;; (customize-set-variable 'lin-face 'lin-green)
│
│ (setq lin-mode-hooks
│ '(bongo-mode-hook
│ dired-mode-hook
│ elfeed-search-mode-hook
│ git-rebase-mode-hook
│ grep-mode-hook
│ ibuffer-mode-hook
│ ilist-mode-hook
│ ledger-report-mode-hook
│ log-view-mode-hook
│ magit-log-mode-hook
│ mu4e-headers-mode
│ notmuch-search-mode-hook
│ notmuch-tree-mode-hook
│ occur-mode-hook
│ org-agenda-mode-hook
│ pdf-outline-buffer-mode-hook
│ proced-mode-hook
│ tabulated-list-mode-hook))
│
│ (lin-global-mode 1)
└────
Check out Christian Tietze’s blog post on integrating Lin with
Neotree: <https://christiantietze.de/posts/2022/03/hl-line-priority/>.
5 Acknowledgements
══════════════════
Lin is meant to be a collective effort. Every bit of help matters.
Author/maintainer
Protesilaos Stavrou.
Contributions to code or documentation
Christian Tietze, Damien Cassou, Federico Stilman, Gautier
Ponsinet, Kai von Fintel, Nicolas De Jaeghere.
#+END_QUOTE
[[help:Package][]]
Captured On: [2024-04-05 Fri 14:43]
*** TODO Check into spacious padding mode
Sample Config from Damien Cassou's Emacs Config
#+BEGIN_QUOTE
(use-package spacious-padding
:demand t
:hook (server-after-make-frame . spacious-padding-mode)
:config
(progn
(setq spacious-padding-subtle-mode-line
'(:mode-line-active error :mode-line-inactive shadow))))
#+END_QUOTE
[[https://raw.githubusercontent.com/DamienCassou/emacs.d/master/init.el][]]
Captured On: [2024-04-06 Sat 10:54]
*** TODO [#D] Google-this Warning Issues to Fix
https://github.com/Malabarba/emacs-google-this/issues/31
Warning (comp): google-this.el:105:1: Warning: custom-declare-variable `google-this-suspend-after-search' docstring wider than 80 characters Disable showing Disable logging
Warning (comp): google-this.el:137:8: Warning: docstring wider than 80 characters Disable showing Disable logging
Warning (comp): google-this.el:472:11: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode' Disable showing Disable logging
Warning (comp): google-this.el:133:43: Warning: the function ‘google-maps’ is not known to be defined. Disable showing Disable logging
Warning (comp): google-this.el:131:43: Warning: the function ‘google-this-maps’ is not known to be defined. Disable showing Disable logging
** Emacs Help Config Backlog [0/1]
*** TODO Remap keys from regular help to these instead of overwriting them in help-config
** Emacs Host Environment Backlog [0/1]
*** TODO Checking on Emacs Lisp to Identify Trackpoint
[[https://emacs.stackexchange.com/questions/41349/use-mouse-buttons-as-modifiers][key bindings - Use mouse buttons as modifiers - Emacs Stack Exchange]]
Captured On: [2023-12-02 Sat 23:21]
** Emacs Hugo Config Backlog [0/3]
*** TODO Good Read on Org-roam and Hugo / Ox-Hugo
[[https://blog.dornea.nu/2022/10/04/migrate-tiddlywiki-to-org-roam-part-2-org-roam-and-hugo/][Migrate Tiddlywiki to org-roam - Part 2: org-roam and hugo - blog.dornea.nu]]
Captured On: [2023-10-21 Sat 08:42]
*** TODO Is Org-page Better Than Ox-hugo for Blogging?
[[https://github.com/emacsorphanage/org-page][GitHub - emacsorphanage/org-page: [INACTIVE] A static site generator based on Emacs and org mode.]]
Captured On: [2023-11-10 Fri 17:26]
*** TODO Read the Ox Hugo Manual
[[https://ox-hugo.scripter.co/][ox-hugo - Org to Hugo exporter]]
Captured On: [2024-03-22 Fri 16:59]
** Emacs Keybinding / Hydra / Transient Config Backlog [0/4]
*** TODO Look at Pretty Hydra and Major Mode Hydra
[[https://github.com/jerrypnz/major-mode-hydra.el/tree/5181a31631589ffd870f70293aeee00b7b773b58][GitHub - jerrypnz/major-mode-hydra.el at Pu5181a31631589ffd870f70293aeee00b7b773b58]]
Captured On: [2023-12-06 Wed 13:27]
*** TODO More Hydra Examples for Review
[[https://github.com/abo-abo/hydra/blob/master/hydra-examples.el][hydra/hydra-examples.el at master · abo-abo/hydra]]
Captured On: [2023-11-19 Sun 17:21]
*** TODO Speedrect Quick key bindings and other tools for Emacs' rectangle-mark-mode.
[[https://github.com/jdtsmith/speedrect][jdtsmith/speedrect: Quick key bindings and other tools for rectangle-mark-mode]]
Captured On: [2023-10-27 Fri 11:09]
*** TODO Using keyfreq to optimize keybindings
[[https://blog.binchen.org/posts/how-to-be-extremely-efficient-in-emacs/][How to be extremely efficient in Emacs | Chen's blog]]
Captured On: [2024-01-09 Tue 15:57]
** Emacs Latex Config Backlog [0/3]
*** TODO Good Latex Emacs Config
[[https://michaelneuper.com/posts/efficient-latex-editing-with-emacs/][Efficient LaTeX Editing With Emacs - Michael]]
Captured On: [2023-11-18 Sat 08:04]
*** TODO Collapse graphviz config into the LaTeX Config or other suitable module
*** TODO latex config
[[https://gist.github.com/karthink/7d89df35ee9b7ac0c93d0177b862dadb][Configuration for super-fast Latex input using AucTeX, CDLatex and a bit of YaSnippet. See https://karthinks.com/software/latex-input-for-impatient-scholars]]
Captured On: [2024-04-04 Thu 23:18]
** Emacs Ledger Config Backlog [0/6]
*** TODO Hydra for Ledger
#+BEGIN_QUOTE
Hydra / Ledger
Group Ledger commands.
(pretty-hydra-define hydra-ledger
(:hint nil :color teal :quit-key "q" :title (with-faicon "usd" "Ledger" 1 -0.05))
("Action"
(("b" leadger-add-transaction "add")
("c" ledger-mode-clean-buffer "clear")
("i" ledger-copy-transaction-at-point "copy")
("s" ledger-delete-current-transaction "delete")
("r" ledger-report "report"))))
#+END_QUOTE
[[https://github.com/rememberYou/.emacs.d/blob/master/config.org][.emacs.d/config.org at master · rememberYou/.emacs.d]]
Captured On: [2023-11-19 Sun 17:25]
*** TODO Ledger-Mode Config to Review
#+BEGIN_QUOTE
Money Management
Good money management is a skill to be acquired as soon as possible. Fortunately for us, Ledger allows you to have a double-entry accounting system directly from the UNIX command line. To use Ledger with GNU Emacs, you need to the ledger-mode package. However, do not forget to install the ledger package with your system package manager.
I discovered Ledger as a student and learning how to manage time and expenses at the same time was too much. I decided for the time being to briefly learn Ledger and focus more on time management. One issue I had with Ledger was the lack of support from my bank to export my transactions into a file type that Ledger could understand. Unfortunately, since I often made bank transfers, encoding each payment by hand was a pain. For the curious people, alternatives to Ledger exist, some of which are open-source and proprietary (e.g., YNAB).
NOTE: by default, Ledger uses the ISO 8601 format to write dates, which is the recommended format.
(use-package ledger-mode
:mode ("\\.\\(dat\\|ledger\\)\\'")
:preface
(defun my/ledger-save ()
"Clean the ledger buffer at each save."
(interactive)
(ledger-mode-clean-buffer)
(save-buffer))
:bind (:map ledger-mode-map
("C-x C-s" . my/ledger-save))
:hook (ledger-mode . ledger-flymake-enable)
:custom
(ledger-clear-whole-transactions t)
(ledger-reconcile-default-commodity "EUR")
(ledger-reports
'(("account statement" "%(binary) reg --real [[ledger-mode-flags]] -f %(ledger-file) ^%(account)")
("balance sheet" "%(binary) --real [[ledger-mode-flags]] -f %(ledger-file) bal ^assets ^liabilities ^equity")
("budget" "%(binary) --empty -S -T [[ledger-mode-flags]] -f %(ledger-file) bal ^assets:bank ^assets:receivables ^assets:cash ^assets:budget")
("budget goals" "%(binary) --empty -S -T [[ledger-mode-flags]] -f %(ledger-file) bal ^assets:bank ^assets:receivables ^assets:cash ^assets:'budget goals'")
("budget obligations" "%(binary) --empty -S -T [[ledger-mode-flags]] -f %(ledger-file) bal ^assets:bank ^assets:receivables ^assets:cash ^assets:'budget obligations'")
("budget debts" "%(binary) --empty -S -T [[ledger-mode-flags]] -f %(ledger-file) bal ^assets:bank ^assets:receivables ^assets:cash ^assets:'budget debts'")
("cleared" "%(binary) cleared [[ledger-mode-flags]] -f %(ledger-file)")
("equity" "%(binary) --real [[ledger-mode-flags]] -f %(ledger-file) equity")
("income statement" "%(binary) --invert --real -S -T [[ledger-mode-flags]] -f %(ledger-file) bal ^income ^expenses -p \"this month\""))
(ledger-report-use-header-line nil)))
Finally, to provides a flychecker checker for Ledger files, you can use flycheck-ledger.
(use-package flycheck-ledger :after ledger-mode)
#+END_QUOTE
[[https://github.com/rememberYou/.emacs.d/blob/master/config.org][.emacs.d/config.org at master · rememberYou/.emacs.d]]
Captured On: [2023-11-19 Sun 17:29]
*** TODO Recording Ledger Entries With Org-capture-templates
#+BEGIN_QUOTE
Emacs: Recording ledger entries with org-capture-templates
Posted: Nov 23, 2010 - Modified: May 27, 2014| emacs
Updated 2014-05-26: Thanks to Greg for the updated link to https://github.com/ledger/ledger/wiki !
I use John Wiegley's ledger program to keep track of my personal finances. It's quick, it's light, and it lets me slice-and-dice my data however I want. I enjoy opening my ledger file and adding transactions to it. (Particularly if it involves income!) Yes, I'm that kind of weird.
I wanted to make it even easier to add entries. Instead of using C-x C-f to find the file, using ESC > to go to the end of the buffer, and typing in the transactions, I decided to add some of my common transactions to org-capture-templates. Here's the relevant snippet:
(setq org-capture-templates
(append '(("l" "Ledger entries")
("lm" "MBNA" plain
(file "~/personal/ledger")
"%(org-read-date) %^{Payee}
Liabilities:MBNA
Expenses:%^{Account} %^{Amount}
")
("lc" "Cash" plain
(file "~/personal/ledger")
"%(org-read-date) * %^{Payee}
Expenses:Cash
Expenses:%^{Account} %^{Amount}
"))
org-capture-templates))
I've bound org-capture to C-c r using (global-set-key (kbd "C-c r") 'org-capture), so now I can use C-c r l m to create an entry for my MBNA Mastercard. This keyboard shortcut might not seem short to you, but if you think about it as C-c remember ledger Mastercard, it makes perfect sense. =) (Besides, org-capture prompts me just in case I forget.)
Hooray for org-capture!
#+END_QUOTE
[[https://sachachua.com/blog/tag/ledger/][tag - ledger :: Sacha Chua]]
Captured On: [2023-11-18 Sat 07:11]
*** TODO Using Flymake With Ledger
#+BEGIN_QUOTE
To use flymake with ledger in Emacs 26.1 or higher, just do:
(add-hook 'ledger-mode-hook #'ledger-flymake-enable)
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/8x4xtt/tip_how_i_use_ledger_to_track_my_money/][(2) TIP: How I use ledger to track my money : emacs]]
Captured On: [2023-11-18 Sat 07:16]
*** TODO Large Ledger Configuration
#+BEGIN_QUOTE
(use-package ledger-mode
:hook (ledger-mode . my/configure-ledger-mode)
:mode "\\.hledger\\'"
:bind (
:map ledger-mode-map
("C-c C-r" . ledger-report)
("C-c C-c" . my/ledger-lint)
;; To get outline-minor-mode in ledger buffers:
("TAB" . org-cycle)
:map ledger-report-mode-map
("C-c C-r" . ledger-report))
:init
(progn
(setq ledger-reports
(mapcar
(lambda (pair)
(list (car pair)
(format "%s %s"
"%(binary) -f %(ledger-file)"
(cdr pair))))
'(("Account statement" . "register --ignore-assertions --auto ^%(account)")
("Income statement" . "balance --ignore-assertions --auto --tree --period %(month) --invert ^income ^expense")
("Balance sheet" . "balance --ignore-assertions --auto --tree ^asset ^debt \"^equity:\"")
("Budget" . "balance --ignore-assertions --auto --tree --empty ^budget not:unbudgeted"))))
;; For hledger
(progn
(setq ledger-mode-should-check-version nil)
(setq ledger-binary-path (executable-find "hledger"))
(setq ledger-report-links-in-register nil)
(setq ledger-report-native-highlighting-arguments '("--color=always"))
(setq ledger-report-auto-width nil))
(setq ledger-reconcile-default-commodity "EUR")
(setq ledger-report-use-header-line t)
(setq ledger-report-use-native-highlighting t)
(setq ledger-report-auto-refresh-sticky-cursor t)
(setq ledger-report-use-strict t)
(setq ledger-highlight-xact-under-point nil)
(setq ledger-copy-transaction-insert-blank-line-after t)
(defun my/ledger-configure-outline-minor-mode ()
"Configure a ledger buffer when `outline-minor-mode' is active."
(font-lock-add-keywords 'ledger-mode outline-font-lock-keywords)
(setq-local ;; copied from outline-mode major mode:
imenu-generic-expression
(list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))))
(defun my/configure-ledger-mode ()
"Configure the current Ledger buffer."
;; use TAB to complete:
(setq-local tab-always-indent 'complete)
(add-hook 'outline-minor-mode-hook #'my/ledger-configure-outline-minor-mode nil t)))
:config
(progn
(let ((date-format "%A, %B %-e"))
(defun my/ledger-position-at-date (moment)
"Move point in current buffer to insert new transaction at MOMENT.
MOMENT is an encoded date."
(let ((heading (format "*** %s" (format-time-string date-format moment))))
(goto-char (point-min))
(search-forward heading)
(forward-line)
(re-search-forward "; \\*\\*\\*" nil t)
(goto-char (line-beginning-position)))))
(advice-add #'ledger-xact-find-slot :override #'my/ledger-position-at-date)
(defun my/ledger-lint ()
"Lint my ledger file."
(interactive)
(require 'autoclose-shell)
(save-buffer)
(autoclose-shell-start "lint-system" '("lint-system")))
(defun my/ledger-insert-mortgage-transaction ()
"Read accounting data for MORTGAGE and write the ledger entry."
(interactive)
(ensure-empty-lines 1)
(let* ((description (read-string "Description: "))
(date (ledger-read-date "Date: "))
(begining (point)))
(insert (format "%s %s\n" date description))
(insert (format " asset:current:couple 0\n"))
(insert (format " expense:misc 0\n"))
(save-excursion
(goto-char begining)
(my/ledger-mortgage-rewrite))))
(defun my/ledger-mortgage-read-numbers ()
"Returns the numbers of the current mortgage reimbursement transaction.
The returned value is of the form (:capital CAPITAL :insurance INSURANCE :interest INTEREST)."
(cl-labels ((parse-number (string) (string-to-number (string-replace "," "." string))))
(let* ((number-regexp (rx (1+ (any digit)) ?, (1+ (any digit))))
(regexp (rx "ECHEANCE PRET"
(? " -")
" DONT CAP "
(group-n 1 (regexp number-regexp))
" ASS. "
(group-n 2 (regexp number-regexp))
"E"
(? " -")
" INT. "
(group-n 3 (regexp number-regexp))
(? " COM. 0,00E"))))
(save-match-data
(save-excursion
(ledger-navigate-beginning-of-xact)
(when-let* (((re-search-forward regexp (line-end-position)))
(capital (parse-number (match-string 1)))
(insurance (parse-number (match-string 2)))
(interest (parse-number (match-string 3))))
(list :capital capital :insurance insurance :interest interest)))))))
(defun my/ledger-mortgage-guess-type (numbers)
"Return the type of the transaction with NUMBERS.
The type is either 'ecoptz, 'immo1 or 'immo2.
NUMBERS is of the form (:capital CAPITAL :insurance INSURANCE :interest INTEREST)."
(cond
((and (>= (map-elt numbers :insurance) 0.1)
(= (map-elt numbers :interest) 0))
'ecoptz)
((or (>= (map-elt numbers :insurance) 0.1)
(= (map-elt numbers :interest) 0))
(user-error "Invalid numbers: %S" numbers))
((>= (map-elt numbers :capital) 700) 'immo1)
(t 'immo2)))
(defun my/ledger-mortgage-rewrite ()
"Rewrite the mortgage transaction at point."
(interactive)
(when-let* ((numbers (my/ledger-mortgage-read-numbers))
(total (seq-reduce
#'+
(map-values (my/ledger-mortgage-read-numbers))
0))
(mortgage-type (my/ledger-mortgage-guess-type numbers)))
(save-match-data
(save-excursion
(ledger-navigate-beginning-of-xact)
(when (re-search-forward " .*$" (line-end-position)) ; skip date
(replace-match " banque populaire prêt" t)
(next-line)
(delete-region (line-beginning-position) (line-end-position))
(insert (format " asset:current:couple %.2f" (- total)))
(ledger-navigate-end-of-xact)
(delete-region (line-beginning-position) (line-end-position))
(map-do
(lambda (number-type number)
(when (> number 0)
(let ((account (if (eq number-type :insurance)
"expense:util:insurance"
(format "expense:mortgage:%s%s" mortgage-type number-type))))
(insert " " account " " (number-to-string number) "\n"))))
numbers)
(delete-backward-char 1) ; remove additional newline
(ledger-post-align-dwim))))))))
(use-package flymake-hledger
:config
(progn
(setq flymake-hledger-command '("hledger" "--auto"))
;; Enable 4 optional checks. See URL
;; https://hledger.org/1.30/hledger.html#check for the meaning of
;; each check and a list of all of them.
(dolist (check '("ordereddates" "payees" "recentassertions" "tags"))
(add-to-list 'flymake-hledger-checks check))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 15:21]
*** TODO Ledger Import Config
#+BEGIN_QUOTE
(use-package ledger-complete
:init
(progn
(setq ledger-complete-in-steps nil)))
(use-package ledger-import
:hook ((ledger-import-finished . my/ledger-import-finish))
:config
(progn
(setq ledger-import-boobank-import-from-date "2023-07-29")
(setq ledger-import-autosync-command
'("hledger-autosync" "--assertions"
"--payee-format" "{payee}"))
(defun my/ledger-import-alert ()
"Notify the user that import is finished."
(alert "Finished"
:title "Ledger-autosync"
:buffer (current-buffer)))
(defun my/ledger-import-remove-EUR ()
"Remove the EUR commodity in the current buffer."
(goto-char (point-min))
(while (search-forward " EUR" nil t)
(replace-match ""))
(ledger-mode-clean-buffer))
(defun my/ledger-import-merge-autosync-transactions ()
"Merge all autosync transactions into just one."
(goto-char (point-min))
(search-forward "Autosync Balance Assertion")
(delete-matching-lines "Autosync Balance Assertion")
(delete-matching-lines "^$"))
(defun my/ledger-import-add-today-date-as-outline ()
"Add today's date as `outline-mode' markup."
(goto-char (point-min))
(search-forward "Autosync Balance Assertion")
(goto-char (line-beginning-position))
(insert (format "*** %s\n\n" (format-time-string "%B %-d"))))
(defun my/ledger-import-finish ()
"Some actions to do when ledger-import finishes."
(interactive)
(my/ledger-import-remove-EUR)
(my/ledger-import-merge-autosync-transactions)
(my/ledger-import-add-today-date-as-outline)
(my/ledger-import-alert))
;; Fill `ledger-import-accounts' and `ledger-import-ofx-rewrite-rules':
(let ((file (expand-file-name "~/.password-store/Secure_Notes/ledger-accounts.gpg")))
(when (file-exists-p file)
(load file t)))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 15:21]
** Emacs Local Repository Backlog [0/1]
*** TODO Finish Writing Local Repository as a Package
;; - if first run or packages have been upgraded,
;; - check constant on next action. options are:
;; - notify user and update local repository
;; - updtate local repository without asking
;; - notify user and ask to update local repository
;; - do nothing
;; - function to update local repository with keybinding
** Emacs Mail Backlog [0/20]
*** TODO Allow for Mail Queueing in Both the Script and Emacs Config
**** 2023-10-28 Sat @ 15:25:01 -0500 Direction
- This should really be a toggled function, with the default always to be on at launch
This way if the user forgets that they're in queue mode, the user will automatically
send all emails next time they launch.
- Also, I'd prefer for an icon to appear in the modeline when mail is being queued.
If I create a simple custom modeline, or the user is using a default modeline,
this is likely more straightforward than trying to write an extention to doom-modeline
and spaceline for instance.
**** Reference in Manual
https://www.djcbsoftware.nl/code/mu/mu4e/Queuing-mail.html
**** Reference From Stackexchange
https://emacs.stackexchange.com/questions/37344/how-to-queue-mail-to-send
The mu4e manual node on queuing mail explains how to do this. Quoting the manual:
If you cannot send mail right now, for example because you are currently offline, you can queue the mail, and send it when you have restored your internet connection. You can control this from the Main view.
To allow for queuing, you need to tell smtpmail where you want to store the queued messages. For example:
(setq smtpmail-queue-mail t ;; start in queuing mode
smtpmail-queue-dir "~/Maildir/queue/cur")
For convenience, we put the queue directory somewhere in our normal maildir. If you want to use queued mail, you should create this directory > before starting mu4e. The mu mkdir command may be useful here, so for example:
$ mu mkdir ~/Maildir/queue
$ touch ~/Maildir/queue/.noindex
The file created by the touch command tells mu to ignore this directory for indexing, which makes sense since it contains smtpmail meta-data rather than normal messages; see the mu-mkdir and mu-index man-pages for details.
Warning: when you switch on queued-mode, your messages won’t reach their > destination until you switch it off again; so, be careful not to do this accidentally!
*** TODO Figure Out How to Filter/Categorize Mails Using Mu4e
https://www.reddit.com/r/emacs/comments/202fon/email_filters_in_mu4e/
*** TODO Figure Out Your Mail Attachments Workflow
**** TODO [#C] The Mu4e Save Attachment Function to the Actions List Doesn't Work
removed this from mu4e configuration
;; (add-to-list 'mu4e-view-actions
;; '("download attachments" . cj/mu4e-view-save-attachments))
*** TODO Fix Org Capture Template for Contacts
*** TODO GPG Signatures Working With Mu4e
*** TODO Investigate this Mu4e and Emacs config
[[https://200ok.ch/posts/2020-05-27_using_emacs_and_mu4e_for_emails_even_with_html.html][Using Emacs and mu4e for emails - even with HTML]]
Captured On: [2023-10-22 Sun 01:28]
*** TODO Set Incoming Emails as Read in Emacs Mu4e
[[https://ag91.github.io/blog/2022/02/28/set-all-incoming-emails-as-read-with-mu4e/][Set all incoming emails as read with Mu4e - Where parallels cross]]
Captured On: [2023-11-10 Fri 17:27]
*** TODO Simple Keybinding to Display Attachments Leveraging Xdg-mime
*** TODO Test Org-contacts Integration
*** TODO Test This Mu4e Setting for HTML Emails
#+BEGIN_QUOTE
Disable MU4E 'HTML over plain text' heuristic
2018-10-25 - 272 WORDS - 2 MIN READ
Alain M. Lafon
By default, the great Mail User Agent MU4E prefers Plain Text mails over HTML. This configuration can be overridden via mu4e-view-prefer-html, but there's probably few of us who would do that.
However, you might still see a whole lot of HTML emails. And when you check if they have a plain text version, they might have one! There's a reason for that. MU4E has a 'HTML over plain text' heuristic with this official rationale:
Ratio between the length of the html and the plain text part below which mu4e will consider the plain text part to be 'This messages requires html' text bodies. You can neutralize it (always show the text version) by using `most-positive-fixnum'.
This heuristic overwrites the default setting (and configuration) that Plain text should be preferred over HTML!
In my experience, HTML Emails are WAY longer than only 5x the Plain text (Doodle, Airbnb, Meetup, etc), so this will yield me a lot of false positives whereas I have never seen a "This message requires HTML" body. Since I realized that MU4E has this heuristic, I overrode it just like the doc string told me to and am an even happier MU4E user.
(setq mu4e-view-html-plaintext-ratio-heuristic most-positive-fixnum)
NB, if you want to be able to read HTML emails, that's totally and 100% supported within MU4E! You can render them as:
Text within a regular Emacs buffer
PDF within a regular Emacs buffer - complete with styles and all
Open the email in a browser through a shortcut
#+END_QUOTE
[[https://200ok.ch/posts/2018-10-25_disable_mu4e_html_over_plain_text_heuristic.html][Disable MU4E 'HTML over plain text' heuristic]]
Captured On: [2023-10-22 Sun 01:27]
*** TODO Ability to Download All Attachments to a Specified Directory
*** TODO Download Attachment Plus Open Directory in Dired
*** TODO Consider implementing https://github.com/lordpretzel/mu4e-views
*** TODO Make a hydra for mu4e shortcuts
#+BEGIN_QUOTE
Hydra
People sometimes ask about having multi-character shortcuts for bookmarks; an easy way to achieve this, is by using an emacs package Hydra.
With Hydra installed, we can add multi-character shortcuts, for instance:
(defhydra my-mu4e-bookmarks-work (:color blue)
"work bookmarks"
("b" (mu4e-search "banana AND maildir:/work") "banana")
("u" (mu4e-search "flag:unread AND maildir:/work") "unread"))
(defhydra my-mu4e-bookmarks-personal (:color blue)
"personal bookmarks"
("c" (mu4e-search "capybara AND maildir:/personal") "capybara")
("u" (mu4e-search "flag:unread AND maildir:/personal") "unread"))
(defhydra my-mu4e-bookmarks (:color blue)
"mu4e bookmarks"
("p" (my-mu4e-bookmarks-personal/body) "Personal")
("w" (my-mu4e-bookmarks-work/body) "Work"))
Now, you can bind a convenient key to my-mu4e-bookmarks/body.
#+END_QUOTE
[[https://www.djcbsoftware.nl/code/mu/mu4e/Hydra.html][Hydra (Mu4e 1.12.0 user manual)]]
Captured On: [2024-04-05 Fri 15:02]
*** TODO Ensure Mu4e is Your Default Emacs Mail Client
#+BEGIN_QUOTE
Emacs allows you to select an e-mail program as the default program it uses when you press C-x m (compose-mail), call report-emacs-bug and so on; see (emacs)Mail Methods.
If you want to use mu4e for this, you can do so by adding the following to your configuration:
(setq mail-user-agent 'mu4e-user-agent)
Similarly, to specify mu4e as your preferred method for reading mail, customize the variable read-mail-command.
(set-variable 'read-mail-command 'mu4e)
#+END_QUOTE
[[https://www.djcbsoftware.nl/code/mu/mu4e/Default-email-client.html][Default email client (Mu4e 1.12.0 user manual)]]
Captured On: [2024-04-05 Fri 15:06]
*** TODO Information About the Current Mu4e Header in Echo Area
#+BEGIN_QUOTE
It is possible to get information about the current header in the echo-area. You can enable this by setting mu4e-eldoc-support to non-nil.
#+END_QUOTE
[[https://www.djcbsoftware.nl/code/mu/mu4e/Eldoc.html][Eldoc (Mu4e 1.12.0 user manual)]]
Captured On: [2024-04-05 Fri 15:05]
*** TODO Attach Files to Mu4e Messages Using Dired
#+BEGIN_QUOTE
It is possible to attach files to mu4e messages using dired (emacs), using the following steps (based on a post on the mu-discuss mailing list by Stephen Eglen).
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
Then, mark the file(s) in dired you would like to attach and press C-c RET C-a, and you’ll be asked whether to attach them to an existing message, or create a new one.
#+END_QUOTE
[[https://www.djcbsoftware.nl/code/mu/mu4e/Dired.html][Dired (Mu4e 1.12.0 user manual)]]
Captured On: [2024-04-05 Fri 15:03]
*** TODO Mail Settings for (Email) Address-at-point
#+BEGIN_QUOTE
(use-package goto-addr
:bind (
:map goto-address-highlight-keymap
("C-c C-o" . goto-address-at-point))
:hook (((prog-mode magit-process-mode) . goto-address-mode))
:config
(progn
;; Recommended by modus-themes (2.7.0 release notes):
(setq goto-address-mail-face 'link)
(setq goto-address-mail-mouse-face 'highlight)))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:35]
*** TODO Interesting Package Mu4easy Setup Mu4e
[[https://github.com/danielfleischer/mu4easy][danielfleischer/mu4easy: mu4e + mbsync configuration for multiple email accounts.]]
Captured On: [2024-04-13 Sat 05:32]
*** Reference: Sending Email Via Smtp Through Ssh (With Mu4e)
#+BEGIN_QUOTE
SMTP through SSH
One setup I like and I use is to relay the mails directly to the outgoing SMTP server, this requires no authentication except a SSH access to the remote server.
It requires the following emacs configuration in ~/.emacs:
(setq
message-send-mail-function 'smtpmail-send-it
smtpmail-smtp-server "localhost"
smtpmail-smtp-service 2525)
The configuration tells emacs to connect to the SMTP server on localhost port 2525 to send the mails. Of course, no mail daemon runs on this port on the local machine, it requires the following ssh command to be able to send mails.
$ ssh -N -L 127.0.0.1:2525:127.0.0.1:25 remoteserver
This will bind the port 127.0.0.1:25 from the remote server point of view on your address 127.0.0.1:2525 from your computer point of view.
Your mail server should accept deliveries from local users of course.
#+END_QUOTE
[[https://dataswamp.org/~solene/2018-05-22-mu4esmtp.html][Solene'% : Sending mail with mu4e]]
Captured On: [2024-04-13 Sat 05:25]
*** TODO How to Use Email Lists in Mu4e
[[https://pragmaticemacs.wordpress.com/2017/04/24/using-email-address-lists-in-mu4e/][Using email address lists in mu4e | Pragmatic Emacs]]
Captured On: [2024-04-13 Sat 05:21]
*** TODO Good Reddit Post on Mu4e Tips
[[https://www.reddit.com/r/emacs/comments/8q84dl/tip_how_to_easily_manage_your_emails_with_mu4e/][(2) TIP: How to easily manage your emails with mu4e : emacs]]
Captured On: [2024-04-13 Sat 05:15]
*** TODO Review this mu4e configuration
[[https://github.com/iqbalansari/dotEmacs/blob/master/config/mail.org][dotEmacs/config/mail.org at master · iqbalansari/dotEmacs]]
Captured On: [2024-04-13 Sat 05:06]
*** TODO Setup Emacs as a Mail Client
#+BEGIN_QUOTE
he following function setup Emacs as a possible email client.
(defun ed/setup-emacs-mailto-target-desktop-file ()
"Write xdg desktop file allowing emacs to be used as mailto target."
(interactive)
(with-temp-file
(expand-file-name "~/.local/share/applications/emacs-mail.desktop")
(insert "[Desktop Entry]
Name=Emacs (Mail with mu4e)
Comment=Compose a new message with Mu4e in GNU Emacs
MimeType=x-scheme-handler/mailto;
Exec=emacs -l /usr/share/emacs/site-lisp/mu4e/mu4e.elc -f ed/compose-new-mail %u
Icon=emacs
Type=Application
NoDisplay=true
Terminal=false
Categories=Network;Email;
"))
(with-temp-buffer
(call-process "update-desktop-database" nil (current-buffer) nil
(expand-file-name "~/.local/share/applications/"))
(buffer-string)))
#+END_QUOTE
[[https://etienne.depar.is/emacs.d/mu4e.html][Mu4e customization]]
Captured On: [2024-04-13 Sat 04:57]
*** TODO Mu4e and Gpg Functions
#+BEGIN_QUOTE
GPG related functions
All the following functions interact with an email headers to expose or find out more about cryptography settings in use.
(defun ed/get-openpgp-header (msg)
(let ((path (or (mu4e-message-field msg :path) "")))
(if (or (equal path "")
(not (file-readable-p path)))
"Mail file is not accessible"
(ed/get-mail-header "openpgp" path))))
(defcustom ed/gpg-pub-keys '()
"List of GnuPG public keys used to sign or encrypt my email."
:type '(alist :key-type (string :tag "mu4e context name")
:value-type (string :tag "gpg mail header content"))
:group 'mu4e-crypto)
(defun ed/insert-gpg-headers (sign-or-encrypt)
(save-excursion
(goto-char (point-min))
(let ((pgp-info
(cdr (assoc (mu4e-context-name (mu4e-context-current))
ed/gpg-pub-keys))))
(when pgp-info
(insert "Openpgp: " pgp-info)
(if (equal sign-or-encrypt "encrypt")
(mml-secure-message-sign-encrypt)
(mml-secure-message-sign))))))
(defun ed/sign-this-message ()
"Insert mml gpg command and gnupg header"
(interactive)
(ed/insert-gpg-headers "sign"))
(defun ed/encrypt-this-message ()
"Insert mml gpg command and gnupg header"
(interactive)
(ed/insert-gpg-headers "encrypt"))
#+END_QUOTE
[[https://etienne.depar.is/emacs.d/mu4e.html][Mu4e customization]]
Captured On: [2024-04-13 Sat 04:56]
** Emacs Markdown Config Backlog [0/1]
*** TODO Finish Markdown Preview Functionality
** Emacs Modeline Backlog [0/3]
*** TODO Consider Mini-modeline for Emacs
[[https://github.com/kiennq/emacs-mini-modeline][kiennq/emacs-mini-modeline: Display emacs mode line in minibuffer]]
Captured On: [2023-11-18 Sat 07:44]
*** TODO Investigate Feebleline's Window-divider-mode
I have no idea what that is. And I should by now, shouldn't I?
#+BEGIN_QUOTE
feebleline
(use-package feebleline
:bind (("M-o m" . feebleline-mode))
:config
(window-divider-mode t))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 16:34]
*** TODO Investigate Org-upcoming-modeline
https://github.com/unhammer/org-upcoming-modeline there we go :)
found on this reddit post
[[https://www.reddit.com/r/emacs/comments/k1e4eu/show_next_orgappointment_in_modeline/][(4) Show next (org-)appointment in modeline? : emacs]]
Captured On: [2023-10-10 Tue 09:55]
** Emacs Org Agenda / Calendar Backlog [0/6]
*** TODO Add Todo Searching to Emacs With Rg Package
#+BEGIN_QUOTE
I'm not sure about todo modes, but using the rg (ripgrep) package, it is easy to add custom commands. For example, to define a command that searches for 'TODO' or 'FIXME' in the current project,
(rg-define-search my-rg-todo
:query "(TODO|FIXME)"
:format regexp
:dir project
:files current)
There are a lot of other similar solutions, like builtin rgrep, ag or another ripgrep/ag library.
#+END_QUOTE
[[https://stackoverflow.com/questions/76391866/how-to-show-a-list-of-all-my-todos-across-all-the-files-of-my-project][emacs - How to show a list of all my todos across all the files of my project? - Stack Overflow]]
Captured On: [2024-02-24 Sat 18:13]
*** TODO Agenda Schedule Should List All DOING and Priority #A Tasks
*** TODO Consider Implementing Agendas in Org QL
https://github.com/alphapapa/org-ql
*** TODO Consider Org Fancy Priorities Package
[[https://github.com/harrybournis/org-fancy-priorities][harrybournis/org-fancy-priorities: Display Org Mode priorities as custom strings]]
Captured On: [2023-11-01 Wed 12:05]
*** TODO Org Crypt and Logbook Work Together for Secure Agenda
[[https://ag91.github.io/blog/2020/08/28/org-crypt-and-logbook-how-they-can-work-together-for-a-secure-agenda/][Org crypt and LOGBOOK: how they can work together for a secure agenda. - Where parallels cross]]
Captured On: [2023-11-10 Fri 17:37]
*** TODO Slack Links in Org Agenda
[[https://ag91.github.io/blog/2020/09/24/composition-update-add-slack-links-to-org-agenda/][Composition Update: Slack links in your Org Agenda - Where parallels cross]]
Captured On: [2023-11-10 Fri 17:39]
*** TODO Fix Org-contacts and Birthdays
Birthdays aren't showing up in the agenda from org-contacts
*** TODO Investigate Org Caldav to Integrate Calendar With Agenda
#+BEGIN_QUOTE
(use-package org-caldav
:bind (("C-. o S" . org-caldav-sync))
:config
(progn
(setq org-caldav-url "https://licorne.ninja/remote.php/dav/calendars/DamienCassou"
org-caldav-calendar-id "personal"
org-caldav-inbox org-default-calendar-file
org-caldav-files '()
org-icalendar-timezone "Europe/Berlin"
org-caldav-sync-changes-to-org 'all)
(defun my/org-caldav-archive-year ()
"Archive a given year in my calendar."
(interactive)
(while (re-search-forward "^ *<2021-.*>$" nil t)
(org-archive-subtree)))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 15:24]
** Emacs Org Babel Backlog [0/3]
*** TODO Add Org Babel Support for PGN
[[https://gist.github.com/larrasket/4188cac7d0d034eda6ea99160e94dc57][Add org babel support for Portable Game Notation]]
Captured On: [2024-01-16 Tue 08:38]
*** TODO Change File Permissions on Your Emacs Tangle Output
#+BEGIN_QUOTE
The following worked. I'm not sure why the original did not, though.
#+BEGIN_SRC bash :tangle ~/.local/bin/tsa-ss :tangle-mode (identity #o700)
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/159zj0v/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 09:07]
*** TODO Ox Pandoc Org Mode Exporter
[[https://github.com/emacsorphanage/ox-pandoc][emacsorphanage/ox-pandoc: Another org-mode exporter via pandoc.]]
Captured On: [2023-11-01 Wed 12:25]
** Emacs Org Capture Backlog [0/2]
*** TODO Look Into Org-pdftools to See if This Simplifies the PDF Capture Templates
[[https://github.com/fuxialexander/org-pdftools][fuxialexander/org-pdftools: A custom org link type for pdf-tools]]
Captured On: [2023-11-01 Wed 12:34]
*** TODO Rename Org Webclipper Article Files
- 'article-archive' should be 'saved-articles'
- 'article-file' should be 'article-inbox' or something else
** Emacs Org Drill Backlog [0/6]
*** TODO Create Emacs Drill Questions From This Post About Adding to Lists
#+BEGIN_QUOTE
There are many different ways. Not sure if there's a particularly "proper" way. There are considerations you should take depending on how you want to add it (destructively, non-destructively) or if you care a lot about efficiency.
original list (1) things you want to add (2 3 4)
There are many different ways of adding. Things can be added destructively, meaning the original set of numbers is modified or non-destructively, just generating a new list. To see more look at list modification.
This is non-destructive. (append '(1) '(2 3 4)) ;=> '(1 2 3 4)
This is destructive and more indirect (more of a replacement than addition), here it replaces the last element of the list 2 with 2 3 4. Which has the net effect of adding to the list.
If your list is in a variable: (setq my-list '(1 2))
(setcdr my-list '(2 3 4)) ;=> '(2 3 4)
my-list ;=> '(1 2 3 4).
You could also just do a loop with add-to-list or cons. Note I'm assuming you don't care about order.
(dolist (thing things) (add-to-list 'list-var thing))
(dolist (thing things) (cons thing list-var))
I usually use the append as it is short to write and more direct. It also is probably among the fastest because it is written in C code whereas add-to-list is in elisp.
Share
Improve this answer
Follow
answered Jan 10, 2018 at 15:56
Piglet
14644 bronze badges
append is only efficient if all additional elements are already contained in a list and that list is added. It is inefficient for adding many elements sequentially or in small hunks at the tail since in this case its cost grows quadratically with the number of list entries. Note that I have confirmed that fact by timing. –
Tobias
Jan 10, 2018 at 16:54
Add a comment
3
The proper way to add many items to a list is consing in a loop.
If l is the list variable you add an item i by
(setq l (cons i l))
for which you can use the shorthand
(push i l)
The computational cost of this operation is independent of the length of the list l.
After collecting the items in this way they are in reverse order. If it is important to retain the order you can call
(setq l (nreverse l))
as the last action or just return (nreverse l). The cost of nreverse grows just linearly with the length of the list.
The costs of adding all elements with add-to-list grow quadratically with the length of the list (even without append set to t).
If you want to add an item to a list only if it is not already present. You have to search for that item. In that case you could consider using a hashmap (search the elisp info files for make-hash-table) or a sorted list to reduce the computational costs. Note that a single hash access is costly but the read/write access time is essentially independent on the number of elements in the hash.
Share
Improve this answer
Follow
edited Jan 17, 2018 at 13:23
Stefan
26.2k33 gold badges4848 silver badges8585 bronze badges
answered Jan 10, 2018 at 15:05
Tobias
32.7k11 gold badge3434 silver badges7575 bronze badges
Add a comment
3
I figured this question lacks an actual practical example that a person can copy-paste into their config, so here it is:
(defun merge-list-to-list (dst src)
"Merges content of the 2nd list with the 1st one"
(set dst
(append (eval dst) src)))
It combines the non-destructive append function that merges two lists, and a destructive set.
Now, let's say your config had this code:
(add-to-list 'company-dabbrev-code-modes 'c++-mode)
(add-to-list 'company-dabbrev-code-modes 'c-mode)
(add-to-list 'company-dabbrev-code-modes 'php-mode)
(add-to-list 'auto-mode-alist '("\\.mzn\\'" . minizinc-mode))
(add-to-list 'auto-mode-alist '("\\.glade$\\'" . xml-mode))
(add-to-list 'auto-mode-alist '("\\PKGBUILD\\'" . sh-mode))
(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode))
(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode))
You replace it with this:
(merge-list-to-list 'company-dabbrev-code-modes
'(c++-mode c-mode php-mode))
(merge-list-to-list 'auto-mode-alist
'(("\\.mzn\\'" . minizinc-mode)
("\\.glade$\\'" . xml-mode)
("\\PKGBUILD\\'" . sh-mode)
("\\.service\\'" . conf-mode)
("\\.m$" . octave-mode)))
Share
Improve this answer
Follow
edited Jun 10 at 2:58
answered Aug 10, 2021 at 17:23
Hi-Angel
54466 silver badges1818 bronze badges
The purported analogy to add-to-list is misleading, as the most notable feature of add-to-list is that it doesn't add an item which already exists in the list. If you want append you should just use append, rather than wrapping that with a name that doesn't behave the way one would expect. –
phils
Jun 9 at 9:12
1
@phils append doesn't mutate original list though. Regarding the analogy: I honestly didn't even know add-to-list checks for duplicates. I would disagree calling it a "notable feature", because you would only know that from the docs or someone else. It is actually misleading, because the name of the function says nothing at all about removing dups. So in this case it's add-to-list that is misnamed and not the add-list-to-list. With that said, I can rename it if you think it would confuse old-timers. Perhaps, add-list-to-list-allow-dups…? –
Hi-Angel
Jun 9 at 12:53
"you would only know that from the docs" -- I don't think that's much of a problem unless you're in the habit of using unfamiliar elisp functions without even reading their docstrings (which I would consider fairly inexplicable). If I was to write such a function I would probably put append somewhere in the name. –
phils
Jun 9 at 13:08
@phils problem with append tho is this name does not imply the lists are merged. That is, upon executing (setq lhs '(1 2)) (append-list-to-list lhs '(3 4)) I would expect lhs to become (1 2 (3 4)) rather than (1 2 3 4). And yes, I don't necessarily read documentation if the name of the method is self-explanatory, such as print or while or goto-line. This ain't "inexplicable", in huge codebases you can't expect every function have docs, especially so given they have tendency to become outdated. The purpose of the function should be clear from its name and type-definition. –
Hi-Angel
Jun 10 at 2:49
So, I think merge-list-to-list might be a better naming, changed to it for now. –
Hi-Angel
Jun 10 at
#+END_QUOTE
[[https://emacs.stackexchange.com/questions/38008/adding-many-items-to-a-list/68048#68048][Adding many items to a list - Emacs Stack Exchange]]
Captured On: [2023-10-22 Sun 00:48]
*** TODO Find Good Drill Questions in the Elisp Cookbook
[[https://www.emacswiki.org/emacs/ElispCookbook][EmacsWiki: Elisp Cookbook]]
Captured On: [2023-10-22 Sun 02:43]
*** TODO Move Vocabulary List to Org-Drill
Where I Left Off in the Vocabulary List for Org-Drill
#+BEGIN_QUOTE
compunction
a feeling of deep regret, usually for some misdeed
#+END_QUOTE
[[https://www.vocabulary.com/lists/191545][300 Most Difficult "SAT" Words - Vocabulary List | Vocabulary.com]]
Captured On: [2023-10-27 Fri 03:13]
*** TODO Use constants instead of hardcoding files/paths in org-drill-config
*** TODO Emacs Org Drill Flashcard
[[https://github.com/pdelfino/emacs-flashcards/blob/main/emacs.org][emacs-flashcards/emacs.org at main · pdelfino/emacs-flashcards]]
Captured On: [2024-04-05 Fri 16:20]
*** TODO Good blog on Anki and Emacs
[[https://yiufung.net/post/anki-org/][Power up Anki with Emacs, Org mode, anki-editor and more]]
Captured On: [2024-04-05 Fri 16:26]
** Emacs Org Export Backlog [0/1]
*** TODO Add simple keybinding for org to beamer presentations in org-export-config
** Emacs Org General Backlog [0/10]
*** TODO Add Company-org-block to Org Mode Config
[[https://github.com/xenodium/company-org-block/tree/aee601a2bfcc86d26e762eeb84e5e42573f8c5ca][xenodium/company-org-block at aee601a2bfcc86d26e762eeb84e5e42573f8c5ca]]
Captured On: [2023-11-01 Wed 12:51]
*** TODO Copy Formatted Content From Org Mode
jkitchin/ox-clip: Copy formatted content from org-mode]]
Captured On: [2023-11-01 Wed 12:27]
*** TODO Emacs Config Should Work Without Personal Org Files
*** TODO Interesting Org Mode Navigation Hydra
#+BEGIN_QUOTE
Org Mode Navigation
I use Org Mode constantly, and so here is a hydra I use to navigate such files:
(defhydra hydra-org (:color red :columns 3)
"Org Mode Movements"
("n" outline-next-visible-heading "next heading")
("p" outline-previous-visible-heading "prev heading")
("N" org-forward-heading-same-level "next heading at same level")
("P" org-backward-heading-same-level "prev heading at same level")
("u" outline-up-heading "up heading")
("g" org-goto "goto" :exit t))
This demonstrates the :columns feature of Hydra, which is a nice and quick way to neatly format the display of hydras in the minibuffer without resorting to the amazing things you can do with fancy formatting strings.
#+END_QUOTE
[[https://ericjmritz.wordpress.com/2015/10/14/some-personal-hydras-for-gnu-emacs/][Some Personal Hydras for GNU Emacs – One More Game-Dev and Programming Blog]]
Captured On: [2023-11-19 Sun 16:49]
*** TODO Monospace Fonts in Org Tables
[[https://github.com/alphapapa/unpackaged.el?tab=readme-ov-file#force-monospace-face-in-tables][alphapapa/unpackaged.el: A collection of useful Emacs Lisp code that isn't substantial enough to be packaged]]
Captured On: [2024-03-11 Mon 10:07]
*** TODO Org Mode Links for Emacs Slack
[[https://ag91.github.io/blog/2020/09/12/org-mode-links-for-emacs-slack/][Org mode links for Emacs Slack - Where parallels cross]]
Captured On: [2023-11-10 Fri 17:38]
*** TODO Org Mode Useful Anchors
[[https://github.com/alphapapa/unpackaged.el?tab=readme-ov-file#export-to-html-with-useful-anchors][alphapapa/unpackaged.el: A collection of useful Emacs Lisp code that isn't substantial enough to be packaged]]
Captured On: [2024-03-11 Mon 10:06]
*** TODO Org-Tidy Hides Property Drawers
[[https://github.com/jxq0/org-tidy][jxq0/org-tidy: 🧹 An Emacs minor mode to automatically tidy org-mode property drawers]]
Captured On: [2023-11-01 Wed 12:28]
*** TODO Subtasks Inherit Deadline From Parent Task in Emacs Org-mode
Org-mode has the capability to inherit tags like deadlines, but by default org-entry-get does not do so. Here's advice to ensure that DEADLINE is always inherited.
#+BEGIN_QUOTE
(defun org-entry-properties-inherit-deadline (orig-fun &optional pom which)
"Call ORIG-FUN with POM, but if WHICH is `DEADLINE' do it recursively."
(if (string= which "DEADLINE")
(org-with-point-at pom
(let (value)
(while (not (or (setq value (funcall orig-fun (point) which))
(not (org-up-heading-safe)))))
value)
(funcall orig-fun pom which))))
(advice-add 'org-entry-properties :around #'org-entry-properties-inherit-deadline)
#+END_QUOTE
Also see:
https://github.com/vedang/emacs-up/commit/1cb6c774a991d50853134d8085ca61dd12585993
[[https://stackoverflow.com/questions/4872088/is-there-any-way-for-subtasks-to-inherit-deadlines-in-org-mode][emacs - Is there any way for subtasks to inherit deadlines in org-mode? - Stack Overflow]]
Captured On: [2023-11-01 Wed 11:38]
*** TODO Consider Getting an Emacs-buddy Per This Site
[[https://github.com/ag91/emacs-buddy][GitHub - ag91/emacs-buddy: Emacs Buddy initiative to help new Emacs users with their struggles]]
Captured On: [2023-11-10 Fri 17:15]
*** TODO Org Web Tools
and a use for the package
https://blog.nawaz.org/posts/2023/Mar/solving-a-scraping-problem-with-emacs-and-org-mode/
[[https://github.com/alphapapa/org-web-tools][alphapapa/org-web-tools: View, capture, and archive Web pages in Org-mode]]
Captured On: [2024-04-11 Thu 18:02]
** Emacs Org Refile Backlog [0/2]
*** TODO Consider Using Hydras for Refile Targets
[[https://mollermara.com/blog/Fast-refiling-in-org-mode-with-hydras/][Fast refiling in org-mode with hydras | Josh Moller-Mara]]
Captured On: [2023-10-23 Mon 14:27]
*** TODO Look into this setup for Emacs and Org-Protocol
#+BEGIN_QUOTE
his is what I did:
**** Create handler for org-protocol urls
We want a small emacs window centred on the screen.
#+BEGIN_SRC sh :tangle ~/scripts/emacs-capture :shebang "#!/bin/sh"
emacsclient -c -F "((name . \"emacs-capture\") (height . 10) (width . 80) (left . 632) (top . 452) (user-position . t) (menu-bar-lines . 0))" "$@"
#+END_SRC
The =left= and =top= cells do the centering for a 1920x1080
display. For other sizes, =xwininfo= is yr friend: left =
(x-screen - x-window)/2 and so on.
**** Register handler for org-protocol
#+BEGIN_SRC sh :tangle ~/.local/share/applications/emacs-capture.desktop
[Desktop Entry]
Name=Org Capture
Exec=/home/fran/scripts/emacs-capture %u
Comment=Capture the web into org
Icon=/usr/share/icons/hicolor/scalable/apps/emacs24.svg
Type=Application
Terminal=false
MimeType=x-scheme-handler/org-protocol;
#+END_SRC
After installing this, you need to evaluate (with =C-c C-c=)
the following to register the mime-type with the OS:
#+NAME: update-block
#+BEGIN_SRC sh
update-desktop-database ~/.local/share/applications
#+END_SRC
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/fvlcqg/anyone_using_orgprotocol_with_only_a_window/][(3) Anyone using org-protocol with only a window manager but no desktop environment? : emacs]]
Captured On: [2024-04-02 Tue 16:54]
** Emacs Org Roam Backlog [0/5]
*** TODO Compare Orgrr versus Org-Roam
[[https://github.com/rtrppl/orgrr][GitHub - rtrppl/orgrr: Orgrr is a minimalist but complete note-taking system for Emacs. Its intended purpose is the creation and management of a Zettelkasten-like system.]]
Captured On: [2023-11-18 Sat 11:01]
*** TODO Describe Org-roam Types in Org-roam-config.el Commentary
*** TODO Finish Org Roam Hydra
**** TODO Example Org Roam Hydra 1
;; (org-roam-hydra (:color blue :hint nil)
;; "== Org Roam Menu == [ Note: invoke Org-Roam's completion-at-point with 'C-M-i' ]
;; "
;; ("f" org-roam-node-find "Find/Add Node (C-c n f)" :column "Node")
;; ("p" cj/org-roam-find-project "Find/Add Project (C-c n p)" :column "Node")
;; ("r" cj/org-roam-find-recipe "Find/Add Recipe (C-c n r)" :column "Node")
;; ("t" cj/org-roam-find-topic "Find/Add Topic (C-c n t)" :column "Node")
;; ("i" org-roam-node-insert "Insert Link to Node (C-c n i)" :column "Node")
;; ("I" cj/org-roam-node-insert-immediately "Insert Link to Node Immediately (C-c n I)" :column "Node")
;; ("n" org-roam-dailies-capture-today "Add Entry for Today (C-c n d n)" :column "Journal")
;; ("d" org-roam-dailies-goto-today "Goto Today's Entry (C-c n d d)" :column "Journal")
;; ("T" org-roam-dailies-capture-tomorrow "Add Entry for Tomorrow (C-c n d T)" :column "Journal")
;; ("Y" org-roam-dailies-capture-yesterday "Add Entry for Yesterday (C-c n d Y)" :column "Journal")
;; ("v" org-roam-dailies-capture-date "Add Entry for Specific Date (C-c n d v)" :column "Journal")
;; ("c" org-roam-dailies-goto-date "Goto Entry for Specific Date (C-c n d c)" :column "Journal")
;; (">" org-roam-dailies-goto-next-note "Goto Next Entry (C-c n d f)" :column "Journal")
;; ("<" org-roam-dailies-goto-previous-note "Goto Previous Entry (C-c n d b)" :column "Journal")
;; )
;; :hydra
;; (org-roam-hydra (:color blue :hint nil)
;; "== Org Roam Menu == [ Note: invoke Org-Roam's completion-at-point with 'C-M-i' ]
;; "
;; ("f" org-roam-node-find "Find/Add Node (C-c n f)" :column "Node")
;; ("p" cj/org-roam-find-project "Find/Add Project (C-c n p)" :column "Node")
;; ("r" cj/org-roam-find-recipe "Find/Add Recipe (C-c n r)" :column "Node")
;; ("t" cj/org-roam-find-topic "Find/Add Topic (C-c n t)" :column "Node")
;; ("i" org-roam-node-insert "Insert Link to Node (C-c n i)" :column "Node")
;; ("I" cj/org-roam-node-insert-immediately "Insert Link to Node Immediately (C-c n I)" :column "Node")
;; ("n" org-roam-dailies-capture-today "Add Entry for Today (C-c n d n)" :column "Journal")
;; ("d" org-roam-dailies-goto-today "Goto Today's Entry (C-c n d d)" :column "Journal")
;; ("T" org-roam-dailies-capture-tomorrow "Add Entry for Tomorrow (C-c n d T)" :column "Journal")
;; ("Y" org-roam-dailies-capture-yesterday "Add Entry for Yesterday (C-c n d Y)" :column "Journal")
;; ("v" org-roam-dailies-capture-date "Add Entry for Specific Date (C-c n d v)" :column "Journal")
;; ("c" org-roam-dailies-goto-date "Goto Entry for Specific Date (C-c n d c)" :column "Journal")
;; (">" org-roam-dailies-goto-next-note "Goto Next Entry (C-c n d f)" :column "Journal")
;; ("<" org-roam-dailies-goto-previous-note "Goto Previous Entry (C-c n d b)" :column "Journal")
;; )
**** TODO Example Org Roam Hydra 2
- What's the key binding for this?
#+BEGIN_QUOTE
Hydra / Roam
Group org-roam commands.
(pretty-hydra-define hydra-notes
(:hint nil :color teal :quit-key "q" :title (with-octicon "pencil" "Notes" 1 -0.05))
("Notes"
(("c" org-roam-dailies-capture-today "capture")
("C" org-roam-dailies-capture-tomorrow "capture tomorrow")
("g" org-roam-graph "graph")
("f" org-roam-node-find "find")
("i" org-roam-node-insert "insert"))
"Go To"
((">" org-roam-dailies-goto-next-note "next note")
("<" org-roam-dailies-goto-previous-note "previous note")
("d" org-roam-dailies-goto-date "date")
("t" org-roam-dailies-goto-today "today")
("T" org-roam-dailies-goto-tomorrow "tomorrow")
("y" org-roam-dailies-goto-yesterday "yesterday"))))
#+END_QUOTE
[[https://github.com/rememberYou/.emacs.d/blob/master/config.org][.emacs.d/config.org at master · rememberYou/.emacs.d]]
Captured On: [2023-11-19 Sun 17:26]
*** TODO Good Read on Org-Roam
[[https://blog.dornea.nu/2022/09/03/migrate-tiddlywiki-to-org-roam-part-1-export-tiddlers/][Migrate Tiddlywiki to org-roam - Part 1: Export Tiddlers - blog.dornea.nu]]
Captured On: [2023-10-21 Sat 08:41]
*** TODO Look into Delve for Org-Roam
[[https://github.com/publicimageltd/delve][publicimageltd/delve: Delve into your org-roam zettelkasten]]
Captured On: [2024-04-05 Fri 13:57]
** Emacs PDF Backlog [0/2]
*** TODO Double Check PDF-tools Settings Across All Emacs Functionality
[[https://emacs.stackexchange.com/questions/19686/how-to-use-pdf-tools-pdf-view-mode-in-emacs][gnus - How to use pdf-tools (pdf-view-mode) in emacs? - Emacs Stack Exchange]]
Captured On: [2023-10-20 Fri 10:44]
*** TODO Consider Using Org-Noter for PDF Annotations
[[https://github.com/weirdNox/org-noter][weirdNox/org-noter: Emacs document annotator, using Org-mode]]
Captured On: [2023-10-20 Fri 12:07]
** Emacs Prog Comments Backlog [0/1]
*** TODO Emacs Comments Related
**** TODO Add Elisp Quote to Comments
#+BEGIN_QUOTE
;; ---------------------------------- ;;
;; External function decls
;; ---------------------------------- ;;
#+END_QUOTE
[[][]]
Captured On: [2023-10-30 Mon 10:24]
** Emacs Prog General Backlog [0/28]
*** VERIFY Reuse Constants for Projectile Searching in prog-general.el
#+BEGIN_QUOTE
(setq projectile-project-search-path '("~/code" "~/projects" "~/.emacs.d" "~/.dotfiles"))
#+END_QUOTE
Captured On: [2023-08-28 Mon 03:07]
*** TODO Add Consult-todos, Magit-todos, or a Way to Search for Todo Comments in Code.
*** TODO Add Copilot.el
https://github.com/copilot-emacs/copilot.el
*** TODO An Emacs Refactoring Package
[[https://github.com/Wilfred/emacs-refactor#user-content-general][Wilfred/emacs-refactor: language-specific refactoring in Emacs]]
Captured On: [2023-08-12 Sat 11:41]
*** TODO Check on Shellcheck and Emacs
#+BEGIN_QUOTE
Julia Evans had a great talk called Making Hard Things Easy. One of the takeaways for me was that I should be using tools for
parts of a system I find hard to remember. In particular, when writing bash scripts I should be using shellcheck.
It turns out Emacs 29 has support for shellcheck, and older versions of Emacs can use the flymake-shellcheck page.
To set it up in Emacs 29:
(use-package flymake
:bind (("H-e" . flymake-show-project-diagnostics))
(use-package sh-script
:hook (sh-mode . flymake-mode))
I use consult for navigating my errors, and I want to make errors more noticable in the mode line, so my flymake configuration
is:
(use-package flymake
:bind (("H-e" . my/consult-flymake-project))
:preface
(defun my/consult-flymake-project ()
(interactive)
(consult-flymake t))
:custom
(flymake-suppress-zero-counters t)
:config
(defface my/flymake-modeline-error-echo
'((t :inherit 'flymake-error-echo :background "red"))
"Mode line flymake errors")
(put 'flymake-error 'mode-line-face 'my/flymake-modeline-error-echo)
(defface my/flymake-modeline-warning-echo
'((t :inherit 'flymake-warning-echo :background "orange"))
"Mode line flymake warnings")
(put 'flymake-warning 'mode-line-face 'my/flymake-modeline-warning-echo))
It's too early to know what other tweaks I might want, but so far it's alerted me to several errors in my shell scripts.
Update: [2023-10-07] Comments on HN pointed to bash-language-server which works with emacs lsp or eglot.
#+END_QUOTE
Source: [[https://amitp.blogspot.com/2023/10/emacs-and-shellcheck.html][*eww*]]
Captured On: [2023-10-09 Mon 13:42]
*** TODO Check Out Project.el Against Projectile
[[https://www.reddit.com/r/emacs/comments/176vrhs/projectel_vs_projectile_what_things_can_one_do/][(3) Project.el vs. Projectile: What things can one do that the other cannot? : emacs]]
Captured On: [2023-10-13 Fri 15:53]
*** TODO Consider Adding Back Emacs-format-all-the-code
https://github.com/lassik/emacs-format-all-the-code
*** TODO Decide Whether You Need Global Ligature Mode or if It Should Be a Hook
*** TODO Great Projectile Hydra to Consider
[[https://github.com/abo-abo/hydra/wiki/Projectile][Projectile · abo-abo/hydra Wiki]]
Captured On: [2023-11-19 Sun 17:15]
*** TODO Highlight Numeric Literals
#+BEGIN_QUOTE
(use-package highlight-numbers
:hook (prog-mode . highlight-numbers-mode))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 16:47]
*** TODO Investigate Goto-last-change
goto-last-change.el was written in response to the following:
From: Dan Jacobson <jidanni@jidanni.org>
Newsgroups: gnu.emacs.bug
Subject: function to go to spot of last change
Date: Sun, 15 Jun 2003 00:15:08 +0000 (UTC)
Sender: news <news@main.gmane.org>
Message-ID: <mailman.7910.1055637181.21513.bug-gnu-emacs@gnu.org>
NNTP-Posting-Host: monty-python.gnu.org
Why of course, a function to get the user to the spot of last changes
in the current buffer(s?), that's what emacs must lack.
How many times have you found yourself mosying [<-not in spell
checker!?] thru a file when you wonder, where the heck was I just
editing? Well, the best you can do is hit undo, ^F, and undo again,
to get back. Hence the "burning need" for the additional function,
which you might name the-jacobson-memorial-function, due to its brilliance.
--
http://jidanni.org/ Taiwan(04)25854780
#+BEGIN_QUOTE
goto-last-change
(use-package goto-last-change
:bind ("C-x C-/" . goto-last-change))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 16:40]
*** TODO Investigate Hideshow
#+BEGIN_QUOTE
hideshow
(use-package hideshow
:diminish hs-minor-mode
:hook (prog-mode . hs-minor-mode)
:bind (:map prog-mode-map
("C-c h" . hs-toggle-hiding)))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 16:46]
*** TODO Investigate Realgud - External Debugger Interface
#+BEGIN_QUOTE
An extensible, modular GNU Emacs front-end for interacting with external debuggers,
#+END_QUOTE
[[https://github.com/realgud/realgud/tree/2c77776a4797805d8633636fd68148dfb32fab65][realgud/realgud at 2c77776a4797805d8633636fd68148dfb32fab65]]
Captured On: [2023-07-31 Mon 16:43]
*** TODO Investigate Tmux + Emacs + Projectile-test
https://www.reddit.com/r/emacs/comments/xyo2fo/orgmode_vterm_tmux/
*** TODO Investigate Vagrant Emacs Integration
#+BEGIN_QUOTE
vagrant
(use-package vagrant
:commands (vagrant-up
vagrant-ssh
vagrant-halt
vagrant-status)
:functions (vagrant-tramp-enable)
:config
(vagrant-tramp-enable))
vagrant-tramp
(use-package vagrant-tramp
:after tramp)
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 17:28]
*** TODO Investigate Vimish Fold
#+BEGIN_QUOTE
vimish-fold
(use-package vimish-fold
:bind (("C-c V f" . vimish-fold)
("C-c V d" . vimish-fold-delete)
("C-c V D" . vimish-fold-delete-all)))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 17:31]
*** TODO Learn How Project.el Works in Emacs
*** TODO Look Into Reformatter Emacs Package
[[https://elpa.nongnu.org/nongnu/reformatter.html][NonGNU ELPA - reformatter]]
Captured On: [2023-10-13 Fri 14:07]
*** TODO Look into Regex Tool
[[https://melpa.org/#/regex-tool][regex-tool - MELPA]]
Captured On: [2023-07-31 Mon 17:19]
*** TODO Look into REPL Driven Development Emacs Package
[[https://github.com/alhassy/repl-driven-development/tree/05bd1cee8f298173010ed17a98ba2b94cb08d830][GitHub - alhassy/repl-driven-development at 05bd1cee8f298173010ed17a98ba2b94cb08d830]]
Captured On: [2023-12-06 Wed 13:34]
*** TODO Managing Todo Tasks in Project
[[https://www.reddit.com/r/emacs/comments/fs7tk3/how_to_manage_todo_tasks_in_my_project/][(2) How to manage TODO tasks in my project? : emacs]]
Captured On: [2024-02-26 Mon 11:01]
*** TODO Read Emacs Package Dev Handbook
[[https://github.com/alphapapa/emacs-package-dev-handbook][alphapapa/emacs-package-dev-handbook: An Emacs package development handbook. Built with Emacs, by Emacs package developers, for Emacs package developers.]]
Captured On: [2023-10-29 Sun 13:03]
*** TODO Real-time Collaborative Editing Environment for Emacs
[[https://github.com/zaeph/crdt.el][zaeph/crdt.el]]
Captured On: [2023-07-31 Mon 15:59]
*** TODO Review Refactorings in Emacs
#+BEGIN_QUOTE
Look right at the second example here:
https://joaotavora.github.io/yasnippet/snippet-development.html#orgcde188c
for ($1;$2;$3) { `yas-selected-text`$0 }
Note that you have some text selected, and the snippet expands around the text. This is the simplest way to create refactorings, say you want to put some text into a function:
def ${1:fun_name}(${2:arg}) =
$0`yas-selected-text`
Note also that you can use yasnippet to trigger as a command and it will interpret the body as lisp code, too.
Then bind the whole thing to a custom key binding, and you have some nice refactoring that will create a function for you from the selected text. I usually just kill it and yank it where needed, but since you can embed elisp you can probably also automate that to get it in scope using up/down-list. I just never take the time since expand selection and kill are like 3 keystrokes for me.
Yasnippets can get really complex, especially with mirroring and transformations and things that move text around.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/o1o7w6/refactoring_support/][(2) Refactoring support : emacs]]
Captured On: [2023-08-12 Sat 11:33]
*** TODO Rework Prog-shell to Make Shell Script Ide
https://www.reddit.com/r/emacs/comments/onpv90/emacs_as_shell_script_ide/
*** TODO Save Just the Project Buffers in Emacs
#+BEGIN_QUOTE
(defun project-save-buffers (&optional arg)
"Save modified file-visiting buffers of current project, if any.
Based on `save-some-buffers', refer to its documentation about interactive
behavior and the optional argument ARG."
(interactive "P")
(save-excursion
(when-let* ((project (project-current))
(buffers (project-buffers project)))
(save-some-buffers arg
(lambda ()
(memq (current-buffer) buffers))))))
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/159zj0v/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 09:09]
*** TODO Check the languages you code in have DAP interfaces
*** TODO Investigate Dap Move for Prog General
**** Github Repo
[[https://github.com/emacs-lsp/dap-mode?tab=readme-ov-file][emacs-lsp/dap-mode: Emacs Debug Adapter Protocol]]
Captured On: [2024-04-05 Fri 14:02]
** Emacs Prog Go Backlog [0/5]
*** VERIFY Emacs Not Displaying Ligatures in Go-mode
*** TODO Add Ob-go to Org Configuration
[[https://github.com/pope/ob-go/tree/2067ed55f4c1d33a43cb3f6948609d240a8915f5][pope/ob-go at 2067ed55f4c1d33a43cb3f6948609d240a8915f5]]
Captured On: [2023-11-01 Wed 12:46]
*** TODO Go Environment Variables in Emacs
#+BEGIN_QUOTE
I was trying to figure out how to get emacs to update my go version based on what I've set via goenv. Using the exec-path-from-shell package I was able to come up with this, hoping someone else will find this useful:
(defun go-update-env ()
"sets go related environment variables to match the project's version specified by goenv"
(interactive)
(if (directory-files (projectile-project-root) :MATCH "\.go-version")
(progn
(dolist (var '("GOMODCACHE" "GOPATH" "GOROOT" "GOTOOLDIR" "GOVERSION"))
(add-to-list 'exec-path-from-shell-variables var))
(exec-path-from-shell-initialize))
(message "warning: no .go-version file found in project root"))
(go-mode)
)
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/14377k9/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 08:42]
*** TODO Consider Go Resources Here
https://github.com/emacs-tw/awesome-emacs#go
perhaps especially
https://github.com/dominikh/go-mode.el
https://github.com/nlamirault/gotest.el
*** TODO Prog-go uses project.el and I shouldn't need it
** Emacs Prog Lisps Backlog [0/4]
*** TODO Lint and Test Emacs Lisp?
[[https://github.com/alphapapa/makem.sh][alphapapa/makem.sh: Makefile-like script for linting and testing Emacs Lisp packages]]
Captured On: [2023-10-02 Mon 00:34]
*** TODO Look Into Rainbow Blocks for Highlighting Scope and Depth, Not Syntax
[[https://github.com/istib/rainbow-blocks][istib/rainbow-blocks: block syntax highlighting in emacs]]
Captured On: [2024-03-28 Thu 15:04]
*** TODO Slime Emacs Config
#+BEGIN_QUOTE
slime
(use-package slime
:commands slime
:custom
(slime-kill-without-query-p t)
(slime-repl-history-file (user-data "slime-history.eld"))
(slime-startup-animation nil)
:init
(setq inferior-lisp-program "sbcl"
slime-contribs '(slime-fancy)))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-08-01 Tue 07:48]
*** TODO Review Interesting Elisp Settings
#+BEGIN_QUOTE
(use-package elisp-mode
:hook ((emacs-lisp-mode . my/elisp-mode-reduce-mode-name)
(emacs-lisp-mode . my/eldoc-shows-more-information))
:config
(progn
(defun my/elisp-mode-reduce-mode-name ()
(setq-local mode-name "Elisp"))
(defun my/eldoc-shows-more-information ()
(remove-hook 'eldoc-documentation-functions #'elisp-eldoc-var-docstring t)
(add-hook 'eldoc-documentation-functions #'elisp-eldoc-var-docstring-with-value nil t))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:31]
** Emacs Prog LSP Backlog [0/1]
*** TODO [#C] Article on Making LSP and Eglot Faster in Emacs
[[https://www.reddit.com/r/emacs/comments/16vixg6/how_to_make_lsp_and_eglot_way_faster_like_neovim/][how to make lsp and eglot way faster like neovim? : emacs]]
Captured On: [2023-10-02 Mon 00:52]
** Emacs Prog Python Backlog [0/2]
*** TODO Emacs ABL Mode for Python Programming
[[https://github.com/afroisalreadyinu/abl-mode][afroisalreadyinu/abl-mode: Emacs minor mode to simplify test-driven development using virtual environments]]
Captured On: [2023-11-24 Fri 12:00]
*** TODO Python Multi-Line Shells for REPL based Python Programming
[[https://github.com/jdtsmith/python-mls][jdtsmith/python-mls: Multi-line Shell Commands for Python REPLs in Emacs]]
Captured On: [2023-10-27 Fri 11:14]
** Emacs Prog Testing Backlog [0/4]
*** TODO Look into Cask and assess for ERT testing
#+BEGIN_QUOTE
I am a Cask (http://github.com/cask/cask/) junkie which provides really nice command line invocation of tests, supports multiple versions of Emacs, and runs in a headless environment. I normally run it inside M-x compile.
Testing, I use ert.el. The framework is nice, but the reporting can be poor, and keeping tests independent is hard work (that's Emacs' fault rather than ert, I feel). So if I may be excused the plug, I've written assess (https://github.com/phillord/assess) which adds better reporting, macros for keeping Emacs tests free of side-effects, and adds some nice predicates (for roundtripping indentation, testing font-lock and so on). Probably, assess will go into core for Emacs-26 as ert-assess.
ecukes and buttercup, I cannot really vouch for one way or the other. The whole BDD doesn't entirely make sense to me.
#+END_QUOTE
[[https://help-gnu-emacs.gnu.narkive.com/DIgoBtwP/tdd-and-bdd-for-emacs-lisp][TDD and BDD for emacs-lisp]]
Captured On: [2023-10-30 Mon 16:58]
*** TODO Discussion on running Emacs tests
[[https://github.com/jorgenschaefer/emacs-buttercup/issues/174][Running tests with an interactive terminal (noninteractive: nil) · Issue #174 · jorgenschaefer/emacs-buttercup]]
Captured On: [2023-10-29 Sun 14:41]
*** TODO Restclient API Testing
**** TODO Restclient.el
[[https://github.com/pashky/restclient.el][pashky/restclient.el: HTTP REST client tool for emacs]]
Captured On: [2023-11-01 Wed 15:28]
**** TODO Ob-Restclient Integrated API Testing Via Org-Babel
[[https://github.com/alf/ob-restclient.el][alf/ob-restclient.el: An org-mode extension to restclient.el]]
Captured On: [2023-11-01 Wed 15:28]
*** TODO TDD Package
emacs-tdd/tdd.el at master · jorgenschaefer/emacs-tdd]]
Captured On: [2023-10-30 Mon 17:09]
** Emacs Prog Webdev Backlog [0/0]
** Emacs Selection Framework Backlog [0/1]
*** TODO Create Another Selection Framework Config With Updated Selection Frameworks
Instead of company with ivy/swiper/counsel, try corfu with selectrum, marginalia, orderless, consult, embark
You can use orderless for filtering and prescient for sorting. They aren't mutually exclusive.
** Emacs Snippet Backlog [0/4]
*** TODO Consider Ivy-Yasnippet Integration
https://github.com/mkcms/ivy-yasnippet
*** TODO Integrate YASnippet + Yankpad with Org Capture
https://ag91.github.io/blog/2020/07/28/how-to-integrate-yasnippet-and-yankpad-with-org-capture
Captured On: [2023-11-10 Fri 17:35]
*** TODO Yasnippets With New -ts- Major Modes in Emacs
#+BEGIN_QUOTE
Advising yasnippet so that existing snippets can work with the new "treesit" -ts- major modes:
;;;###autoload
(defun my-treesit-language-or-major-mode-to-legacy-modes (lang-or-mode)
(-let* ((lang
(replace-regexp-in-string
"\\(-ts\\)?-mode$" "" (format "%s" lang-or-mode))))
(pcase lang
("bash" '(sh-mode))
("json" '(json-mode js-json-mode))
("rust" '(rust-mode rustic-mode))
(_ (list (intern (format "%s-mode" lang)))))))
;;;###autoload
(defun my-yas--modes-to-activate--treesit-modes-a
(func &optional mode &rest args)
(cond
(mode
(apply func mode args))
(t
(-let* ((non-ts-modes
(my-treesit-language-or-major-mode-to-legacy-modes major-mode)))
(-->
`(,@(apply func mode args)
,@(--mapcat (apply func it args) non-ts-modes))
(delete-dups it))))))
(advice-add #'yas--modes-to-activate :around
#'my-yas--modes-to-activate--treesit-modes-a)
2
Reply
Share
level 2
tryptych
·
3 mo. ago
Alternatively, you can add a .yas-parents file to a snippets directory, containing the name of the mode(s) it should "inherit". Eg, if your python-ts-mode snippets directory has a .yas-parents file containing "python-mode", then yasnippets for python-ts-mode will automatically include everything defined for python-mode.
3
Reply
Share
level 3
takutekato
·
3 mo. ago
Thank you, I didn't know about that.
It appears that https://github.com/AndreaCrotti/yasnippet-snippets has already done it. I will only keep this until https://github.com/doomemacs/snippets is updated, then.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/15g2u1t/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 09:12]
*** TODO eshell for loop
#+BEGIN_QUOTE
#name : Eshell for loop
#key : for
# --
for f in ${1:*} { ${2:echo} "$f"; $3} $0
#+END_QUOTE
[[https://github.com/karthink/yasnippets/blob/master/eshell-mode/for][yasnippets/eshell-mode/for at master · karthink/yasnippets]]
Captured On: [2024-04-04 Thu 22:58]
** Emacs Spellcheck Backlog [0/2]
*** VERIFY Fix Emacs Spellcheck Functionality
Make it work like Malabarba's post again -- even if it's ugly!
https://www.reddit.com/r/emacs/comments/8rxm7h/tip_how_to_better_manage_your_spelling_mistakes/
*** TODO Review Flyspell Config
**** TODO Review Flyspell Key Bindings
It should be obvious which key to hit when the cursor is over a mistake to have flyspell provide a list of corrections using completing-read.
**** TODO Review Flyspell Execution
There are situations where invoking cj/flyspell-then-abbrev doesn't work.
Identify those situations and fix.
** Emacs System Defaults Backlog [0/2]
*** TODO replacement current yes-or-no replacement in Emacs Config?
#+BEGIN_QUOTE
(progn ; `map-ynp'
;; Make all "yes or no" prompts show "y or n" instead
(setq read-answer-short t)
(setq use-short-answers t))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:17]
*** TODO Don't allow the user to switch out of answering y/n questions in minibuffer
#+BEGIN_QUOTE
(progn ; `subr'
;; recommended by
;; (info "(embark) How does Embark call the actions?")
(setq y-or-n-p-use-read-key t))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:21]
** Emacs System Utils Backlog [0/15]
*** TODO Add Mode-minder to Config Work
Show All Major and Minor Modes Available in Emacs
[[https://github.com/jdtsmith/mode-minder][jdtsmith/mode-minder: Show all modes available in Emacs]]
Captured On: [2023-10-27 Fri 11:10]
*** TODO Another Hydra for Timers/Alarms
#+BEGIN_QUOTE
Hydra / Clock
Group clock commands.
(pretty-hydra-define hydra-clock
(:hint nil :color teal :quit-key "q" :title (with-faicon "clock-o" "Clock" 1 -0.05))
("Action"
(("c" org-clock-cancel "cancel")
("d" org-clock-display "display")
("e" org-clock-modify-effort-estimate "effort")
("i" org-clock-in "in")
("j" org-clock-goto "jump")
("o" org-clock-out "out")
("p" org-pomodoro "pomodoro")
("r" org-clock-report "report"))))
#+END_QUOTE
[[https://github.com/rememberYou/.emacs.d/blob/master/config.org][.emacs.d/config.org at master · rememberYou/.emacs.d]]
Captured On: [2023-11-19 Sun 17:23]
*** TODO Change Narrow to Fancy Narrow
#+BEGIN_QUOTE
fancy-narrow
(use-package fancy-narrow
:bind (("C-c N N" . fancy-narrow-to-region)
("C-c N W" . fancy-widen))
:commands (fancy-narrow-to-region fancy-widen))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 16:33]
*** TODO Check into Engine Mode for Searching Sites
#+BEGIN_QUOTE
(use-package engine-mode
:config
(defengine my-blog "https://www.google.ca/search?q=site:sachachua.com+%s" :keybinding "b")
(defengine mail "https://mail.google.com/mail/u/0/#search/%s" :keybinding "m")
(defengine google "https://google.com/search?q=%s" :keybinding "g")
(defengine emacswiki "https://google.com/search?q=site:emacswiki.org+%s" :keybinding "e")
(engine-mode)
:hydra
(my-engine-mode-hydra
(:color blue)
"Engine mode"
("b" engine/search-my-blog "blog")
("m" engine/search-mail "mail")
("g" engine/search-google "google")
("e" engine/search-emacswiki "emacswiki")))
#+END_QUOTE
[[https://sachachua.com/dotemacs/index.html#org0d11d0e][Sacha Chua's Emacs configuration]]
Captured On: [2023-07-31 Mon 15:55]
*** TODO Check Out Emacs Vundo Package
[[https://github.com/casouri/vundo][casouri/vundo: Visualize the undo tree.]]
Captured On: [2024-03-24 Sun 16:46]
*** TODO Custom Elisp: Copy Full Link to This Page to the Kill Ring
- file - and full path to the file the buffer refers to.
- http - works on web pages as well
*** TODO Good Org-Pomodoro Config
#+BEGIN_QUOTE
As a person with a short attention span, the Pomodoro technique allows me to maximize my concentration throughout the day. Personally, I do sessions of 25 minutes of concentrated work and 5 minutes of break. Finally, every two hours, I take a 30 minute break. To use the Pomodoro technique with GNU Emacs, the org-pomodoro package is suggested.
(use-package org-pomodoro
:after org
:custom
(alert-user-configuration (quote ((((:category . "org-pomodoro")) libnotify nil))))
(org-pomodoro-audio-player "/usr/bin/mpv")
(org-pomodoro-finished-sound "~/audio/pomodoro_finished.mp3")
(org-pomodoro-format " %s")
(org-pomodoro-killed-sound "~/audio/pomodoro_killed.mp3")
(org-pomodoro-long-break-sound "~/audio/pomodoro_long.mp3")
(org-pomodoro-overtime-sound "~/audio/pomodoro_overtime.mp3")
(org-pomodoro-short-break-sound "~/audio/pomodoro_short.mp3")
(org-pomodoro-start-sound "~/audio/pomodoro_start.mp3")
(org-pomodoro-start-sound-p t))
#+END_QUOTE
[[https://github.com/rememberYou/.emacs.d/blob/master/config.org][.emacs.d/config.org at master · rememberYou/.emacs.d]]
Captured On: [2023-11-19 Sun 17:51]
*** TODO Implement Org Timer Hydra
#+BEGIN_QUOTE
Timers, work clocking, and capturing from anywhere (I use this hydra multiple times each hour).
(defhydra hydra-global-org (:color blue)
"Org"
("t" org-timer-start "Start Timer")
("s" org-timer-stop "Stop Timer")
("r" org-timer-set-timer "Set Timer") ; This one requires you be in an orgmode doc, as it sets the timer for the header
("p" org-timer "Print Timer") ; output timer value to buffer
("w" (org-clock-in '(4)) "Clock-In") ; used with (org-clock-persistence-insinuate) (setq org-clock-persist t)
("o" org-clock-out "Clock-Out") ; you might also want (setq org-log-note-clock-out t)
("j" org-clock-goto "Clock Goto") ; global visit the clocked task
("c" org-capture "Capture") ; Don't forget to define the captures you want http://orgmode.org/manual/Capture.html
("l" org-capture-goto-last-stored "Last Capture"))
#+END_QUOTE
[[https://github.com/abo-abo/hydra/wiki/orgmode][Orgmode · abo-abo/hydra Wiki]]
Captured On: [2023-11-19 Sun 17:18]
*** TODO Look Into Emacs-run-command for Any Common Commands
[[https://bard.github.io/emacs-run-command/demo][Demo – emacs-run-command]]
Captured On: [2024-03-17 Sun 00:45]
*** TODO Look Into Ibuffer Sidebar
[[https://github.com/jojojames/ibuffer-sidebar][jojojames/ibuffer-sidebar: A sidebar for IBuffer]]
Captured On: [2024-03-02 Sat 16:33]
*** TODO Look Into Smarter Home/End Keys for Emacs
[[https://www.emacswiki.org/emacs/download/pc-keys.el][]]
Captured On: [2023-11-23 Thu 12:22]
*** TODO Manage External Services Within Emacs With Prodigy
https://www.jds.work/emacs-prodigy/
[[https://github.com/rejeep/prodigy.el][rejeep/prodigy.el: Manage external services from within Emacs]]
Captured On: [2024-03-24 Sun 17:04]
*** TODO Maybe Just This for Notifications in Emacs?
#+BEGIN_QUOTE
Finally, I use org-wild-notifier to get notifications about TODO items in org-agenda.
(use-package org-wild-notifier
:after org
:custom
(alert-default-style 'libnotify)
(org-wild-notifier-notification-title "Agenda Reminder")
:config (org-wild-notifier-mode))
#+END_QUOTE
[[https://github.com/rememberYou/.emacs.d/blob/master/config.org][.emacs.d/config.org at master · rememberYou/.emacs.d]]
Captured On: [2023-11-19 Sun 17:49]
*** TODO Pasting From Clipboard
This is typically used for inserting copied text from the clipboard.
Emacs seems to capture this, if so, I need to diassociate ctrl+shift+v from scroll-up-command
**** 2023-07-18 @ 14:59:44 -0500 What Emacs Help Text Says
scroll-up-command is an interactive and byte-compiled function defined
in window.el.gz.
Signature
(scroll-up-command &optional ARG)
Documentation
Scroll text of selected window upward ARG lines; or near full screen if no ARG.
*** TODO Consider implementing vundo package
#+BEGIN_QUOTE
(use-package vundo
:bind ("C-x u" . vundo)
:hook ((vundo-mode . my/vundo-setup))
:init
(progn
(setq vundo-window-max-height 5))
:config
(progn
(setq vundo-glyph-alist vundo-unicode-symbols)
(defun my/vundo-setup ()
"Remove mode-line and header-line."
(setq mode-line-format nil)
(setq header-line-format nil))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 15:14]
** Emacs Telegram Backlog [0/2]
*** TODO Consider Making a Hydra for Telegram
*** TODO Review Telega Configuration Snippets
https://github.com/zevlg/telega.el/wiki/Configuration-snippets
** Emacs Term and Shell Backlog [0/0]
** Emacs Text Config Backlog [0/8]
*** TODO Consider Olivetti Settings
#+BEGIN_QUOTE
(use-package olivetti
:hook (((Info-mode help-mode helpful-mode eww-mode) . olivetti-mode))
:init
(progn
(setq olivetti-body-width 84)))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 14:35]
*** TODO Another (Perhaps Better) Emacs Insert Pair
#+BEGIN_QUOTE
Instead of having insert-pair bindings for a fixed list of opening delimiters, I like to have an entire prefix key dedicated to insert-pair. I've chosen C-S-w for the prefix, so C-S-w followed by any opening delimiter will insert the pair, so you can use C-S-w (, C-S-w [, C-S-w {, etc. What I like about this approach is that the paired delimiters can vary by major mode, and I don't need to add key bindings to handle them.
(defvar insert-pair-map
(let ((map (make-sparse-keymap)))
(define-key map [t] #'insert-pair)
map))
(global-set-key (kbd "C-S-w") insert-pair-map)
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/14r48b8/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 09:03]
*** TODO Check Search Region Functionality in Emacs
#+BEGIN_QUOTE
You can search region or user input in duckduckgo using default eww and M-s M-w.
If you prefer google and default OS browser you can implement (or grab existing packages):
(defun web-search ()
"Search the web for the text in the region.
If region is active, search the web for the text between
region beginning and end. Else, prompt the user for a search
string."
(interactive)
(let ((query (if (use-region-p)
(buffer-substring (region-beginning) (region-end))
(read-string "Search web for: "))))
(browse-url (format "https://google.com/search?q=%s"
(url-hexify-string query)))))
... bind it somewhere, for example:
(global-set-key (kbd "M-s M-w") 'web-search)
4
Reply
Share
level 2
github-alphapapa
·
17 days ago
See options eww-use-browse-url and M-x customize-group RET browse-url RET.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/17l7bg8/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 07:26]
*** TODO Check That Your Up/Down/Capitalize Case Functions Are All Tied to Good Keybindings
#+BEGIN_QUOTE
The default commands to upcase/downcase/capitalize words are not convenient, for the following reasons:
There are three different commands for upcaseing, for example. The user needs to remember the three commands, their key bindings, and when to use each of them. There should be one command per action: one for upcasing, one for downcasing, and one for capitalizing.
The commands on regions don't have dedicated key bindings and are disabled by default.
The commands like upcase-word depend on the position of pointer inside of the word, so that the result of upcasing "fo^o"is "foO". This packages assumes that you want "FOO".
One needs to use arguments for commands like upcase-word to make them correct the words that one has just written and only one word can be adjusted in this way.
Here are the commands that try to fix these flaws:
fix-word-upcase
fix-word-downcase
fix-word-capitalize
I propose replacing of the built-ins with these new commands:
(global-set-key (kbd "M-u") #'fix-word-upcase)
(global-set-key (kbd "M-l") #'fix-word-downcase)
(global-set-key (kbd "M-c") #'fix-word-capitalize)
#+END_QUOTE
[[https://github.com/mrkkrp/fix-word][mrkkrp/fix-word: Transform words in Emacs (upcase, downcase, capitalize, etc.)]]
Captured On: [2023-11-18 Sat 07:24]
*** TODO Emacs Insert Pair
#+BEGIN_QUOTE
28
For parens you can do M-(. For brackets/braces/quotes you could do:
(global-set-key (kbd "M-[") 'insert-pair)
(global-set-key (kbd "M-{") 'insert-pair)
(global-set-key (kbd "M-\"") 'insert-pair)
Note that if you don't have a region highlighted, it will just insert the pair of whatevers and put the cursor in between them. Also handy for deleting matching whatevers is
(global-set-key (kbd "M-)") 'delete-pair)
EDIT:
Good point in the comments about overriding backward-paragraph. You could bind it to C-{, which might interfere with something in a major mode. insert-pair takes the last key and does a lookup to see what pair to insert, so if you don't want to bind it to something-{ you could bind to this function instead:
(defun my-insert-braces ()
(interactive)
(if (region-active-p)
(insert-pair 1 ?{ ?})
(insert "{}")
(backward-char)))
Share
Improve this answer
Follow
#+END_QUOTE
[[https://stackoverflow.com/questions/2951797/wrapping-selecting-text-in-enclosing-characters-in-emacs][Wrapping selecting text in enclosing characters in Emacs - Stack Overflow]]
Captured On: [2023-11-18 Sat 09:02]
*** TODO Emacs Narrow to Region and Clone Indirect
#+BEGIN_QUOTE
I have enjoyed my own dwim version of a narrow-to-region + clone-buffer-indirect command I found online for quite some time now.
Earlier this week I realized most times I select the current function or paragraph before using the command, so I could make that the default case when there's no region. I came up with this:
;; Inspired by https://demonastery.org/2013/04/emacs-narrow-to-region-indirect/
;; and modified to DWIM. Also use `pop-to-buffer' instead of `switch-to-buffer'
(defun hoagie-clone-indirect-dwim (&optional arg)
"Create an indirect buffer, narrow it to defun or active region.
If ARG, don't narrow."
(interactive "P")
(unless (or (use-region-p)
arg)
(mark-defun))
(let ((start (use-region-beginning))
(end (use-region-end))
;; we'll pop the buffer manually
;; to clear the region
(buf (clone-indirect-buffer nil nil)))
(deactivate-mark)
(with-current-buffer buf
(when (and start end)
(narrow-to-region start end)
(deactivate-mark))
(pop-to-buffer buf))))
And it covers the same cases as before (thanks to the prefix arg).
I bound it in one of my custom keymaps to c (for "clone").
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/16tes2a/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 08:21]
*** TODO Investigate Ialign for a visual align-regexp
#+BEGIN_QUOTE
ialign
(use-package ialign
:bind ("C-c {" . ialign))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 16:57]
*** TODO Open Line Above/Below in Emacs
#+BEGIN_QUOTE
Open line below/above line in VIM, stolen and slighty modified from here https://www.emacswiki.org/emacs/OpenNextLine I use electric-indent-mode so I had no use for indent-according-to-mode.
(defun my/open-line-above ()
"Insert an empty line above the current line."
(interactive)
(beginning-of-line)
(open-line 1))
(defun my/open-line-below (arg)
"Insert an empty line below the current line.
With a prefix ARG insert line above the current line."
(interactive "P")
(if arg
(my/open-line-above)
(end-of-line)
(open-line 1)
(forward-line 1)))
;; open line (above/below)
(global-set-key (kbd "C-o") 'my/open-line-below)
(global-set-key (kbd "M-o") 'my/open-line-above)
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/14r48b8/weekly_tips_tricks_c_thread/][(2) Weekly Tips, Tricks, &c. Thread : emacs]]
Captured On: [2023-11-18 Sat 09:05]
** Emacs Tramp Backlog [0/1]
*** TODO [#C] Review Emacs Wiki and Gnu Documentation on Tramp Mode
[[https://www.emacswiki.org/emacs/TrampMode#toc12][EmacsWiki: Tramp Mode]]
https://www.gnu.org/software/tramp/
** Emacs UI Config Backlog [0/2]
*** TODO Dedicated Buffers (Emacs won't overwrite/load buffers here)
[[https://github.com/emacsorphanage/dedicated/tree/f47b504c0c56fa5ab9d1028417ca1f65a713a2f0][emacsorphanage/dedicated at f47b504c0c56fa5ab9d1028417ca1f65a713a2f0]]
Captured On: [2023-07-31 Mon 16:23]
*** TODO Rotate Layout in Emacs
[[https://github.com/daichirata/emacs-rotate/blob/master/rotate.el][emacs-rotate/rotate.el at master · daichirata/emacs-rotate]]
Captured On: [2023-11-23 Thu 12:27]
** Emacs UI Navigation Backlog [0/3]
*** TODO Avy Hydra
#+BEGIN_QUOTE
Avy
Avy is a damned fast way to jump to characters, (sub-)words, and lines. In this hydra I combine it with link-hint, a package based on Avy used to jump-to and open URLs:
(use-package avy
:config
(use-package link-hint)
(global-set-key (kbd "M-g g") #'avy-goto-line)
(defhydra hydra-avy (global-map "M-g" :color blue)
"avy-goto"
("c" avy-goto-char "char")
("C" avy-goto-char-2 "char-2")
("w" avy-goto-word-1 "word")
("s" avy-goto-subword-1 "subword")
("u" link-hint-open-link "open-URI")
("U" link-hint-copy-link "copy-URI")))
#+END_QUOTE
[[https://ericjmritz.wordpress.com/2015/10/14/some-personal-hydras-for-gnu-emacs/][Some Personal Hydras for GNU Emacs – One More Game-Dev and Programming Blog]]
Captured On: [2023-11-19 Sun 16:52]
*** TODO Emacs Zoom to Window
[[https://github.com/emacsorphanage/zoom-window][emacsorphanage/zoom-window: Zoom and Unzoom window]]
Captured On: [2023-11-18 Sat 08:46]
*** TODO Window Moving Hydra To Implement in Emacs
#+BEGIN_QUOTE
Deluxe Window-moving
Includes window resizing, winner undo/reset, follow mode, vertical help
(defhydra hydra-window ()
"
Movement^^ ^Split^ ^Switch^ ^Resize^
----------------------------------------------------------------
_h_ ← _v_ertical _b_uffer _q_ X←
_j_ ↓ _x_ horizontal _f_ind files _w_ X↓
_k_ ↑ _z_ undo _a_ce 1 _e_ X↑
_l_ → _Z_ reset _s_wap _r_ X→
_F_ollow _D_lt Other _S_ave max_i_mize
_SPC_ cancel _o_nly this _d_elete
"
("h" windmove-left )
("j" windmove-down )
("k" windmove-up )
("l" windmove-right )
("q" hydra-move-splitter-left)
("w" hydra-move-splitter-down)
("e" hydra-move-splitter-up)
("r" hydra-move-splitter-right)
("b" helm-mini)
("f" helm-find-files)
("F" follow-mode)
("a" (lambda ()
(interactive)
(ace-window 1)
(add-hook 'ace-window-end-once-hook
'hydra-window/body))
)
("v" (lambda ()
(interactive)
(split-window-right)
(windmove-right))
)
("x" (lambda ()
(interactive)
(split-window-below)
(windmove-down))
)
("s" (lambda ()
(interactive)
(ace-window 4)
(add-hook 'ace-window-end-once-hook
'hydra-window/body)))
("S" save-buffer)
("d" delete-window)
("D" (lambda ()
(interactive)
(ace-window 16)
(add-hook 'ace-window-end-once-hook
'hydra-window/body))
)
("o" delete-other-windows)
("i" ace-maximize-window)
("z" (progn
(winner-undo)
(setq this-command 'winner-undo))
)
("Z" winner-redo)
("SPC" nil)
)
#+END_QUOTE
[[https://github.com/abo-abo/hydra/wiki/Window-Management][Window Management · abo-abo/hydra Wiki]]
Captured On: [2023-11-19 Sun 17:16]
** Emacs UI-Theme Backlog [0/2]
*** TODO Recreate Distinguished-theme.
Call it Dupre or something if you like.
*** TODO Theming for Emacs
#+BEGIN_QUOTE
;;; <OPTIONAL THEMING>
;; Modus-themes are just excellent, easy to read and work really well
;; with code as well as text (org-mode, markdown).
(use-package modus-themes
:ensure t
:config
(setq modus-themes-org-blocks 'gray-background
modus-themes-fringes 'subtle
modus-themes-italic-constructs t
modus-themes-bold-constructs t
modus-themes-syntax '(alt-syntax)
modus-themes-hl-line '(intense)
modus-themes-paren-match '(intense)
modus-themes-mode-line '(borderless))
(setq modus-themes-headings
(quote ((1 . (background overline variable-pitch 1.4))
(2 . (overline rainbow variable-pitch 1.25))
(3 . (overline 1.1))
(t . (monochrome))))))
;; Running modus-themes depending on the time of the day. <ATTENTION>
;; You need to set the longitude and latitude to your city's for this
;; to be accurate.
(use-package solar
:ensure nil
:custom
;; Brussels ;)
(calendar-latitude 50.85)
(calendar-longitude 4.35))
(use-package circadian
:ensure t
:after solar
:config
(setq circadian-themes '((:sunrise . modus-operandi)
(:sunset . modus-vivendi)))
(circadian-setup))
#+END_QUOTE
[[https://gist.github.com/Nathan-Furnal/b327f14e861f009c014af36c1790ec49][Trimmed down python setup for Emacs. This is a basic `init.el` file for Python, you can pick the bits you like.]]
Captured On: [2023-10-16 Mon 14:20]
** Emacs VC Config Backlog [0/9]
*** TODO Abridge-Diff for Long Magit Diff Hunks
[[https://github.com/jdtsmith/abridge-diff][jdtsmith/abridge-diff: Emacs package for refining diff hunks with very long lines (as in LaTeX files)]]
Captured On: [2023-10-27 Fri 11:08]
*** TODO [#A] Figure Out VC Installs and Add Snippet
**** TODO Investigate Vc-install Failure With Wttrin Config
**** TODO Look Into Package-vc-install
[[https://tony-zorman.com/posts/package-vc-install.html][Exploring package-vc-install · Tony Zorman]]
Captured On: [2023-10-20 Fri 13:29]
**** TODO Look Into Vc-use-package
[[https://github.com/slotThe/vc-use-package][slotThe/vc-use-package: Primitive package-vc integration for use-package]]
Captured On: [2023-10-20 Fri 13:30]
**** TODO Reddit Discussion on Package-vc-install
[[https://www.reddit.com/r/emacs/comments/z9i4ce/exploring_packagevcinstall_as_an_alternative_to/][(4) Exploring package-vc-install as an alternative to Quelpa : emacs]]
Captured On: [2023-10-20 Fri 13:32]
**** TODO Video on Vc-install Package
[[https://www.youtube.com/watch?v=uaXgvQCcEl0][(1) Emacs 29 package-vc-install install packages from github - YouTube]]
Captured On: [2023-10-20 Fri 13:31]
*** TODO Git Gutter Hydra Example
#+BEGIN_QUOTE
This one for git-gutter is very handy
(defhydra hydra-git-gutter (:body-pre (git-gutter-mode 1)
:hint nil)
("n" git-gutter:next-hunk "next hunk")
("p" git-gutter:previous-hunk "previous hunk")
("h" (progn (goto-char (point-min)) (git-gutter:next-hunk 1)) "first hunk")
("l" (progn (goto-char (point-min)) (git-gutter:previous-hunk 1)) "last hunk")
("<SPC>" git-gutter:popup-hunk "popup hunk")
("s" git-gutter:stage-hunk "stage hunk")
("r" git-gutter:revert-hunk "revert hunk")
("q" nil "quit"))
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/gr2zaj/what_are_your_useful_hydras/][(2) What are your useful hydras? : emacs]]
Captured On: [2024-03-09 Sat 13:36]
*** TODO Investigate git-walktree for browsing your git repos
[[https://github.com/10sr/git-walktree-el/tree/a1a5490b89d193724ec637818baf2d8edf97c638][10sr/git-walktree-el at a1a5490b89d193724ec637818baf2d8edf97c638]]
Captured On: [2023-07-31 Mon 17:07]
*** TODO Investigate Vdiff and Magit-vdiff packages
#+BEGIN_QUOTE
vdiff
(use-package vdiff
:commands (vdiff-files
vdiff-files3
vdiff-buffers
vdiff-buffers3))
#+END_QUOTE
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-07-31 Mon 17:29]
*** TODO Understand Git Rebase and Squash Workflow in Magit
#+BEGIN_QUOTE
This process can be streamlined significantly — I thought that was what I was about to read — with the magit-commit-fixup/squash commands (c f and c s).
I use those all the time. When you have staged your fixup changes, do c f and then it offers you the log to select which commit you're fixing up (with .). Then, e.g. for original commit title "original commit", it'll make your new commit with title "fixup! original commit".
Subsequently when you interactive rebase, git will reorder and flag the fixups (and squashes) automatically, providing you have the rebase.autosquash config setting set to true. i.e. in ~/.gitconfig:
[rebase]
autosquash = true
(Edited: case typos)
level 2
·
9 yr. ago
You mean c f and c s, lowercase c. The difference here is that this only modifies the latest commit with the currently staged changes. Very handy, but if you want to rewrite history (reword, fixup, reorder commits, edit commits), you will need interactive rebase.
level 3
·
9 yr. ago
Oh right, sorry I screwed up the case thing (edited)
However, I don't know what you mean about the latest commit. This isn't for amending the latest commit (c a), c f and c s is for adding fixup or squash commits for any existing commit.
It's not a replacement for interactive rebasing, it's just a more streamlined way to do it.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/2q7ohw/til_how_to_squash_commits_using_magit/][(4) TIL How to Squash Commits using Magit : emacs]]
Captured On: [2023-10-23 Mon 06:15]
*** TODO Warn When Leaving Dirty Repository
[[https://github.com/thisirs/vc-check-status#vc-check-status][thisirs/vc-check-status: Package that warns you when quitting emacs and leaving a repository dirty.]]
Captured On: [2024-02-29 Thu 10:12]
*** TODO Forge Config
#+BEGIN_QUOTE
(use-package forge
:demand t
:after magit
:hook (forge-post-submit-callback . my/forge-start-timer-for-draft-pullreq)
:config
(progn
(setq-default forge-buffer-draft-p t)
(defun my/forge-start-timer-for-draft-pullreq (pullreq &rest _)
"Start a `tmr' timer if PULLREQ is draft."
(when (map-elt pullreq 'draft)
(when-let* ((url (map-elt pullreq 'url))
(minutes (cond
((string-match-p "foretagsplatsen/monitor" url) 15)
(t 10))))
(require 'tmr)
(tmr minutes (format "Check draft %s" url) t))))))
(use-package forge-topic
:init
(progn
(setq forge-topic-list-limit '(60 . -1))))
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 15:18]
*** TODO Magit Config to Review
#+BEGIN_QUOTE
(use-package magit
:bind ((
:map magit-mode-map
("M-w" . magit-copy-section-value)))
:init
(progn
(setq magit-diff-refine-hunk t)
(setq magit-process-find-password-functions '(magit-process-password-auth-source))
(setq magit-branch-prefer-remote-upstream '("master"))
(setq magit-branch-adjust-remote-upstream-alist '(("origin/master" "master")
("origin/main" "main")))
(setq magit-module-sections-nested nil)
(setq magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
(setq magit-no-confirm '(amend-published trash))
(setq magit-revision-insert-related-refs nil)
(setq magit-revision-show-gravatars t)
(setq magit-clone-set-remote.pushDefault t))
:config
(progn
;; Enable magit-clean
(put 'magit-clean 'disabled nil)
;; Add modules in magit status buffer:
(magit-add-section-hook 'magit-status-sections-hook
'magit-insert-modules
'magit-insert-unpulled-from-upstream)
;; Only show the module sections I'm interested in
(with-eval-after-load "magit-submodule"
(remove-hook 'magit-module-sections-hook 'magit-insert-modules-overview)
(remove-hook 'magit-module-sections-hook 'magit-insert-modules-unpulled-from-pushremote)
(remove-hook 'magit-module-sections-hook 'magit-insert-modules-unpushed-to-upstream)
(remove-hook 'magit-module-sections-hook 'magit-insert-modules-unpushed-to-pushremote))
(transient-replace-suffix 'magit-commit 'magit-commit-autofixup
'("x" "Absorb changes" magit-commit-absorb))
(dir-locals-set-class-variables 'my/magit-huge-git-repository
'((magit-status-mode
.
((eval . (magit-disable-section-inserter 'magit-insert-tags-header))
(eval . (magit-disable-section-inserter 'magit-insert-untracked-files))
(eval . (magit-disable-section-inserter 'magit-insert-modules))))))
(let ((huge-repos
'("~/Documents/projects/nix/nixpkgs-master"
"~/Documents/projects/nix-system/nixpkgs/")))
(dolist (repo huge-repos)
(dir-locals-set-directory-class
(expand-file-name repo)
'my/magit-huge-git-repository)))))
(use-package magit-diff
:bind (
:map magit-diff-section-map
;; disable binding that I use for begining of buffer
("C-x a" . nil)))
(use-package magit-extras
:demand (project magit))
(use-package magit-tbdiff
:demand t
:after magit)
#+END_QUOTE
[[https://github.com/DamienCassou/emacs.d/blob/master/init.el#L352][emacs.d/init.el at master · DamienCassou/emacs.d]]
Captured On: [2024-04-05 Fri 15:19]
** Emacs Window/Buffer Config Backlog [0/1]
*** TODO Investigate Using Popper for Window Management
Demo: https://www.youtube.com/watch?v=E-xUNlZi3rI
Repo: https://github.com/karthink/popper
* Emacs Config Notes
** 2023-11-03 Fri @ 18:28:36 -0500 Break Code Into Divisions
CLOSED: [2023-11-03 Fri 18:28]
** 2023-11-01 Wed @ 10:33:34 -0500 Decision: no need for specific order in init.el
Question: Is there any reason to keep associated functionality adjacent in the init.el list?
Answer: No. In fact, I should prevent the need for ordering. Ordering constraints should be considered a bug.
*** Functionality related to interdependent workflows together: No
Example: Org-agenda leverages org-roam project files in building its agenda.
Does that mean they should be adjacent?
I can adjust this anyway I want. It's best to have these loosely coupled. Since this is the target, I'm going to say I should not specify an order, but when I discover a hard dependency, I should indicate that in the code with the use-package :after clause.
*** Most frequently used functionality: No
I believe this org-reorg project may take time and I will want to use org functionality to take notes without having to launch another version of Emacs from the main branch.
Given this, I should probably do the work in the order I use it, but that doesn't mean it must be ordered that way in init.el.
** 2023-11-01 Wed @ 09:59:35 -0500 General Strategy
All changes will happen in the 'org-reorg' branch, allowing use of Emacs without breakages from changes.
Here's are the major divisions, in priority order.
org-config ;; general settings, keybindings, org-contrib
org-appearance-config ;; bullets, faces, etc.
org-agenda-config ;; org-agenda, org-superagenda, org-todo
org-babel-config ;; org-babel languages/settings, org-tempo
org-capture-config ;; capture templates, refiling, org-web-clipper
org-drill-config ;; org-drill (already broken out)
org-export-config ;; org-export
org-roam-config ;; org-roam (already broken out)
Note: org-mode will be loaded via use-package with a delay of .5 seconds. All other org-* modules will be wrapped in the (with-eval-after-load) function so the code is guaranteed to load after org-mode itself. This avoids some current errors of trying to add a binding to a keymap before it's been created, or similar.
* Emacs Config Testing Notes
** Release Resting Checklist
updated Sunday, April 07, 2024 at 12:44:55 PM CDT
*** TODO No Open Work
*** TODO WIP Code Empty/Disabled
*** TODO Emacs Config Inbox Zero
*** TODO Check for Listed Keys
*** TODO Run all ERT Tests
*** TODO Perf Testing: Sub-Second Launch Time
*** TODO Successful Hands-Off Launch from Git Clone
*** TODO Successful Hands-Off Launch from Archsetup
*** TODO Develop Branch Cleanly Merged Into Main
*** TODO Main Branch Pushed to Github and git.cjennings.net
*** TODO 2 Week Scenario Testing / Bug Fixing
*** TODO Mark Release as DONE and version Create Tag on Repositories
* Emacs Config Examples
** Damien Cassou's Emacs Config
https://github.com/DamienCassou/emacs.d
https://raw.githubusercontent.com/DamienCassou/emacs.d/master/init.el
** Jon Wiegley's Emacs Config
[[https://github.com/jwiegley/dot-emacs/blob/master/init.org][dot-emacs/init.org at master · jwiegley/dot-emacs]]
Captured On: [2023-11-01 Wed 12:01]
** Snosov1's Emacs Config
[[https://github.com/snosov1/dot-emacs][snosov1/dot-emacs: Emacs configuration]]
Captured On: [2023-07-16 Sun 09:21]
** Steve Purcell's Emacs Config
[[https://github.com/purcell/emacs.d][purcell/emacs.d: An Emacs configuration bundle with batteries included]]
Captured On: [2023-11-04 Sat 18:48]
** Protesilaos Stavrou's Emacs Config
[[https://git.sr.ht/~protesilaos/dotfiles/tree/master/item/emacs/.emacs.d][~protesilaos/dotfiles: emacs/.emacs.d/ - sourcehut git]]
Captured On: [2023-11-04 Sat 18:51]
** Brett Lempereur's Emacs Config
[[https://github.com/brett-lempereur/.emacs.d][brett-lempereur/.emacs.d: Portable Emacs configuration]]
Captured On: [2023-11-04 Sat 19:24]
** Bodhizar Batsov's Emacs Configuration
[[https://github.com/bbatsov/emacs.d][bbatsov/emacs.d: My personal Emacs configuration]]
Captured On: [2023-11-04 Sat 23:30]
** Rememberyou's Emacs Config
[[https://github.com/rememberYou/.emacs.d/blob/master/config.org][.emacs.d/config.org at master · rememberYou/.emacs.d]]
Captured On: [2023-11-18 Sat 07:07]
** ThoughtBot's dotfiles
[[https://github.com/thoughtbot/dotfiles][thoughtbot/dotfiles: A set of vim, zsh, git, and tmux configuration files.]]
Captured On: [2024-03-14 Thu 04:36]
* Emacs FAQ/Reference
** Testing REST API with Emacs
[[https://emacs.stackexchange.com/questions/2427/how-to-test-rest-api-with-emacs][package - How to test REST API with Emacs? - Emacs Stack Exchange]]
Captured On: [2023-11-01 Wed 15:58]
** Emacs Keybinding to Lambda
#+BEGIN_QUOTE
Emacs Lisp: Keybinding to Lambda
# The Problem
if you simply bind a key to a lambda with ‘define-key’, the key will be reported by describe-bindings with a ??
For instance
#+begin_src emacs-lisp :tangle no
(define-key global-map [pause]
'(lambda () "say foo" (interactive) (message "foo")))
#+end_src
results in
<pause> ??
# The Solution
A solution is to give the lambda a name describing its function. This wrapper can be used to turn the documentation string into a
name …
#+begin_src emacs-lisp :tangle no
(defun lambda-key (keymap key def)
"Wrap`define-key' to provide documentation."
(set 'sym (make-symbol (documentation def)))
(fset sym def)
(define-key keymap key sym))
#+end_src
Then after …
#+begin_src emacs-lisp :tangle no
(lambda-key global-map [pause]
'(lambda () "say foo" (interactive) (message "foo")))
#+end_src
… the key binding will be described like this:
<pause> say foo
Since ‘lambda-key’ has the same signature as ‘define-key’, you can quickly switch between them. (Tested with Emacs 25.2)
[[https://www.emacswiki.org/emacs?search=%22DocumentingKeyBindingToLambda%22][DocumentingKeyBindingToLambda]]
#+END_QUOTE
[[][]]
Captured On: [2023-11-27 Mon 18:15]
** How do I rebind some keys to another keybinding?
This rebinding intends to shorten a longer keybinding sequence to a shorter one.
Note: this leaves the original longer keybinding in place
#+begin_src emacs-lisp
;; disabled, but leaving for reference on how to rebind keys to another binding
;; (define-key global-map (kbd "C-c g") (kbd "C-c c g"))
#+end_src
** How to set fonts for specific ranges of Unicode codepoints
#+BEGIN_QUOTE
(when (display-graphic-p)
(set-fontset-font "fontset-default"
'(#xe000 . #xe07d)
"FreeMonoTengwar"))
#+END_QUOTE
[[https://github.com/chrisbouchard/dotfiles/blob/9bfbe4566520d9e5d8ca998901e120564982d5eb/home/.spacemacs#L606][dotfiles/home/.spacemacs at 9bfbe4566520d9e5d8ca998901e120564982d5eb · chrisbouchard/dotfiles]]
Captured On: [2023-11-04 Sat 17:08]
** WebKit Downgrade Instructions for Emacs
#+BEGIN_QUOTE
Hi! I'm using Arch Linux and I've finally managed to downgrade webkit2gtk and recompile emacs 29. This is what I've done:
I've installed downgrade using yay from AUR
I've downgraded webkit2gtk to 2.40
$ sudo pacman -Qi webkit2gtk
Name : webkit2gtk
Version : 2.40.5-2
Description : Web content engine for GTK
Architecture : x86_64
URL : https://webkitgtk.org
Licenses : custom
Groups : None
Provides : libjavascriptcoregtk-4.0.so=18-64 libwebkit2gtk-4.0.so=37-64
...
3) I've recompiled emacs using:
$ ./configure -C --prefix=$HOME/.local/opt/emacs-29 --with-json --with-xwidgets --with-mailutils --with-tree-sitter --with-native-compilation --with-imagemagick --with-gif --with-jpeg --with-png --with-xml2 --with-tiff --with-libsystemd --with-modules
$ make -j 4 install
4) Check if emacs binary loads the right shared object:
$ ldd ~/.local/opt/emacs-29/bin/emacs | grep webkit
libwebkit2gtk-4.0.so.37 => /usr/lib/libwebkit2gtk-4.0.so.37 (0x00007fa2d9400000)
5) Started emacs:
~/.local/opt/emacs-29/bin/emacs --with-profile doom
Now I can use xwebkit again. I hope this is useful.
#+END_QUOTE
[[https://www.reddit.com/r/emacs/comments/17g6npv/xwidgetwebkit_has_started_crashing_emacs_sessions/][(1) `xwidget-webkit` has started crashing Emacs sessions : emacs]]
Captured On: [2024-03-20 Wed 09:11]
** Getting Emacs webkit to work on Arch Linux
TLDR: add
#+begin_src sh
-xrm "emacs.synchronous: true"
#+end_src
to the end of the emacs startup command
*** from https://bbs.archlinux.org/viewtopic.php?id=294283
While I was reading through this thread (https://lists.gnu.org/archive/html/bug- … 00651.html) I saw this CLI arguments:
-xrm "emacs.synchronous: true"
When I run Emacs (with xwidget-webkit support enabled) like this:
~/.local/opt/emacs/bin/emacs --init-directory ~/.config/emacs -xrm "emacs.synchronous: true"
xwidget-webkit works!
|