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
|
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>mssola's GNU Emacs configuration</title>
<!-- 2017-12-06 Wed 13:33 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="generator" content="Org-mode" />
<meta name="author" content="Miquel Sabaté Solà" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center; }
.todo { font-family: monospace; color: red; }
.done { color: green; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.right { margin-left: auto; margin-right: 0px; text-align: right; }
.left { margin-left: 0px; margin-right: auto; text-align: left; }
.center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
pre.src-sh:before { content: 'sh'; }
pre.src-bash:before { content: 'sh'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-R:before { content: 'R'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-java:before { content: 'Java'; }
pre.src-sql:before { content: 'SQL'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.right { text-align: center; }
th.left { text-align: center; }
th.center { text-align: center; }
td.right { text-align: right; }
td.left { text-align: left; }
td.center { text-align: center; }
dt { font-weight: bold; }
.footpara:nth-child(2) { display: inline; }
.footpara { display: block; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
/*]]>*/-->
</style>
<link rel="stylesheet" href="http://jo.mssola.com/static/style.css" type="text/css" />
<link rel="stylesheet" href="http://jo.mssola.com/static/org.css" type="text/css" />
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2013 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">mssola's GNU Emacs configuration</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1. Preface</a></li>
<li><a href="#sec-2">2. Introduction</a></li>
<li><a href="#sec-3">3. General</a>
<ul>
<li><a href="#sec-3-1">3.1. GUI</a></li>
<li><a href="#sec-3-2">3.2. Basic editing configuration</a></li>
<li><a href="#sec-3-3">3.3. Font and theme</a></li>
<li><a href="#sec-3-4">3.4. General global key bindings</a></li>
<li><a href="#sec-3-5">3.5. Others</a></li>
</ul>
</li>
<li><a href="#sec-4">4. Calendar</a></li>
<li><a href="#sec-5">5. General purpose defuns</a></li>
<li><a href="#sec-6">6. Lisp packages</a>
<ul>
<li><a href="#sec-6-1">6.1. Custom packages</a></li>
<li><a href="#sec-6-2">6.2. use-package</a></li>
</ul>
</li>
<li><a href="#sec-7">7. Project</a></li>
<li><a href="#sec-8">8. Edit</a></li>
<li><a href="#sec-9">9. Dired</a></li>
<li><a href="#sec-10">10. Evil</a></li>
<li><a href="#sec-11">11. Magit</a></li>
<li><a href="#sec-12">12. mu4e</a></li>
<li><a href="#sec-13">13. org</a>
<ul>
<li><a href="#sec-13-1">13.1. General settings</a></li>
<li><a href="#sec-13-2">13.2. Publishing</a></li>
<li><a href="#sec-13-3">13.3. Agenda</a></li>
<li><a href="#sec-13-4">13.4. Capture</a></li>
<li><a href="#sec-13-5">13.5. Other</a></li>
<li><a href="#sec-13-6">13.6. <span class="todo TODO">TODO</span> shortcut for making an org link, and transforming a link into a proper org link</a></li>
<li><a href="#sec-13-7">13.7. <span class="todo TODO">TODO</span> make it work with evil</a></li>
<li><a href="#sec-13-8">13.8. <span class="todo TODO">TODO</span> Proper keybindings for quick access.</a></li>
<li><a href="#sec-13-9">13.9. <span class="todo TODO">TODO</span> shortcuts for stuff like: create something urgent for today</a></li>
</ul>
</li>
<li><a href="#sec-14">14. IRC</a></li>
<li><a href="#sec-15">15. Languages</a>
<ul>
<li><a href="#sec-15-1">15.1. General</a></li>
<li><a href="#sec-15-2">15.2. Shell</a></li>
<li><a href="#sec-15-3">15.3. Lisp</a></li>
<li><a href="#sec-15-4">15.4. C and C++</a></li>
<li><a href="#sec-15-5">15.5. Ruby</a></li>
<li><a href="#sec-15-6">15.6. Go</a></li>
<li><a href="#sec-15-7">15.7. Rust</a></li>
<li><a href="#sec-15-8">15.8. Tabs vs spaces</a></li>
<li><a href="#sec-15-9">15.9. Inferior markup languages.</a></li>
<li><a href="#sec-15-10">15.10. Web-related stuff.</a></li>
<li><a href="#sec-15-11">15.11. Devops</a></li>
<li><a href="#sec-15-12">15.12. Others</a></li>
</ul>
</li>
<li><a href="#sec-16">16. WoMan</a></li>
<li><a href="#sec-17">17. Misc</a></li>
<li><a href="#sec-18">18. Credits</a></li>
<li><a href="#sec-19">19. License</a></li>
</ul>
</div>
</div>
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Preface</h2>
<div class="outline-text-2" id="text-1">
<p>
This is my attempt of getting my configuration organized with literate
programming and <code>org-babel</code>. I took the workflow I'm following from <a href="https://github.com/larstvei">@larstvei</a>.
The idea is that the <code>init.el</code> file will replace itself on the first execution
with the tangled version of this file. This first version will also be
byte-compiled. This means that all changes are to be made on the <code>init.org</code>
file <b>always</b>. The initial contents of the <code>init.el</code> are:
</p>
<div class="org-src-container">
<pre class="src src-elisp"><span style="color: #808080;">;; </span><span style="color: #808080;">We can't tangle without org!</span>
(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">org</span>)
<span style="color: #808080;">;; </span><span style="color: #808080;">Follow symlinks</span>
(<span style="color: #87afd7;">setq</span> vc-follow-symlinks t)
<span style="color: #808080;">;; </span><span style="color: #808080;">Open the configuration</span>
(find-file (concat user-emacs-directory <span style="color: #ffffaf;">"init.org"</span>))
<span style="color: #808080;">;; </span><span style="color: #808080;">Tangle it</span>
(org-babel-tangle)
<span style="color: #808080;">;; </span><span style="color: #808080;">Load it</span>
(load-file (concat user-emacs-directory <span style="color: #ffffaf;">"init.el"</span>))
<span style="color: #808080;">;; </span><span style="color: #808080;">Finally byte-compile it</span>
(byte-compile-file (concat user-emacs-directory <span style="color: #ffffaf;">"init.el"</span>))
</pre>
</div>
<p>
There is no reason to track the init.el file, and no reason to change this
file. In order to ensure this, make sure to apply the following command after
cloning:
</p>
<div class="org-src-container">
<pre class="src src-sh">git update-index --assume-unchanged emacs/init.el
</pre>
</div>
<p>
Moreover, in order to avoid manually tangling and compiling the <code>init.org</code> file
on each change, the following function is provided:
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">tangle-init</span> ()
<span style="color: #808080;">"If the current buffer is 'init.org' the code-blocks are</span>
<span style="color: #808080;"> tangled, and the tangled file is compiled. Morever, an init.html is generated."</span>
(<span style="color: #87afd7;">when</span> (<span style="color: #87afd7;">or</span> (equal (buffer-file-name)
(expand-file-name (concat user-emacs-directory <span style="color: #ffffaf;">"init.org"</span>)))
(string-suffix-p <span style="color: #ffffaf;">"dotfiles/emacs/init.org"</span> (buffer-file-name)))
<span style="color: #808080;">;; </span><span style="color: #808080;">Avoid running hooks when tangling</span>
(<span style="color: #87afd7;">let</span> ((prog-mode-hook nil))
(org-babel-tangle)
(org-html-export-to-html)
(byte-compile-file (concat user-emacs-directory <span style="color: #ffffaf;">"init.el"</span>)))))
(add-hook 'after-save-hook 'tangle-init)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Introduction</h2>
<div class="outline-text-2" id="text-2">
<p>
I'm using GNU Emacs 25, but everything should be working in GNU Emacs 24. There
are some exceptions to this (e.g. webkit support), but these cases are
individually handled.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">unless</span> (>= emacs-major-version 24)
(<span style="color: #b9dc92;">error</span> <span style="color: #ffffaf;">"Don't be a cheap bastard and upgrade to at least GNU Emacs 24"</span>))
</pre>
</div>
<p>
Temporarily reduce garbage collection so startup time is lower. Idea taken from
<a href="https://github.com/purcell">@purcell</a>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defconst</span> <span style="color: #d0d0d0;">mssola-initial-gc-cons-threshold</span> gc-cons-threshold
<span style="color: #808080;">"Initial value of `</span><span style="color: #ffffaf;">gc-cons-threshold</span><span style="color: #808080;">' at start-up time."</span>)
(<span style="color: #87afd7;">setq</span> gc-cons-threshold (* 1024 1024 1024))
(add-hook 'after-init-hook
(<span style="color: #87afd7;">lambda</span> () (<span style="color: #87afd7;">setq</span> gc-cons-threshold mssola-initial-gc-cons-threshold)))
</pre>
</div>
<p>
User name and email.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> user-full-name <span style="color: #ffffaf;">"Miquel Sabaté Solà"</span>
user-mail-address <span style="color: #ffffaf;">"mikisabate@gmail.com"</span>)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> General</h2>
<div class="outline-text-2" id="text-3">
</div><div id="outline-container-sec-3-1" class="outline-3">
<h3 id="sec-3-1"><span class="section-number-3">3.1</span> GUI</h3>
<div class="outline-text-3" id="text-3-1">
<p>
I like a minimalistic GUI. Because of this, almost all GUI elements have been
disabled or tweaked in some custom way.
</p>
<p>
The frame title is "<login>: <path>". If we are not editing a file, then the
name of the buffer is displayed (e.g. "mssola: <b>scratch</b>").
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> frame-title-format
'((<span style="color: #87afd7;">:eval</span>
(concat (user-real-login-name) <span style="color: #ffffaf;">": "</span>
(<span style="color: #87afd7;">if</span> (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
<span style="color: #ffffaf;">"%b"</span>)))))
</pre>
</div>
<p>
Disable the menu, scroll and tool bars. At the same time, enable line and column
modes.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(menu-bar-mode -1)
(<span style="color: #87afd7;">when</span> (fboundp 'set-scroll-bar-mode)
(set-scroll-bar-mode nil))
(<span style="color: #87afd7;">when</span> (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(<span style="color: #87afd7;">when</span> (fboundp 'tooltip-mode)
(tooltip-mode 0))
(line-number-mode 1)
(column-number-mode 1)
<span style="color: #808080;">;; </span><span style="color: #808080;">Nice scrolling</span>
(<span style="color: #87afd7;">setq</span> scroll-margin 0
scroll-conservatively 100000
scroll-preserve-screen-position 1)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-3-2" class="outline-3">
<h3 id="sec-3-2"><span class="section-number-3">3.2</span> Basic editing configuration</h3>
<div class="outline-text-3" id="text-3-2">
<p>
Use UTF-8 <b>always</b>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment 'utf-8)
</pre>
</div>
<p>
Some editing tweaks like tabs vs spaces, maximum column width, etc.
</p>
<div class="org-src-container">
<pre class="src src-elisp"><span style="color: #808080;">;; </span><span style="color: #808080;">Emacs modes typically provide a standard means to change the indentation</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">width (e.g. c-basic-offset). Moreover, even though I prefer tabs over space,</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">for most coding conventions this is not the case (e.g. ruby). For this</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">reason, I will disable them by default and enabled them back for each</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">specific case (e.g. C). I'm also using the smart-tabs-mode package, see</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">below in the languages section.</span>
(<span style="color: #87afd7;">setq-default</span> indent-tabs-mode nil)
(<span style="color: #87afd7;">setq-default</span> tab-width 4)
<span style="color: #808080;">;; </span><span style="color: #808080;">Maximum 80 columns.</span>
(<span style="color: #87afd7;">setq-default</span> fill-column 80)
(<span style="color: #87afd7;">setq-default</span> auto-fill-function 'do-auto-fill)
<span style="color: #808080;">;; </span><span style="color: #808080;">Do not break lines</span>
(set-default 'truncate-lines t)
<span style="color: #808080;">;; </span><span style="color: #808080;">Delete the selection with a keypress.</span>
(delete-selection-mode t)
<span style="color: #808080;">;; </span><span style="color: #808080;">Remove whitespaces at the end of line</span>
(add-hook 'before-save-hook 'delete-trailing-whitespace)
<span style="color: #808080;">;; </span><span style="color: #808080;">Cursor</span>
(blink-cursor-mode 0)
(global-hl-line-mode -1)
(show-paren-mode 1)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-3-3" class="outline-3">
<h3 id="sec-3-3"><span class="section-number-3">3.3</span> Font and theme</h3>
<div class="outline-text-3" id="text-3-3">
<p>
I'm using "Droid Sans Mono" simply because I've grown used to it.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(set-frame-font <span style="color: #ffffaf;">"Droid Sans Mono Dotted for Powerline-10"</span>)
(add-to-list 'default-frame-alist '(font . <span style="color: #ffffaf;">"Droid Sans Mono Dotted for Powerline-10"</span>))
<span style="color: #808080;">; </span><span style="color: #808080;">Emacs in daemon mode does not like `set-face-attribute` because this is only</span>
<span style="color: #808080;">; </span><span style="color: #808080;">applied if there is a frame in place, which doesn't happen when starting the</span>
<span style="color: #808080;">; </span><span style="color: #808080;">daemon. Thus, we should call that after the frame has been created (e.g. by</span>
<span style="color: #808080;">; </span><span style="color: #808080;">emacsclient).</span>
<span style="color: #808080;">; </span><span style="color: #808080;">See: https://lists.gnu.org/archive/html/help-gnu-emacs/2015-03/msg00016.html</span>
(add-hook 'after-make-frame-functions-hook
(<span style="color: #87afd7;">lambda</span> ()
(set-face-attribute 'default t <span style="color: #87afd7;">:font</span> <span style="color: #ffffaf;">"Droid Sans Mono Dotted for Powerline-10"</span>)))
</pre>
</div>
<p>
I've hacked my own theme called <a href="https://github.com/mssola/soria">soria</a>. This theme combines the vim theme
<a href="http://www.vim.org/scripts/script.php?script_id=2140">xoria256</a> with the <a href="http://opensuse.github.io/branding-guidelines/">openSUSE branding guidelines</a>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(load-theme 'soria t)
</pre>
</div>
<p>
When hacking your own theme, sometimes you want to know what face is the one
that you see on the screen right now. This function from <a href="https://github.com/thblt/DotFiles">@thblt</a> allows me to
get exactly that:
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-face-at-point</span> (pos)
<span style="color: #808080;">"Writes a message with the name of the face at the current point. The POS</span>
<span style="color: #808080;"> argument contains the current position of the cursor."</span>
(<span style="color: #87afd7;">interactive</span> <span style="color: #ffffaf;">"d"</span>)
(<span style="color: #87afd7;">let</span> ((face (<span style="color: #87afd7;">or</span> (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(<span style="color: #87afd7;">if</span> face (message <span style="color: #ffffaf;">"Face: %s"</span> face) (message <span style="color: #ffffaf;">"No face at %d"</span> pos))))
(global-set-key (kbd <span style="color: #ffffaf;">"C-c f"</span>) 'mssola-face-at-point)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-3-4" class="outline-3">
<h3 id="sec-3-4"><span class="section-number-3">3.4</span> General global key bindings</h3>
<div class="outline-text-3" id="text-3-4">
<p>
Use kill-this-buffer instead of kill-buffer.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(global-set-key (kbd <span style="color: #ffffaf;">"C-x k"</span>) 'kill-this-buffer)
</pre>
</div>
<p>
Disable C-z. It will later on be picked up by Evil's config as the escape
sequence. This is here to make sure that it will be disabled even if Evil
cannot be loaded due to some error.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(global-unset-key (kbd <span style="color: #ffffaf;">"C-z"</span>))
</pre>
</div>
<p>
Disable all the Fn keys.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">dotimes</span> (i 12)
(global-unset-key (kbd (format <span style="color: #ffffaf;">"<f%d>"</span> (+ i 1)))))
</pre>
</div>
<p>
Disable overwrite-mode.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(define-key global-map [(insert)] nil)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-3-5" class="outline-3">
<h3 id="sec-3-5"><span class="section-number-3">3.5</span> Others</h3>
<div class="outline-text-3" id="text-3-5">
<p>
Revert buffers automatically when underlying files are changed externally.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(global-auto-revert-mode t)
</pre>
</div>
<p>
Follow symlinks.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> vc-follow-symlinks t)
</pre>
</div>
<p>
Remove the initial message from the scratch buffer.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> initial-scratch-message nil)
</pre>
</div>
<p>
Never kill the scratch buffer, bury it instead.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defadvice</span> <span style="color: #d0d0d0;">kill-buffer</span> (around kill-buffer-around-advice activate)
(<span style="color: #87afd7;">let</span> ((buffer-to-kill (ad-get-arg 0)))
(<span style="color: #87afd7;">if</span> (equal buffer-to-kill <span style="color: #ffffaf;">"*scratch*"</span>)
(bury-buffer)
ad-do-it)))
(<span style="color: #87afd7;">defadvice</span> <span style="color: #d0d0d0;">kill-this-buffer</span> (around kill-buffer-around-advice activate)
(<span style="color: #87afd7;">let</span> ((buffer-to-kill (ad-get-arg 0)))
(<span style="color: #87afd7;">if</span> (equal buffer-to-kill <span style="color: #ffffaf;">"*scratch*"</span>)
(bury-buffer)
ad-do-it)))
</pre>
</div>
<p>
No backups
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq-default</span> make-backup-files nil)
(<span style="color: #87afd7;">setq-default</span> auto-save-default nil)
</pre>
</div>
<p>
But at least save the list of recently open files.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">recentf</span>)
(recentf-mode 1)
(global-set-key <span style="color: #ffffaf;">"\C-x\ \C-r"</span> 'recentf-open-files)
<span style="color: #808080;">; </span><span style="color: #808080;">Save the list every 5 minutes</span>
(run-at-time nil (* 5 60) 'recentf-save-list)
</pre>
</div>
<p>
No welcome screen
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq-default</span> inhibit-startup-message t)
</pre>
</div>
<p>
Enable y/n answers
</p>
<div class="org-src-container">
<pre class="src src-elisp">(fset 'yes-or-no-p 'y-or-n-p)
</pre>
</div>
<p>
Let flyspell be performant.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defvar</span> <span style="color: #d0d0d0;">flyspell-issue-message-flag</span> nil)
</pre>
</div>
<p>
Save custom-variables somewhere else.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> custom-file (expand-file-name <span style="color: #ffffaf;">"custom.el"</span> user-emacs-directory))
(<span style="color: #87afd7;">if</span> (file-exists-p custom-file)
(load custom-file))
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-sec-4" class="outline-2">
<h2 id="sec-4"><span class="section-number-2">4</span> Calendar</h2>
<div class="outline-text-2" id="text-4">
<p>
We catalans start our weeks on Monday.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defvar</span> <span style="color: #d0d0d0;">calendar-week-start-day</span> 1)
</pre>
</div>
<p>
Global key binding.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(global-set-key (kbd <span style="color: #ffffaf;">"M-c"</span>) 'calendar)
</pre>
</div>
<p>
Fix some stuff for evil mode.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">with-eval-after-load</span> <span style="color: #ffffaf;">"evil"</span>
(evil-set-initial-state 'calendar-mode 'normal)
(<span style="color: #87afd7;">evil-define-key</span> 'normal calendar-mode-map
<span style="color: #ffffaf;">"j"</span> 'calendar-forward-week
<span style="color: #ffffaf;">"k"</span> 'calendar-backward-week
<span style="color: #ffffaf;">"b"</span> 'calendar-backward-day
<span style="color: #ffffaf;">"h"</span> 'calendar-backward-day
<span style="color: #ffffaf;">"l"</span> 'calendar-forward-day
<span style="color: #ffffaf;">"w"</span> 'calendar-forward-day
<span style="color: #ffffaf;">"q"</span> 'calendar-exit
<span style="color: #ffffaf;">"\C-h"</span> 'evil-window-left
<span style="color: #ffffaf;">"\C-l"</span> 'evil-window-right
<span style="color: #ffffaf;">"\C-j"</span> 'evil-window-down
<span style="color: #ffffaf;">"\C-k"</span> 'evil-window-up
<span style="color: #ffffaf;">"\C-n"</span> 'calendar-scroll-left-three-months
<span style="color: #ffffaf;">"\C-p"</span> 'calendar-scroll-right-three-months))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-5" class="outline-2">
<h2 id="sec-5"><span class="section-number-2">5</span> General purpose defuns</h2>
<div class="outline-text-2" id="text-5">
<p>
I want to read the latest news. That's why I define a function that downloads
the <code>NEWS</code> file from the git server and then opens it in a buffer.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-view-emacs-latest-news</span> ()
<span style="color: #808080;">"Allow users to fetch the latest Emacs' NEWS file."</span>
(<span style="color: #87afd7;">interactive</span>)
(url-copy-file
<span style="color: #ffffaf;">"http://git.savannah.gnu.org/cgit/emacs.git/plain/etc/NEWS"</span>
<span style="color: #ffffaf;">"/tmp/emacs-news"</span> t)
(find-file-read-only <span style="color: #ffffaf;">"/tmp/emacs-news"</span> t))
</pre>
</div>
<p>
Sometimes I want to debug my initialization time.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">emacs-init-time</span> ()
<span style="color: #808080;">"Redefine the `</span><span style="color: #ffffaf;">emacs-init-time</span><span style="color: #808080;">' function so it is more detailed.</span>
<span style="color: #808080;">Idea taken from @purcell."</span>
(<span style="color: #87afd7;">interactive</span>)
(<span style="color: #87afd7;">let</span> ((init-time
(float-time (time-subtract after-init-time before-init-time))))
(message <span style="color: #ffffaf;">"%.3fs"</span> init-time)))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-6" class="outline-2">
<h2 id="sec-6"><span class="section-number-2">6</span> Lisp packages</h2>
<div class="outline-text-2" id="text-6">
</div><div id="outline-container-sec-6-1" class="outline-3">
<h3 id="sec-6-1"><span class="section-number-3">6.1</span> Custom packages</h3>
<div class="outline-text-3" id="text-6-1">
<p>
Compile the <code>g.el</code> script and bind it to <kbd>M-g</kbd>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(byte-compile-file (concat user-emacs-directory <span style="color: #ffffaf;">"lisp/g.el"</span>) t)
(global-set-key (kbd <span style="color: #ffffaf;">"M-g"</span>) 'g)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-6-2" class="outline-3">
<h3 id="sec-6-2"><span class="section-number-3">6.2</span> use-package</h3>
<div class="outline-text-3" id="text-6-2">
<p>
Initialize package.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">package</span>)
(add-to-list 'package-archives
'(<span style="color: #ffffaf;">"melpa"</span> . <span style="color: #ffffaf;">"http://melpa.milkbox.net/packages/"</span>) t)
(add-to-list 'package-archives
'(<span style="color: #ffffaf;">"melpa-stable"</span> . <span style="color: #ffffaf;">"https://stable.melpa.org/packages/"</span>) t)
(package-initialize)
</pre>
</div>
<p>
I'm using use-package to handle my installed packages. I don't know if it's
the best option or what because I haven't tested all the package managers
for Emacs out there. After trying some custom functions to handle
package-install, I decided on use-package because I feel more well-organized.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">unless</span> (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
</pre>
</div>
<p>
Some <code>use-package</code> calls require <code>diminish.el</code> to be available. So, let's
require it here on the very top.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">diminish</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-sec-7" class="outline-2">
<h2 id="sec-7"><span class="section-number-2">7</span> Project</h2>
<div class="outline-text-2" id="text-7">
<p>
First of all, load the silver searcher, which is a convenient and fast searcher.
Ayo silver!
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">ag</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
<span style="color: #808080;">; </span><span style="color: #808080;">Avoid some disagreements between ag and evil.</span>
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil
(add-hook 'ag-mode-hook
(<span style="color: #87afd7;">lambda</span> ()
(define-key ag-mode-map (kbd <span style="color: #ffffaf;">"n"</span>) 'evil-search-next)
(define-key ag-mode-map (kbd <span style="color: #ffffaf;">"N"</span>) 'evil-search-previous)
(define-key ag-mode-map (kbd <span style="color: #ffffaf;">"gg"</span>) 'evil-goto-first-line))))
(<span style="color: #87afd7;">setq</span> ag-reuse-buffers t)
(<span style="color: #87afd7;">setq</span> ag-reuse-window t))
</pre>
</div>
<p>
Then, for keeping up with my projects I use the Projectile + Helm combination.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">projectile</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(projectile-mode 1))
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">helm</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(<span style="color: #87afd7;">setq</span> projectile-completion-system 'helm)
<span style="color: #808080;">; </span><span style="color: #808080;">Allow the search pattern to be on the header. Taken from this Reddit thread:</span>
<span style="color: #808080;">; </span><span style="color: #808080;">https://www.reddit.com/r/emacs/comments/3asbyn/new_and_very_useful_helm_feature_enter_search/</span>
(<span style="color: #87afd7;">setq</span> helm-echo-input-in-header-line t)
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">helm-hide-minibuffer-maybe</span> ()
<span style="color: #808080;">"Hide the minibuffer if we are in a Helm session"</span>
(<span style="color: #87afd7;">when</span> (<span style="color: #87afd7;">with-helm-buffer</span> helm-echo-input-in-header-line)
(<span style="color: #87afd7;">let</span> ((ov (make-overlay (point-min) (point-max) nil nil t)))
(overlay-put ov 'window (selected-window))
(overlay-put ov 'face (<span style="color: #87afd7;">let</span> ((bg-color (face-background 'default nil)))
`(<span style="color: #87afd7;">:background</span> ,bg-color <span style="color: #87afd7;">:foreground</span> ,bg-color)))
(<span style="color: #87afd7;">setq-local</span> cursor-type nil))))
(add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)
(<span style="color: #87afd7;">setq</span> helm-split-window-inside-p t)
<span style="color: #808080;">; </span><span style="color: #808080;">Preview files with tab</span>
(define-key helm-map (kbd <span style="color: #ffffaf;">"<tab>"</span>) 'helm-execute-persistent-action)
<span style="color: #808080;">; </span><span style="color: #808080;">Show available options</span>
(define-key helm-map (kbd <span style="color: #ffffaf;">"C-a"</span>) 'helm-select-action)
<span style="color: #808080;">; </span><span style="color: #808080;">Some vim-like bindings</span>
(define-key helm-map (kbd <span style="color: #ffffaf;">"C-j"</span>) 'helm-next-line)
(define-key helm-map (kbd <span style="color: #ffffaf;">"C-k"</span>) 'helm-previous-line)
(global-set-key (kbd <span style="color: #ffffaf;">"M-x"</span>) 'helm-M-x)
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">helm-ag</span>
<span style="color: #87afd7;">:ensure</span> t))
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">helm-projectile</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(helm-projectile-on)
<span style="color: #808080;">; </span><span style="color: #808080;">Define M-p as a way to quickly list all the available projects.</span>
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"M-p"</span>)
'helm-projectile-switch-project)))
</pre>
</div>
<p>
I use <kbd>C-p</kbd> as the binding for listing relevant files. This
binding works either by using <code>helm-projectile</code> or the regular <code>helm-find</code>
function. As a final touch, this binding also works for listing channels in ERC
buffers.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-erc-helm-buffer-list</span> ()
<span style="color: #808080;">"Returns a list with the ERC buffers."</span>
(mapcar 'buffer-name (erc-buffer-list)))
(<span style="color: #87afd7;">defconst</span> <span style="color: #d0d0d0;">mssola-helm-source-erc-channel-list</span>
'((name . <span style="color: #ffffaf;">"ERC Channels"</span>)
(candidates . mssola-erc-helm-buffer-list)
(action . switch-to-buffer)))
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-erc-helm-switch-buffer</span> ()
<span style="color: #808080;">"Use helm to select an active ERC buffer."</span>
(<span style="color: #87afd7;">interactive</span>)
(helm <span style="color: #87afd7;">:sources</span> '(mssola-helm-source-erc-channel-list)
<span style="color: #87afd7;">:buffer</span> <span style="color: #ffffaf;">"*helm-erc-channels*"</span>))
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-find-file</span> ()
<span style="color: #808080;">"Call the proper Helm function for finding files."</span>
(<span style="color: #87afd7;">interactive</span>)
(<span style="color: #87afd7;">if</span> (string= major-mode <span style="color: #ffffaf;">"erc-mode"</span>)
(mssola-erc-helm-switch-buffer)
(<span style="color: #87afd7;">condition-case</span> nil
(helm-projectile-find-file)
(<span style="color: #b9dc92;">error</span>
(helm-find-files nil)))))
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-p"</span>) 'mssola-find-file))
</pre>
</div>
<p>
Similarly, <code>helm-ag</code> has two functions for applying <code>ag</code> on the project. I'm
binding to <kbd>,a</kbd> a function that calls to the proper function.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-helm-ag</span> ()
<span style="color: #808080;">"Call the right ag command for helm-ag."</span>
(<span style="color: #87afd7;">interactive</span>)
(<span style="color: #87afd7;">condition-case</span> nil
(helm-ag-project-root)
(<span style="color: #b9dc92;">error</span> (helm-ag))))
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil-leader
(evil-leader/set-key <span style="color: #ffffaf;">"a"</span> 'mssola-helm-ag))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-8" class="outline-2">
<h2 id="sec-8"><span class="section-number-2">8</span> Edit</h2>
<div class="outline-text-2" id="text-8">
<p>
In this section I define some useful packages for editing. First of all, one of
the coolest packages out there is <code>undo-tree</code>. It allows you to navigate through
the undo history in a tree (because GNU Emacs is cool and keeps track of undo
actions in a tree structure instead of in a stack). This package is included in
recent versions of GNU Emacs.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">with-eval-after-load</span> 'undo-tree
(global-undo-tree-mode 1)
(<span style="color: #87afd7;">setq</span> undo-tree-visualizer-diff t
undo-tree-visualizer-timestamps t
undo-tree-visualizer-relative-timestamps t)
(diminish 'undo-tree-mode)
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil-leader
(evil-leader/set-key
<span style="color: #ffffaf;">"u"</span> 'undo-tree-visualize)))
</pre>
</div>
<p>
Another important package is <code>flycheck</code>, which is an on-the-fly syntax checking
extension. This works with lots of languages with proper glue code.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">let-alist</span>
<span style="color: #87afd7;">:ensure</span> t)
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">flycheck</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:diminish</span>
<span style="color: #87afd7;">:config</span>
(add-hook 'after-init-hook 'global-flycheck-mode)
<span style="color: #808080;">;; </span><span style="color: #808080;">Only show the errors buffer if it isn't there and if I'm saving the</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">buffer.</span>
(<span style="color: #87afd7;">setq</span> flycheck-emacs-lisp-load-path 'inherit)
(<span style="color: #87afd7;">setq</span> flycheck-check-syntax-automatically '(mode-enabled save))
(<span style="color: #87afd7;">setq</span> flycheck-display-errors-function
#'flycheck-display-error-messages-unless-error-list))
</pre>
</div>
<p>
A recurring issue in speeches and presentations is that when showing something
with your editor, you have to increase/decrease the fonts. I use the
<code>default-text-scale</code> package for this.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">default-text-scale</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(global-set-key (kbd <span style="color: #ffffaf;">"C-+"</span>) 'default-text-scale-increase)
(global-set-key (kbd <span style="color: #ffffaf;">"C--"</span>) 'default-text-scale-decrease))
</pre>
</div>
<p>
Some languages use some delimiters a lot (e.g. lisp languages and
parenthesis). For this reason I'm using the <code>rainbow-delimiters</code> package, which
properly highlights each level in a different way (provided that your theme
supports it).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">rainbow-delimiters</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
<p>
I never use the mouse.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">disable-mouse</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(global-disable-mouse-mode)
(<span style="color: #87afd7;">setq</span> global-disable-mouse-mode-lighter <span style="color: #ffffaf;">""</span>))
</pre>
</div>
<p>
Sometimes you begin typing a prefix, but then you forget the following
chord. For this reason <code>which-key</code> was created. It will show the available
commands for the current chord as a list.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">which-key</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:diminish</span> which-key-mode
<span style="color: #87afd7;">:config</span>
(which-key-mode))
</pre>
</div>
<p>
For some modes it is important to count the number of words in the text. For
this, we have <code>wc-mode</code>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">wc-mode</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
<p>
Next on the list, we have <code>writeroom-mode</code>. I honestly don't use this package
that often, but it's cool to have a distraction-free screen from time to time.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">writeroom-mode</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
<p>
The <code>expand-region</code> package is an extension that is based on a Vim one, which
expands the region of selection with a single key chord. Even if evil covers
most of my uses, it's convenient to have this tool anyways.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">expand-region</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
<span style="color: #808080;">; </span><span style="color: #808080;">Set C-e as the expand command (mnemonic: expand). This command will</span>
<span style="color: #808080;">; </span><span style="color: #808080;">supercede the evil binding for "move one line", which I never use anyways.</span>
(global-set-key (kbd <span style="color: #ffffaf;">"\C-e"</span>) 'er/expand-region)
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"\C-e"</span>) 'er/expand-region)
(define-key evil-visual-state-map (kbd <span style="color: #ffffaf;">"\C-e"</span>) 'er/expand-region)))
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">er/add-text-mode-expansions</span> ()
<span style="color: #808080;">"This way we can also expand the region into paragraphs & pages in text mode.</span>
<span style="color: #808080;">Directly taken from: https://github.com/magnars/expand-region.el."</span>
(set (make-local-variable 'er/try-expand-list) (append
er/try-expand-list
'(mark-paragraph
mark-page))))
(add-hook 'text-mode-hook 'er/add-text-mode-expansions)
</pre>
</div>
<p>
Editing files as root is a bit of a pain because usually the root user doesn't
have the same configuration as the current one, and attempting to do so can be
messy. So, instead of that, we could advice the <code>find-file</code> function so if the
file is not writable by the current user, then GNU Emacs will ask for editing
this same file as root:
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defadvice</span> <span style="color: #d0d0d0;">find-file</span> (after find-file-sudo activate)
<span style="color: #808080;">"Find file as root if necessary."</span>
(<span style="color: #87afd7;">if</span> (<span style="color: #87afd7;">and</span> buffer-file-name
(not (file-writable-p buffer-file-name)))
(<span style="color: #87afd7;">if</span> (yes-or-no-p <span style="color: #ffffaf;">"Do you want to edit this file as root?"</span>)
(find-alternate-file (concat <span style="color: #ffffaf;">"/sudo:root@localhost:"</span> buffer-file-name)))))
</pre>
</div>
<p>
<code>YASnippet</code> allows people to define shortcuts for writing some common blocks.
Moreover, it comes with a set of builtin snippets already. Since I don't
remember some of these snippets, I've mapped <kbd>, h</kbd> to
<code>yas-describe-tables</code>, which shows the available snippets in another buffer.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">yasnippet</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:diminish</span> yas-minor-mode
<span style="color: #87afd7;">:init</span> (yas-global-mode)
<span style="color: #87afd7;">:config</span>
(yas-global-mode 1)
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil-leader
(evil-leader/set-key <span style="color: #ffffaf;">"h"</span> 'yas-describe-tables)))
</pre>
</div>
<p>
<code>bool-flip</code> is a very simple utility that toggles truthy/falsey values.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">bool-flip</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(global-set-key (kbd <span style="color: #ffffaf;">"C-c b"</span>) 'bool-flip-do-flip))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-9" class="outline-2">
<h2 id="sec-9"><span class="section-number-2">9</span> Dired</h2>
<div class="outline-text-2" id="text-9">
<p>
I use dired mode mainly for attaching document into emails. That being said,
whenever I use it, I want basic evil movement.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">with-eval-after-load</span> 'evil
(<span style="color: #87afd7;">evil-add-hjkl-bindings</span> dired-mode-map 'normal
(kbd <span style="color: #ffffaf;">"w"</span>) 'evil-forward-word-begin))
</pre>
</div>
<p>
I also extend <code>dired</code> with some handy tweaks.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> directory-free-space-args <span style="color: #ffffaf;">"-Pkh"</span>
dired-dwim-target t
dired-omit-mode nil
dired-recursive-copies 'always
dired-recursive-deletes 'always
delete-old-versions t)
</pre>
</div>
<p>
And now instruct dired mode how to attach files when using mu4e. This is taken
from the <a href="https://www.djcbsoftware.nl/code/mu/mu4e/Dired.html#Dired">mu4e documentation</a>, and it's available by typing
<kbd>C-c RET C-a</kbd>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">gnus-dired</span>)
<span style="color: #808080;">;; </span><span style="color: #808080;">Make the `</span><span style="color: #ffffaf;">gnus-dired-mail-buffers</span><span style="color: #808080;">' function also work on message-mode derived</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">modes, such as mu4e-compose-mode.</span>
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">gnus-dired-mail-buffers</span> ()
<span style="color: #808080;">"Return a list of active message buffers."</span>
(<span style="color: #87afd7;">let</span> (buffers)
(<span style="color: #87afd7;">save-current-buffer</span>
(<span style="color: #87afd7;">dolist</span> (buffer (buffer-list t))
(set-buffer buffer)
(<span style="color: #87afd7;">when</span> (<span style="color: #87afd7;">and</span> (derived-mode-p 'message-mode)
(null message-sent-message-via))
(<span style="color: #87afd7;">push</span> (buffer-name buffer) buffers))))
(nreverse buffers)))
(<span style="color: #87afd7;">setq</span> gnus-dired-mail-mode 'mu4e-user-agent)
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-10" class="outline-2">
<h2 id="sec-10"><span class="section-number-2">10</span> Evil</h2>
<div class="outline-text-2" id="text-10">
<p>
Forgive me, <a href="https://stallman.org/saint.html">Father</a>, for I have sinned. I've been exposed to modal editing
through Vim, and that has changed how I view editing for the foreseeable future.
Because of this, I use Evil. The following blocks include some heavy-lifting so
Evil and GNU Emacs work without hitting each other, and it also includes some
Evil extensions.
</p>
<p>
First of all, let's define a function that will be called whenever Evil is loaded.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-evil</span> ()
<span style="color: #808080;">"Configure evil mode."</span>
<span style="color: #808080;">; </span><span style="color: #808080;">We can safely remap <C-u> because the counting will be handled a-la Vim.</span>
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-u"</span>) 'evil-scroll-up)
<span style="color: #808080;">; </span><span style="color: #808080;">Make window navigation easier.</span>
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-j"</span>) 'evil-window-down)
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-k"</span>) 'evil-window-up)
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-l"</span>) 'evil-window-right)
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-h"</span>) 'evil-window-left)
<span style="color: #808080;">; </span><span style="color: #808080;">The window navigation tweaks effectively wipe out the help prefix, which</span>
<span style="color: #808080;">; </span><span style="color: #808080;">is bad. Fortunately we can workaround this by providing "M-h" as the new</span>
<span style="color: #808080;">; </span><span style="color: #808080;">help prefix. This prefix is only used in emacs mode to mark lines, which is</span>
<span style="color: #808080;">; </span><span style="color: #808080;">something already handled by Evil.</span>
(define-key global-map (kbd <span style="color: #ffffaf;">"M-h"</span>) 'help-command)
(fset 'help-command help-map)
<span style="color: #808080;">; </span><span style="color: #808080;">I use the Super key in combination with j & k to move around i3. Let's unset</span>
<span style="color: #808080;">; </span><span style="color: #808080;">M- combos for these two fellows for whenever I misstype them.</span>
(global-unset-key (kbd <span style="color: #ffffaf;">"M-j"</span>))
(global-unset-key (kbd <span style="color: #ffffaf;">"M-k"</span>))
<span style="color: #808080;">; </span><span style="color: #808080;">both this function and the subsequent lines about [escape] are taken from</span>
<span style="color: #808080;">; </span><span style="color: #808080;">@aaronbieber configuration.</span>
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">minibuffer-keyboard-quit</span> ()
<span style="color: #808080;">"Abort recursive edit.</span>
<span style="color: #808080;">In Delete Selection mode, if the mark is active, just deactivate it;</span>
<span style="color: #808080;">then it takes a second \\[</span><span style="color: #ffffaf;">keyboard-quit</span><span style="color: #808080;">] to abort the minibuffer."</span>
(<span style="color: #87afd7;">interactive</span>)
(<span style="color: #87afd7;">if</span> (<span style="color: #87afd7;">and</span> delete-selection-mode transient-mark-mode mark-active)
(<span style="color: #87afd7;">setq</span> deactivate-mark t)
(<span style="color: #87afd7;">when</span> (get-buffer <span style="color: #ffffaf;">"*Completions*"</span>) (delete-windows-on <span style="color: #ffffaf;">"*Completions*"</span>))
(abort-recursive-edit)))
<span style="color: #808080;">;; </span><span style="color: #808080;">Make escape quit everything, whenever possible.</span>
(define-key evil-normal-state-map [escape] 'keyboard-quit)
(define-key evil-visual-state-map [escape] 'keyboard-quit)
(define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
<span style="color: #808080;">; </span><span style="color: #808080;">I store macros on the <q> register for convenience, so I used to use the</span>
<span style="color: #808080;">; </span><span style="color: #808080;"><C-q> combo to execute this macro in Vim. In Emacs though, this combo is</span>
<span style="color: #808080;">; </span><span style="color: #808080;">reserved to a rather useful function, and I'd like to keep it that way. So,</span>
<span style="color: #808080;">; </span><span style="color: #808080;">now the mapping is set to <C-2> (mnemonic: where the @ symbol is). Moreover,</span>
<span style="color: #808080;">; </span><span style="color: #808080;">it's applied as many times as specified by the numeric prefix argument.</span>
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-2"</span>)
(<span style="color: #87afd7;">lambda</span> (n)
(<span style="color: #87afd7;">interactive</span> <span style="color: #ffffaf;">"p"</span>)
(evil-execute-macro n <span style="color: #ffffaf;">"@q"</span>)))
<span style="color: #808080;">; </span><span style="color: #808080;">C-s: switch to normal mode and save the buffer. I know :)</span>
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-s"</span>) 'save-buffer)
(define-key evil-insert-state-map (kbd <span style="color: #ffffaf;">"C-s"</span>)
(<span style="color: #87afd7;">lambda</span> () (<span style="color: #87afd7;">interactive</span>) (save-buffer) (evil-force-normal-state))))
</pre>
</div>
<p>
Now make sure that Evil is installed, and call the relevant configuration functions.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">evil</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(add-hook 'evil-mode-hook 'mssola-evil)
(evil-mode 1)
<span style="color: #808080;">;; </span><span style="color: #808080;">C-z is unused and it's close to my beloved C-c. Since I don't want to mess</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">with one of the most sacred Emacs prefixes, I'm moving to C-z.</span>
(define-key key-translation-map (kbd <span style="color: #ffffaf;">"C-z"</span>) [escape])
(define-key evil-operator-state-map (kbd <span style="color: #ffffaf;">"C-z"</span>) 'keyboard-quit)
(set-quit-char <span style="color: #ffffaf;">"C-z"</span>)
<span style="color: #808080;">;; </span><span style="color: #808080;">Use the proper initial evil state for the following modes.</span>
(evil-set-initial-state 'help-mode 'normal)
(evil-set-initial-state 'debugger-mode 'normal)
(evil-set-initial-state 'describe-mode 'normal)
(evil-set-initial-state 'Buffer-menu-mode 'normal)
</pre>
</div>
<p>
If Evil was properly loaded, then make sure that the following Evil-related
packages are installed and configured as well. I start by defining the
<code>evil-leader</code> package, which brings the <kbd>leader</kbd> feature from
Vim into Evil.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">evil-leader</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(global-evil-leader-mode)
(evil-leader/set-leader <span style="color: #ffffaf;">","</span>)
(<span style="color: #87afd7;">setq</span> evil-leader/in-all-states 1)
(evil-leader/set-key
<span style="color: #ffffaf;">","</span> 'back-to-indentation
<span style="color: #ffffaf;">"c"</span> 'delete-window
<span style="color: #ffffaf;">"k"</span> 'kill-buffer-and-window
<span style="color: #ffffaf;">"v"</span> 'split-window-right
<span style="color: #ffffaf;">"V"</span> (<span style="color: #87afd7;">lambda</span> () (<span style="color: #87afd7;">interactive</span>) (split-window-right) (other-window 1))
<span style="color: #ffffaf;">"f"</span> 'flycheck-list-errors
<span style="color: #ffffaf;">"e"</span> 'eval-last-sexp
<span style="color: #ffffaf;">"b"</span> 'view-buffer
<span style="color: #ffffaf;">"o"</span> 'browse-url-at-point))
</pre>
</div>
<p>
Another handy Vim plugin that has made it into Evil is <code>evil-surround</code>, which
defines a new text object for surrounding characters (e.g. change a string from
having double quotes with single quotes in a single command).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">evil-surround</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(global-evil-surround-mode 1))
</pre>
</div>
<p>
Next is another Vim plugin that has been ported to Evil: <code>evil-commentary</code>. This
package defines a new motion for comments, which is bound to
<kbd>gc</kbd>. So, for example, <kbd>gcc</kbd> will comment
the current line, regardless of the programming language.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">evil-commentary</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(evil-commentary-mode t))
</pre>
</div>
<p>
Another cool package is <code>evil-args</code> which defines the argument text object. This
text object can be targeted with the <code>a</code> character, and we can move backward and
forward through arguments with <kbd>H</kbd> and <kbd>L</kbd>
respectively.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">evil-args</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
<span style="color: #808080;">; </span><span style="color: #808080;">Configuration taken from the documentation of evil-args.</span>
<span style="color: #808080;">;; </span><span style="color: #808080;">Bind evil-args text objects</span>
(define-key evil-inner-text-objects-map <span style="color: #ffffaf;">"a"</span> 'evil-inner-arg)
(define-key evil-outer-text-objects-map <span style="color: #ffffaf;">"a"</span> 'evil-outer-arg)
<span style="color: #808080;">;; </span><span style="color: #808080;">Bind evil-forward/backward-args</span>
(define-key evil-normal-state-map <span style="color: #ffffaf;">"L"</span> 'evil-forward-arg)
(define-key evil-normal-state-map <span style="color: #ffffaf;">"H"</span> 'evil-backward-arg)
(define-key evil-motion-state-map <span style="color: #ffffaf;">"L"</span> 'evil-forward-arg)
(define-key evil-motion-state-map <span style="color: #ffffaf;">"H"</span> 'evil-backward-arg))
</pre>
</div>
<p>
Last but not least, <code>evil-numbers</code> brings a couple of bindings available to Vim
into Evil: <kbd>C-a</kbd> for increasing a number, and
<kbd>C-c -</kbd> for decreasing it (modified because
<kbd>C-z</kbd> is my escape sequence).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">evil-numbers</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-a"</span>) 'evil-numbers/inc-at-pt)
(define-key evil-normal-state-map (kbd <span style="color: #ffffaf;">"C-c -"</span>) 'evil-numbers/dec-at-pt)))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-11" class="outline-2">
<h2 id="sec-11"><span class="section-number-2">11</span> Magit</h2>
<div class="outline-text-2" id="text-11">
<p>
A git porcelain for GNU Emacs. Even if I'm still using the git CLI, it's
certainly useful for some common tasks (I guess that I still need some learning).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">magit</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
</pre>
</div>
<p>
In some cases normal mode is not the right mode (e.g. commit mode). For these
cases, set the proper default mode.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">with-eval-after-load</span> 'evil
(add-hook 'git-commit-mode-hook 'evil-insert-state)
(evil-set-initial-state 'magit-log-edit-mode 'insert))
</pre>
</div>
<p>
When showing the status, hide the usually-redundant "branch" section and show
the rest.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(add-hook 'magit-section-set-visibility-hook
'(lambda (section)
(<span style="color: #87afd7;">if</span> (string= (magit-section-type section) <span style="color: #ffffaf;">"branch"</span>)
'hide
'show)))
</pre>
</div>
<p>
Set a key binding for <code>magit-log-buffer-file</code>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(global-set-key (kbd <span style="color: #ffffaf;">"C-c l"</span>) 'magit-log-buffer-file)
</pre>
</div>
<p>
And repair some key bindings from Evil mode.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">with-eval-after-load</span> 'evil-leader
(evil-leader/set-key <span style="color: #ffffaf;">"s"</span> 'magit-status)
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">evil-magit</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
<span style="color: #808080;">; </span><span style="color: #808080;">The magit + evil-magit combo messes up some chords, let's fix this.</span>
(<span style="color: #87afd7;">evil-define-key</span> 'normal magit-mode-map
<span style="color: #ffffaf;">"\C-h"</span> 'evil-window-left
<span style="color: #ffffaf;">"\C-l"</span> 'evil-window-right
<span style="color: #ffffaf;">"\C-j"</span> 'evil-window-down
<span style="color: #ffffaf;">"\C-k"</span> 'evil-window-up
<span style="color: #ffffaf;">"\M-p"</span> 'helm-projectile-switch-project))))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-12" class="outline-2">
<h2 id="sec-12"><span class="section-number-2">12</span> mu4e</h2>
<div class="outline-text-2" id="text-12">
<p>
I use <a href="http://www.djcbsoftware.nl/code/mu/">mu</a> and <a href="http://www.djcbsoftware.nl/code/mu/mu4e.html">mu4e</a> to manage my email. The configuration for this has been taken
mainly from the documentation, plus some cool remarks on Reddit. This
configuration makes quite some assumptions. Read the <code>emacs/README.org</code> file as
provided in my <a href="https://github.com/mssola/dotfiles">dotfiles</a> project to get more details.
</p>
<p>
I'm using an RPM that I've built on <a href="https://build.opensuse.org/package/show/home:mssola/mu">OBS</a> which installs mu4e globally.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(add-to-list 'load-path <span style="color: #ffffaf;">"/usr/share/emacs/site-lisp/mu4e"</span>)
(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">mu4e</span>)
(<span style="color: #87afd7;">when</span> (<span style="color: #87afd7;">featurep</span> '<span style="color: #ffffaf;">mu4e</span>)
</pre>
</div>
<p>
Diferent SMTP options that will be used for each context.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> message-send-mail-function 'smtpmail-send-it
mu4e-maildir (expand-file-name <span style="color: #ffffaf;">"~/.mail"</span>)
starttls-use-gnutls t)
</pre>
</div>
<p>
After that, I am defining some functions that will be used in various parts of
the configuration.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-smtp</span> (server port)
<span style="color: #808080;">"Set SMTP variables depending on the given SERVER and PORT."</span>
(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">smtpmail</span>)
(<span style="color: #87afd7;">setq</span> smtpmail-starttls-credentials
'((server port nil nil))
smtpmail-auth-credentials
(expand-file-name <span style="color: #ffffaf;">"~/.authinfo.gpg"</span>)
smtpmail-default-smtp-server server
smtpmail-smtp-server server
smtpmail-smtp-service port))
<span style="color: #808080;">; </span><span style="color: #808080;">https://www.reddit.com/r/emacs/comments/47t9ec/share_your_mu4econtext_configs/d0fsih6</span>
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mu4e-message-maildir-matches</span> (msg rx)
<span style="color: #808080;">"Returns true if the maildir of MSG matches the given regexp RX."</span>
(<span style="color: #87afd7;">when</span> rx
(<span style="color: #87afd7;">if</span> (listp rx)
<span style="color: #808080;">;; </span><span style="color: #808080;">if rx is a list, try each one for a match</span>
(<span style="color: #87afd7;">or</span> (mu4e-message-maildir-matches msg (car rx))
(mu4e-message-maildir-matches msg (cdr rx)))
<span style="color: #808080;">;; </span><span style="color: #808080;">not a list, check rx</span>
(string-match rx (mu4e-message-field msg <span style="color: #87afd7;">:maildir</span>)))))
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">suse-refile-folder</span> (key)
<span style="color: #808080;">"Returns the refile folder for the given SUSE account in the KEY arg"</span>
(concat <span style="color: #ffffaf;">"/"</span> key <span style="color: #ffffaf;">"/Archives/"</span>
(format-time-string <span style="color: #ffffaf;">"%Y"</span> (current-time))))
</pre>
</div>
<p>
Now it's time to define the different contexts that I have. Defining contexts
this way is relatively new (since mu 0.9.16).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-contexts
`(
<span style="color: #808080;">;; </span><span style="color: #808080;">GMail</span>
,(make-mu4e-context
<span style="color: #87afd7;">:name</span> <span style="color: #ffffaf;">"gmail"</span>
<span style="color: #87afd7;">:enter-func</span> (<span style="color: #87afd7;">lambda</span> ()
(mu4e-message <span style="color: #ffffaf;">"Switching to gmail.com"</span>)
(mssola-smtp <span style="color: #ffffaf;">"smtp.gmail.com"</span> 587))
<span style="color: #87afd7;">:match-func</span> (<span style="color: #87afd7;">lambda</span> (msg)
(<span style="color: #87afd7;">when</span> msg
(mu4e-message-maildir-matches msg <span style="color: #ffffaf;">"^/gmail"</span>)))
<span style="color: #87afd7;">:vars</span> '(
(user-mail-address . <span style="color: #ffffaf;">"mikisabate@gmail.com"</span>)
(mu4e-reply-to-address . <span style="color: #ffffaf;">"mikisabate@gmail.com"</span>)
(mu4e-drafts-folder . <span style="color: #ffffaf;">"/gmail/Drafts"</span>)
(mu4e-sent-folder . <span style="color: #ffffaf;">"/gmail/Sent"</span>)
(mu4e-refile-folder . <span style="color: #ffffaf;">"/gmail/All"</span>)
(mu4e-trash-folder . <span style="color: #ffffaf;">"/gmail/Trash"</span>)))
<span style="color: #808080;">;; </span><span style="color: #808080;">suse.com</span>
,(make-mu4e-context
<span style="color: #87afd7;">:name</span> <span style="color: #ffffaf;">"comsuse"</span>
<span style="color: #87afd7;">:enter-func</span> (<span style="color: #87afd7;">lambda</span> ()
(mu4e-message <span style="color: #ffffaf;">"Switching to suse.com"</span>)
(mssola-smtp <span style="color: #ffffaf;">"smtp.novell.com"</span> 25))
<span style="color: #87afd7;">:match-func</span> (<span style="color: #87afd7;">lambda</span> (msg)
(<span style="color: #87afd7;">when</span> msg
(mu4e-message-maildir-matches msg <span style="color: #ffffaf;">"^/susecom"</span>)))
<span style="color: #87afd7;">:vars</span> `(
(user-mail-address . <span style="color: #ffffaf;">"msabate@suse.com"</span>)
(mu4e-reply-to-address . <span style="color: #ffffaf;">"msabate@suse.com"</span>)
(mu4e-drafts-folder . <span style="color: #ffffaf;">"/susecom/Drafts"</span>)
(mu4e-sent-folder . <span style="color: #ffffaf;">"/susecom/Sent"</span>)
(mu4e-refile-folder . ,(suse-refile-folder <span style="color: #ffffaf;">"susecom"</span>))
(mu4e-trash-folder . <span style="color: #ffffaf;">"/susecom/Trash"</span>)))
<span style="color: #808080;">;; </span><span style="color: #808080;">suse.de</span>
,(make-mu4e-context
<span style="color: #87afd7;">:name</span> <span style="color: #ffffaf;">"desuse"</span>
<span style="color: #87afd7;">:enter-func</span> (<span style="color: #87afd7;">lambda</span> ()
(mu4e-message <span style="color: #ffffaf;">"Switching to suse.de"</span>)
(mssola-smtp <span style="color: #ffffaf;">"imap.suse.de"</span> 587))
<span style="color: #87afd7;">:match-func</span> (<span style="color: #87afd7;">lambda</span> (msg)
(<span style="color: #87afd7;">when</span> msg
(mu4e-message-maildir-matches msg <span style="color: #ffffaf;">"^/susede"</span>)))
<span style="color: #87afd7;">:vars</span> `(
(user-mail-address . <span style="color: #ffffaf;">"msabate@suse.de"</span>)
(mu4e-reply-to-address . <span style="color: #ffffaf;">"msabate@suse.de"</span>)
(mu4e-drafts-folder . <span style="color: #ffffaf;">"/susede/Drafts"</span>)
(mu4e-sent-folder . <span style="color: #ffffaf;">"/susede/Sent"</span>)
(mu4e-refile-folder . ,(suse-refile-folder <span style="color: #ffffaf;">"susede"</span>))
(mu4e-trash-folder . <span style="color: #ffffaf;">"/susede/Trash"</span>)))))
</pre>
</div>
<p>
If mu4e cannot figure things out, ask me.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-context-policy 'ask)
(<span style="color: #87afd7;">setq</span> mu4e-compose-context-policy 'ask)
</pre>
</div>
<p>
Fill the <code>mu4e-user-mail-address-list</code> variable with the contexts.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-user-mail-address-list
(delq nil
(mapcar (<span style="color: #87afd7;">lambda</span> (context)
(<span style="color: #87afd7;">when</span> (mu4e-context-vars context)
(cdr (assq 'user-mail-address
(mu4e-context-vars context)))))
mu4e-contexts)))
</pre>
</div>
<p>
Setting my bookmarks
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-bookmarks
'((<span style="color: #ffffaf;">"maildir:/gmail/inbox OR maildir:/susecom/inbox OR maildir:/susede/inbox"</span> <span style="color: #ffffaf;">"Inbox Folders"</span> ?n)
(<span style="color: #ffffaf;">"flag:unread AND NOT flag:trashed"</span> <span style="color: #ffffaf;">"Unread messages"</span> ?u)
(<span style="color: #ffffaf;">"date:today..now"</span> <span style="color: #ffffaf;">"Today's messages"</span> ?t)))
</pre>
</div>
<p>
The following signature looks alright regardless of whether the client supports
format=flowed or not.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-compose-signature
(concat
<span style="color: #ffffaf;">"Miquel Sabaté Solà,\n"</span>
<span style="color: #ffffaf;">"PGP: 4096R / 1BA5 3C7A C93D CA2A CFDF DA97 96BE 8C6F D89D 6565\n"</span>))
</pre>
</div>
<p>
Sign outgoing emails always.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
</pre>
</div>
<p>
To avoid UID clashes. See <a href="http://pragmaticemacs.com/emacs/fixing-duplicate-uid-errors-when-using-mbsync-and-mu4e/">this</a>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-change-filenames-when-moving t)
</pre>
</div>
<p>
Miscellaneous settings.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-html2text-command <span style="color: #ffffaf;">"w3m -T text/html"</span>
mu4e-attachment-dir <span style="color: #ffffaf;">"~/Downloads"</span>
mu4e-headers-date-format <span style="color: #ffffaf;">"%Y-%m-%d %H:%M"</span>
message-citation-line-format <span style="color: #ffffaf;">"%N @ %Y-%m-%d %H:%M %Z:\n"</span>
message-citation-line-function 'message-insert-formatted-citation-line
message-kill-buffer-on-exit t
mu4e-get-mail-command <span style="color: #ffffaf;">"mbsync -aqV"</span>
mu4e-update-interval 600
mu4e-compose-dont-reply-to-self t
mu4e-compose-format-flowed t
mu4e-headers-skip-duplicates t
mu4e-headers-include-related t
mu4e-headers-auto-update t)
</pre>
</div>
<p>
The headers to show in the headers list a pair of a field and its width,
with `nil' meaning 'unlimited' (better only use that for the last field.
These are the defaults:
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-headers-fields
'( (<span style="color: #87afd7;">:date</span> . 18)
(<span style="color: #87afd7;">:mailing-list</span> . 15)
(<span style="color: #87afd7;">:from-or-to</span> . 20)
(<span style="color: #87afd7;">:subject</span> . nil)))
</pre>
</div>
<p>
Show images
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> mu4e-view-show-images t
mu4e-view-image-max-width 800)
<span style="color: #808080;">; </span><span style="color: #808080;">Use imagemagick, if available</span>
(<span style="color: #87afd7;">when</span> (fboundp 'imagemagick-register-types)
(imagemagick-register-types))
</pre>
</div>
<p>
As of 0.9.18 and GNU Emacs 25, the <code>mu4e-action-with-xwidget</code> can be used to
render an HTML message with Webkit.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">if</span> (>= emacs-major-version 25)
(add-to-list 'mu4e-view-actions
'(<span style="color: #ffffaf;">"webkit"</span> . mu4e-action-view-with-xwidget)))
</pre>
</div>
<p>
Look for <code>mu4e-msg2pdf</code> in the exec path. The reason for this is that the OBS
package installs mu's <code>toys</code> into the exec path, but <code>mu4e</code> doesn't really count
on it.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">let</span> ((exec (locate-file <span style="color: #ffffaf;">"msg2pdf"</span> exec-path exec-suffixes)))
(<span style="color: #87afd7;">if</span> exec
(<span style="color: #87afd7;">setq</span> mu4e-msg2pdf exec)))
</pre>
</div>
<p>
Adding hooks for composing and viewing messages.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-compose-mode</span> ()
<span style="color: #808080;">"My settings for message composition."</span>
<span style="color: #808080;">; </span><span style="color: #808080;">If we are composing an email from scratch, it's more convenient to be in</span>
<span style="color: #808080;">; </span><span style="color: #808080;">insert mode. Otherwise start with normal mode.</span>
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil
(<span style="color: #87afd7;">if</span> mu4e-compose-parent-message
(evil-set-initial-state 'mu4e-compose-mode 'normal)
(evil-set-initial-state 'mu4e-compose-mode 'insert)))
<span style="color: #808080;">; </span><span style="color: #808080;">Guess hard newlines</span>
(use-hard-newlines t 'guess)
<span style="color: #808080;">; </span><span style="color: #808080;">So it's easy to encrypt/decrypt emails.</span>
(epa-mail-mode)
<span style="color: #808080;">; </span><span style="color: #808080;">Spellz</span>
(flyspell-mode))
(add-hook 'mu4e-compose-mode-hook 'mssola-compose-mode)
<span style="color: #808080;">; </span><span style="color: #808080;">I want to read messages in the format that the sender used. I'm also</span>
<span style="color: #808080;">; </span><span style="color: #808080;">enabling epa-mail-mode, so it's easy to decrypt received emails.</span>
(add-hook 'mu4e-view-mode-hook
(<span style="color: #87afd7;">lambda</span> ()
(epa-mail-mode)
(visual-line-mode 1)))
</pre>
</div>
<p>
I want desktop notifications when receiving email.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">mu4e-alert</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
<span style="color: #808080;">; </span><span style="color: #808080;">Notify me for unread emails from my inbox.</span>
(mu4e-alert-set-default-style 'libnotify)
(add-hook 'after-init-hook #'mu4e-alert-enable-notifications)
(add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display)
(<span style="color: #87afd7;">setq</span> mu4e-alert-interesting-mail-query
(concat
<span style="color: #ffffaf;">"(maildir:/gmail/inbox OR maildir:/susecom/inbox OR maildir:/susede/inbox) "</span>
<span style="color: #ffffaf;">"AND flag:unread AND NOT flag:trashed"</span>))
(<span style="color: #87afd7;">setq</span> mu4e-alert-email-notification-types '(count)))
<span style="color: #808080;">; </span><span style="color: #808080;">Evil mode in mu4e</span>
(<span style="color: #87afd7;">with-eval-after-load</span> 'evil
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">evil-mu4e</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
<span style="color: #808080;">; </span><span style="color: #808080;">Idea taken from evil-mu4e.el</span>
(<span style="color: #87afd7;">defvar</span> <span style="color: #d0d0d0;">mssola-evil-mu4e-mode-map-bindings</span>
`((,evil-mu4e-state mu4e-headers-mode-map <span style="color: #ffffaf;">"\C-u"</span> evil-scroll-up)
(,evil-mu4e-state mu4e-main-mode-map <span style="color: #ffffaf;">"\C-u"</span> evil-scroll-up)
(,evil-mu4e-state mu4e-view-mode-map <span style="color: #ffffaf;">"h"</span> evil-backward-char)))
(<span style="color: #87afd7;">dolist</span> (binding mssola-evil-mu4e-mode-map-bindings)
(<span style="color: #87afd7;">evil-define-key</span>
(nth 0 binding) (nth 1 binding) (nth 2 binding) (nth 3 binding)))))
</pre>
</div>
<p>
And finally define a proper shortcut.
</p>
<div class="org-src-container">
<pre class="src src-elisp"><span style="color: #808080;">; </span><span style="color: #808080;">The trailing parenthesis closes the "(when (featurep 'mu4e)" statement from</span>
<span style="color: #808080;">; </span><span style="color: #808080;">the very beginning.</span>
(global-set-key (kbd <span style="color: #ffffaf;">"C-c m"</span>) 'mu4e))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-13" class="outline-2">
<h2 id="sec-13"><span class="section-number-2">13</span> org</h2>
<div class="outline-text-2" id="text-13">
<p>
<a href="http://orgmode.org/">org mode</a> is an incredible tool that keeps me organized: TODOs, notes, agenda,
etc. Moreover, it's built in GNU Emacs:
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">org</span>)
</pre>
</div>
</div>
<div id="outline-container-sec-13-1" class="outline-3">
<h3 id="sec-13-1"><span class="section-number-3">13.1</span> General settings</h3>
<div class="outline-text-3" id="text-13-1">
<p>
First of all, let me define some helper functions.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-org-skip-if-priority</span> (priority <span style="color: #87afd7;">&optional</span> subtree)
<span style="color: #808080;">"Skip an agenda item if it has a priority of PRIORITY.</span>
<span style="color: #808080;">PRIORITY may be one of the characters ?A, ?B, or ?C.</span>
<span style="color: #808080;">Skips the current entry unless SUBTREE is not nil. This function has been</span>
<span style="color: #808080;">copied from @aaronbieber."</span>
(<span style="color: #87afd7;">let</span> ((end (<span style="color: #87afd7;">if</span> subtree (<span style="color: #87afd7;">save-excursion</span> (org-end-of-subtree t))
(<span style="color: #87afd7;">save-excursion</span> (<span style="color: #87afd7;">progn</span> (outline-next-heading) (1- (point))))))
(pri-value (* 1000 (- org-lowest-priority priority)))
(pri-current (org-get-priority (thing-at-point 'line t))))
(<span style="color: #87afd7;">if</span> (= pri-value pri-current)
end
nil)))
(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-org-skip-if-not-closed-in-day</span> (time <span style="color: #87afd7;">&optional</span> subtree)
<span style="color: #808080;">"Skip entries that were not closed in the given TIME.</span>
<span style="color: #808080;">Skip the current entry unless SUBTREE is not nil, in which case skip</span>
<span style="color: #808080;">the entire subtree. Idea taken from @aaronbieber"</span>
(<span style="color: #87afd7;">let</span> ((end (<span style="color: #87afd7;">if</span> subtree (<span style="color: #87afd7;">save-excursion</span> (org-end-of-subtree t))
(<span style="color: #87afd7;">save-excursion</span> (<span style="color: #87afd7;">progn</span> (outline-next-heading) (1- (point))))))
(day-prefix (format-time-string <span style="color: #ffffaf;">"%Y-%m-%d"</span> time)))
(<span style="color: #87afd7;">if</span> (<span style="color: #87afd7;">save-excursion</span>
(<span style="color: #87afd7;">and</span> (re-search-forward org-closed-time-regexp end t)
(string= (substring (match-string-no-properties 1) 0 10) day-prefix)))
nil
end)))
</pre>
</div>
<p>
Some general UI settings for org mode.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> org-src-tab-acts-natively t
org-confirm-babel-evaluate nil
org-edit-src-content-indentation 0)
(<span style="color: #87afd7;">setq</span> org-todo-keywords
'((sequence <span style="color: #ffffaf;">"TODO(t)"</span> <span style="color: #ffffaf;">"|"</span> <span style="color: #ffffaf;">"DONE(d!)"</span>)
(sequence <span style="color: #ffffaf;">"IDEA(i)"</span> <span style="color: #ffffaf;">"WORKING(w)"</span> <span style="color: #ffffaf;">"|"</span> <span style="color: #ffffaf;">"USED(u@/!)"</span> <span style="color: #ffffaf;">"DISCARDED(x@/!)"</span>)))
(<span style="color: #87afd7;">setq</span> org-todo-keyword-faces
'((<span style="color: #ffffaf;">"TODO"</span> . org-todo)
(<span style="color: #ffffaf;">"IDEA"</span> . font-lock-constant-face)
(<span style="color: #ffffaf;">"WORKING"</span> . font-lock-constant-face)
(<span style="color: #ffffaf;">"DONE"</span> . org-done)
(<span style="color: #ffffaf;">"USED"</span> . org-done)
(<span style="color: #ffffaf;">"DISCARDED"</span> . org-done)))
</pre>
</div>
<p>
Logging settings.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> org-log-done t)
(<span style="color: #87afd7;">setq</span> org-log-redeadline (<span style="color: #87afd7;">quote</span> time))
(<span style="color: #87afd7;">setq</span> org-log-reschedule (<span style="color: #87afd7;">quote</span> time))
</pre>
</div>
<p>
Where org files reside.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> org-agenda-files '(<span style="color: #ffffaf;">"~/org/"</span>))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-13-2" class="outline-3">
<h3 id="sec-13-2"><span class="section-number-3">13.2</span> Publishing</h3>
<div class="outline-text-3" id="text-13-2">
<p>
In order to publish files into HTML, I would like to have <code>htmlize</code> installed.
This package allows org to export to HTML in a better way (e.g. allowing code
blocks to be converted into HTML as well, so we can properly colorize it).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">htmlize</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
<p>
And now let's set all the related settings.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> org-src-fontify-natively t
org-html-include-timestamps nil
org-html-toplevel-hlevel 2
org-html-htmlize-output-type 'css
org-export-with-section-numbers nil
org-export-with-sub-superscripts nil
org-export-htmlize-output-type 'css)
</pre>
</div>
<p>
You can also export org documents to man pages. In order to do so, you have to
perform this first:
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">ox-man</span>)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-13-3" class="outline-3">
<h3 id="sec-13-3"><span class="section-number-3">13.3</span> Agenda</h3>
<div class="outline-text-3" id="text-13-3">
<p>
Custom commands for <code>org-agenda</code>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> org-agenda-custom-commands
'((<span style="color: #ffffaf;">"p"</span> <span style="color: #ffffaf;">"Printed agenda"</span>
<span style="color: #808080;">; </span><span style="color: #808080;">Daily agenda with a 2-weeks deadline warning. Tasks are</span>
<span style="color: #808080;">; </span><span style="color: #808080;">represented as [ ] items.</span>
((agenda <span style="color: #ffffaf;">""</span>
((org-agenda-ndays 1)
(org-deadline-warning-days 14)
(org-agenda-todo-keyword-format <span style="color: #ffffaf;">"[ ]"</span>)
(org-agenda-scheduled-leaders '(<span style="color: #ffffaf;">""</span> <span style="color: #ffffaf;">""</span>))))
<span style="color: #808080;">; </span><span style="color: #808080;">Display a "High Priority" list of tasks on top.</span>
(tags <span style="color: #ffffaf;">"PRIORITY=\"A\""</span>
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
(org-agenda-sorting-strategy '(tag-up priority-down))
(org-agenda-todo-keyword-format <span style="color: #ffffaf;">""</span>)
(org-agenda-overriding-header <span style="color: #ffffaf;">"\nHigh priority\n--------------\n"</span>)))
<span style="color: #808080;">; </span><span style="color: #808080;">All tasks except those already listed as high priority or</span>
<span style="color: #808080;">; </span><span style="color: #808080;">ideas. Scheduled and deadlines are also ignored here.</span>
(alltodo <span style="color: #ffffaf;">""</span>
((org-agenda-skip-function '(<span style="color: #87afd7;">or</span> (mssola-org-skip-if-priority ?A)
(org-agenda-skip-entry-if 'todo '(<span style="color: #ffffaf;">"IDEA"</span> <span style="color: #ffffaf;">"WORKING"</span>))
(org-agenda-skip-if nil '(scheduled deadline))))
(org-agenda-sorting-strategy '(tag-up priority-down))
(org-agenda-todo-keyword-format <span style="color: #ffffaf;">""</span>)
(org-agenda-overriding-header <span style="color: #ffffaf;">"\nAll tasks\n----------\n"</span>)))
<span style="color: #808080;">; </span><span style="color: #808080;">List of ideas.</span>
(todo <span style="color: #ffffaf;">"IDEA"</span>
((org-agenda-overriding-header <span style="color: #ffffaf;">"\nIdeas\n------\n"</span>)
(org-agenda-todo-keyword-format <span style="color: #ffffaf;">""</span>))))
((org-agenda-compact-blocks t)
(org-agenda-remove-tags t)))
<span style="color: #808080;">; </span><span style="color: #808080;">List of done items. Useful for standups, review meetings, weekly</span>
<span style="color: #808080;">; </span><span style="color: #808080;">reports, etc.</span>
(<span style="color: #ffffaf;">"d"</span> <span style="color: #ffffaf;">"Done items"</span>
<span style="color: #808080;">; </span><span style="color: #808080;">First show the items done yesterday. Useful for standups.</span>
((todo <span style="color: #ffffaf;">"DONE"</span>
((org-agenda-overriding-header <span style="color: #ffffaf;">"Done yesterday\n---------------\n"</span>)
(org-agenda-skip-function
'(mssola-org-skip-if-not-closed-in-day
(time-subtract (current-time) (seconds-to-time 86400))))
(org-agenda-todo-keyword-format <span style="color: #ffffaf;">""</span>)))
<span style="color: #808080;">; </span><span style="color: #808080;">Then show what I've done today.</span>
(todo <span style="color: #ffffaf;">"DONE"</span>
((org-agenda-overriding-header <span style="color: #ffffaf;">"\nDone today\n-----------\n"</span>)
(org-agenda-skip-function
'(mssola-org-skip-if-not-closed-in-day
(current-time)))
(org-agenda-todo-keyword-format <span style="color: #ffffaf;">""</span>)))
<span style="color: #808080;">; </span><span style="color: #808080;">Finally show what I've been doing in the past 15 days. Useful for</span>
<span style="color: #808080;">; </span><span style="color: #808080;">review meetings and weekly reports.</span>
(todo <span style="color: #ffffaf;">"DONE"</span>
((org-agenda-start-day <span style="color: #ffffaf;">"-15d"</span>)
(org-agenda-span 15)
(org-agenda-start-on-weekday nil)
(org-agenda-todo-keyword-format <span style="color: #ffffaf;">""</span>)
(org-agenda-scheduled-leaders '(<span style="color: #ffffaf;">""</span> <span style="color: #ffffaf;">""</span>))
(org-agenda-overriding-header <span style="color: #ffffaf;">"\nDone during the past 15 days\n-----------------------------\n"</span>))))
((org-agenda-compact-blocks t)
(org-agenda-remove-tags t)))))
</pre>
</div>
<p>
The prefix for the different kinds of types being used.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> org-agenda-prefix-format '((agenda . <span style="color: #ffffaf;">"%t%s"</span>)
(tags . <span style="color: #ffffaf;">"%c:%s"</span>)
(todo . <span style="color: #ffffaf;">"%c:%t%s"</span>)))
</pre>
</div>
<p>
Set up a key binding for org-agenda.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(global-set-key (kbd <span style="color: #ffffaf;">"C-c a"</span>) 'org-agenda)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-13-4" class="outline-3">
<h3 id="sec-13-4"><span class="section-number-3">13.4</span> Capture</h3>
<div class="outline-text-3" id="text-13-4">
<p>
Set the default notes file and the key binding.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> org-default-notes-file (concat org-directory <span style="color: #ffffaf;">"/notes.org"</span>))
(define-key global-map <span style="color: #ffffaf;">"\C-cc"</span> 'org-capture)
</pre>
</div>
<p>
And finally set <code>org-capture-templates</code>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> org-capture-templates
`((<span style="color: #ffffaf;">"t"</span> <span style="color: #ffffaf;">"todo"</span> entry (file <span style="color: #ffffaf;">""</span>) <span style="color: #ffffaf;">"* TODO %?\n%U\n"</span>)
(<span style="color: #ffffaf;">"i"</span> <span style="color: #ffffaf;">"idea"</span> entry (file <span style="color: #ffffaf;">""</span>) <span style="color: #ffffaf;">"* %? :IDEA:\n%U\n%a\n"</span>)))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-13-5" class="outline-3">
<h3 id="sec-13-5"><span class="section-number-3">13.5</span> Other</h3>
<div class="outline-text-3" id="text-13-5">
<p>
Insert a <kbd></kbd> value in org mode. See this <a href="http://emacs.stackexchange.com/questions/2206/i-want-to-have-the-kbd-tags-for-my-blog-written-in-org-mode">StackExchange answer</a>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">endless/insert-key</span> (key)
<span style="color: #808080;">"Ask for a key then insert its description.</span>
<span style="color: #808080;">Will work on both org-mode and any mode that accepts plain html."</span>
(<span style="color: #87afd7;">interactive</span> <span style="color: #ffffaf;">"kType key sequence: "</span>)
(<span style="color: #87afd7;">let*</span> ((is-org-mode (derived-mode-p 'org-mode))
(tag (<span style="color: #87afd7;">if</span> is-org-mode
<span style="color: #ffffaf;">"@@html:<kbd>%s</kbd>@@"</span>
<span style="color: #ffffaf;">"<kbd>%s</kbd>"</span>)))
(<span style="color: #87afd7;">if</span> (null (equal key <span style="color: #ffffaf;">"\r"</span>))
(insert
(format tag (help-key-description key nil)))
(insert (format tag <span style="color: #ffffaf;">""</span>))
(forward-char (<span style="color: #87afd7;">if</span> is-org-mode -8 -6)))))
(define-key org-mode-map <span style="color: #ffffaf;">"\C-ck"</span> #'endless/insert-key)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-13-6" class="outline-3">
<h3 id="sec-13-6"><span class="section-number-3">13.6</span> <span class="todo TODO">TODO</span> shortcut for making an org link, and transforming a link into a proper org link</h3>
</div>
<div id="outline-container-sec-13-7" class="outline-3">
<h3 id="sec-13-7"><span class="section-number-3">13.7</span> <span class="todo TODO">TODO</span> make it work with evil</h3>
</div>
<div id="outline-container-sec-13-8" class="outline-3">
<h3 id="sec-13-8"><span class="section-number-3">13.8</span> <span class="todo TODO">TODO</span> Proper keybindings for quick access.</h3>
</div>
<div id="outline-container-sec-13-9" class="outline-3">
<h3 id="sec-13-9"><span class="section-number-3">13.9</span> <span class="todo TODO">TODO</span> shortcuts for stuff like: create something urgent for today</h3>
</div>
</div>
<div id="outline-container-sec-14" class="outline-2">
<h2 id="sec-14"><span class="section-number-2">14</span> IRC</h2>
<div class="outline-text-2" id="text-14">
<p>
I'm using <a href="https://www.gnu.org/software/emacs/manual/html_mono/erc.html">ERC</a> for IRC.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">erc</span>
<span style="color: #87afd7;">:config</span>
</pre>
</div>
<p>
First of all, let's add some basic modules.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">dolist</span> (mod '(autojoin track truncate))
(add-to-list 'erc-modules mod))
</pre>
</div>
<p>
Setting up basic stuff.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> erc-hide-list '(<span style="color: #ffffaf;">"PART"</span>)
erc-prompt (<span style="color: #87afd7;">lambda</span> () (concat (buffer-name) <span style="color: #ffffaf;">">"</span>))
erc-track-exclude-types '(<span style="color: #ffffaf;">"JOIN"</span> <span style="color: #ffffaf;">"NICK"</span> <span style="color: #ffffaf;">"PART"</span> <span style="color: #ffffaf;">"QUIT"</span> <span style="color: #ffffaf;">"MODE"</span>)
erc-server-coding-system '(utf-8 . utf-8)
erc-kill-buffer-on-part t
erc-kill-queries-on-quit t
erc-kill-server-buffer-on-quit t
erc-fill-column 100
erc-fill-prefix <span style="color: #ffffaf;">""</span>
erc-timestamp-format <span style="color: #ffffaf;">"[%H:%M] "</span>
erc-insert-timestamp-function 'erc-insert-timestamp-left
erc-insert-away-timestamp-function 'erc-insert-timestamp-left
erc-hide-timestamps nil
erc-whowas-on-nosuchnick t
erc-public-away-p nil
erc-echo-notice-always-hook '(erc-echo-notice-in-minibuffer)
erc-auto-set-away nil
erc-autoaway-message <span style="color: #ffffaf;">"%i seconds out..."</span>
erc-away-nickname <span style="color: #ffffaf;">"msabate"</span>
erc-enable-logging t
erc-query-on-unjoined-chan-privmsg t)
</pre>
</div>
<p>
Let's log messages whenever I receive/send them. The other option is to only do
that on <code>/quit</code> or <code>/part</code>, but it's better to be safe than sorry.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">erc-log</span>)
(erc-log-enable)
(<span style="color: #87afd7;">setq</span> erc-log-channels-directory <span style="color: #ffffaf;">"~/.emacs.d/erc"</span>
erc-save-buffer-on-part nil
erc-save-queries-on-quit nil
erc-log-write-after-send t
erc-log-write-after-insert t)
</pre>
</div>
<p>
Servers and channels to auto-join.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> erc-autojoin-channels-alist
'((<span style="color: #ffffaf;">"irc.freenode.net"</span> <span style="color: #ffffaf;">"#gnu"</span> <span style="color: #ffffaf;">"#emacs"</span>)
(<span style="color: #ffffaf;">"irc.suse.de"</span> <span style="color: #ffffaf;">"#suse"</span> <span style="color: #ffffaf;">"#docker"</span>)))
</pre>
</div>
<p>
Use the <code>erc-hl-nicks</code> package, so highlight support for nicknames is better.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">erc-hl-nicks</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:init</span>
(<span style="color: #87afd7;">with-eval-after-load</span> 'erc
(add-to-list 'erc-modules 'hl-nicks)))
</pre>
</div>
<p>
I want to have a desktop notification whenever someone mentions my name. For
this, I'm using the <code>erc-notifications</code> package which is built in ERC since
GNU Emacs 24.3.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">with-eval-after-load</span> 'erc
(<span style="color: #87afd7;">setq</span> erc-notifications-icon
(concat
<span style="color: #ffffaf;">"/usr/share/emacs/"</span>
(format <span style="color: #ffffaf;">"%s.%s"</span> emacs-major-version emacs-minor-version)
<span style="color: #ffffaf;">"/etc/images/icons/hicolor/24x24/apps/emacs.png"</span>))
(add-to-list 'erc-modules 'notifications))
</pre>
</div>
<p>
At this point, we can safely update all the loaded ERC modules.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(add-hook 'erc-connect-pre-hook
(<span style="color: #87afd7;">lambda</span> (x) (erc-update-modules)))
</pre>
</div>
<p>
Start some modules which won't do it by default. Moreover, according to the <a href="https://www.emacswiki.org/emacs/ErcFilling">wiki</a>
<code>auto-fill-mode</code> should be disabled if I'm using <code>erc-fill-mode</code>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(add-hook 'erc-mode-hook
'(lambda ()
(erc-track-mode t)
(auto-fill-mode -1)
(erc-log-mode 1)
(erc-autojoin-mode 1)))
</pre>
</div>
<p>
And now define a function to connect to both IRC servers.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-erc</span> ()
<span style="color: #808080;">"Join pre-specified servers and channels."</span>
(<span style="color: #87afd7;">interactive</span>)
(erc <span style="color: #87afd7;">:server</span> <span style="color: #ffffaf;">"irc.freenode.net"</span> <span style="color: #87afd7;">:port</span> 6667 <span style="color: #87afd7;">:nick</span> <span style="color: #ffffaf;">"mssola"</span>)
(erc-tls <span style="color: #87afd7;">:server</span> <span style="color: #ffffaf;">"irc.suse.de"</span> <span style="color: #87afd7;">:port</span> 6697 <span style="color: #87afd7;">:nick</span> <span style="color: #ffffaf;">"mssola"</span>))
(global-set-key (kbd <span style="color: #ffffaf;">"C-c i"</span>) 'mssola-erc))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15" class="outline-2">
<h2 id="sec-15"><span class="section-number-2">15</span> Languages</h2>
<div class="outline-text-2" id="text-15">
</div><div id="outline-container-sec-15-1" class="outline-3">
<h3 id="sec-15-1"><span class="section-number-3">15.1</span> General</h3>
<div class="outline-text-3" id="text-15-1">
<p>
First of all, define a function that identifies some warning keywords
(e.g. TODO). This function can then be applied to the proper mode.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">warnings-mode-hook</span> ()
<span style="color: #808080;">"Hook for enabling the warning face on strings with a warning prefix."</span>
(font-lock-add-keywords nil
'((<span style="color: #ffffaf;">"</span><span style="color: #ffffaf; font-weight: bold;">\\</span><span style="color: #ffffaf; font-weight: bold;">(</span><span style="color: #ffffaf;">XXX</span><span style="color: #ffffaf; font-weight: bold;">\\</span><span style="color: #ffffaf; font-weight: bold;">|</span><span style="color: #ffffaf;">FIXME</span><span style="color: #ffffaf; font-weight: bold;">\\</span><span style="color: #ffffaf; font-weight: bold;">|</span><span style="color: #ffffaf;">TODO</span><span style="color: #ffffaf; font-weight: bold;">\\</span><span style="color: #ffffaf; font-weight: bold;">|</span><span style="color: #ffffaf;">HACK</span><span style="color: #ffffaf; font-weight: bold;">\\</span><span style="color: #ffffaf; font-weight: bold;">|</span><span style="color: #ffffaf;">NOTE</span><span style="color: #ffffaf; font-weight: bold;">\\</span><span style="color: #ffffaf; font-weight: bold;">)</span><span style="color: #ffffaf;">"</span>
1 font-lock-warning-face prepend))))
</pre>
</div>
<p>
Text mode is not a programming language, but it's used quite often in this
context too. In this case, I want spell check and <code>wc-mode</code> activated.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(add-hook 'text-mode-hook
(<span style="color: #87afd7;">lambda</span> ()
(flyspell-mode 1)
(wc-mode 1)))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-2" class="outline-3">
<h3 id="sec-15-2"><span class="section-number-3">15.2</span> Shell</h3>
<div class="outline-text-3" id="text-15-2">
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">bats-mode</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-3" class="outline-3">
<h3 id="sec-15-3"><span class="section-number-3">15.3</span> Lisp</h3>
<div class="outline-text-3" id="text-15-3">
<p>
Emacs lisp needs <code>rainbow-delimiters</code>, so the amount of parenthesis is less
confusing. Moreover, I'm also enabling <code>eldoc-mode</code> and the aforementioned
<code>warnings-mode-hook</code>.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(add-hook 'emacs-lisp-mode-hook
(<span style="color: #87afd7;">lambda</span> ()
(eldoc-mode 1)
(warnings-mode-hook)
(rainbow-delimiters-mode 1)
<span style="color: #808080;">; </span><span style="color: #808080;">https://github.com/jhenahan/emacs.d/blob/master/emacs-init.org#emacs-lisp</span>
(<span style="color: #87afd7;">setq</span> mode-name <span style="color: #ffffaf;">"ξ"</span>)))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-4" class="outline-3">
<h3 id="sec-15-4"><span class="section-number-3">15.4</span> C and C++</h3>
<div class="outline-text-3" id="text-15-4">
<p>
C and C++ only require the <code>warnings-mode-hook</code> function, spell checking for the
comments and the usage of tabs instead of spaces.
</p>
<div class="org-src-container">
<pre class="src src-elisp"><span style="color: #808080;">; </span><span style="color: #808080;">Note that C-common includes languages with a similar syntax of C.</span>
(add-hook 'c-mode-common-hook 'warnings-mode-hook)
(add-hook 'c-mode-common-hook (<span style="color: #87afd7;">lambda</span>() (flyspell-prog-mode)))
<span style="color: #808080;">;; </span><span style="color: #808080;">C</span>
(add-hook 'c-mode-hook
(<span style="color: #87afd7;">lambda</span> () (<span style="color: #87afd7;">setq</span> indent-tabs-mode t)))
<span style="color: #808080;">;; </span><span style="color: #808080;">C++</span>
(add-hook 'c++-mode-hook
(<span style="color: #87afd7;">lambda</span> () (<span style="color: #87afd7;">setq</span> indent-tabs-mode t)))
</pre>
</div>
<p>
CMake for y'all.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">cmake-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(<span style="color: #87afd7;">setq</span> auto-mode-alist
(append
'((<span style="color: #ffffaf;">"CMakeLists\\.txt\\'"</span> . cmake-mode))
'((<span style="color: #ffffaf;">"\\.cmake\\'"</span> . cmake-mode))
auto-mode-alist))
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">cmake-font-lock</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(add-hook 'cmake-mode-hook 'cmake-font-lock-activate)
(add-hook 'yaml-mode-hook 'warnings-mode-hook)))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-5" class="outline-3">
<h3 id="sec-15-5"><span class="section-number-3">15.5</span> Ruby</h3>
<div class="outline-text-3" id="text-15-5">
<p>
Include warning keywords in Ruby.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(add-hook 'ruby-mode-hook 'warnings-mode-hook)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-6" class="outline-3">
<h3 id="sec-15-6"><span class="section-number-3">15.6</span> Go</h3>
<div class="outline-text-3" id="text-15-6">
<p>
And now my Go configuration. This includes stuff like the usage of <code>goimports</code>,
<code>gofmt</code> on save, among many other useful things.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">defun</span> <span style="color: #d0d0d0;">mssola-go-mode</span> ()
<span style="color: #808080;">"My configuration for Go mode."</span>
<span style="color: #808080;">; </span><span style="color: #808080;">Use goimports instead of go-fmt</span>
(<span style="color: #87afd7;">setq</span> gofmt-command <span style="color: #ffffaf;">"goimports"</span>)
<span style="color: #808080;">; </span><span style="color: #808080;">Call Gofmt before saving</span>
(add-hook 'before-save-hook 'gofmt-before-save)
<span style="color: #808080;">; </span><span style="color: #808080;">Integration flycheck with Go</span>
(add-to-list 'load-path
(concat (getenv <span style="color: #ffffaf;">"GOPATH"</span>) <span style="color: #ffffaf;">"/src/github.com/dougm/goflymake"</span>))
(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">go-flycheck</span>)
(evil-leader/set-key
<span style="color: #ffffaf;">"."</span> 'godef-jump-other-window)
(<span style="color: #87afd7;">setq</span> indent-tabs-mode t)
(flyspell-prog-mode)
<span style="color: #808080;">; </span><span style="color: #808080;">eldoc support</span>
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">go-eldoc</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(<span style="color: #87afd7;">require</span> '<span style="color: #ffffaf;">go-eldoc</span>))
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">go-add-tags</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(evil-leader/set-key <span style="color: #ffffaf;">"t"</span> 'go-add-tags)))
<span style="color: #808080;">;; </span><span style="color: #808080;">Go</span>
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">go-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:pin</span> melpa-stable
<span style="color: #87afd7;">:config</span>
(add-hook 'go-mode-hook 'warnings-mode-hook)
(add-hook 'go-mode-hook 'go-eldoc-setup)
(add-hook 'go-mode-hook 'mssola-go-mode))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-7" class="outline-3">
<h3 id="sec-15-7"><span class="section-number-3">15.7</span> Rust</h3>
<div class="outline-text-3" id="text-15-7">
<p>
Install <code>rust-mode</code> and add some hooks to make it friendlier.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">rust-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(add-hook 'before-save-hook
#'(lambda ()
(<span style="color: #87afd7;">when</span> (eq major-mode 'rust-mode)
(rust-format-buffer))))
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">flycheck-rust</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-8" class="outline-3">
<h3 id="sec-15-8"><span class="section-number-3">15.8</span> Tabs vs spaces</h3>
<div class="outline-text-3" id="text-15-8">
<p>
Tabs or spaces? <a href="https://www.emacswiki.org/emacs/TabsSpacesBoth">Both</a>. The <code>smart-tabs-mode</code> has the philosophy of: tabs for
indentation, spaces for alignment. This is only applied in languages where I'm
usings tabs for indentation (C, C++ and Go).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">smart-tabs-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(<span style="color: #87afd7;">smart-tabs-add-language-support</span> golang go-mode-hook
((c-indent-line . c-basic-offset)
(c-indent-region . c-basic-offset)))
(smart-tabs-insinuate 'c 'c++ 'golang))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-9" class="outline-3">
<h3 id="sec-15-9"><span class="section-number-3">15.9</span> Inferior markup languages.</h3>
<div class="outline-text-3" id="text-15-9">
<div class="org-src-container">
<pre class="src src-elisp"><span style="color: #808080;">;; </span><span style="color: #808080;">Markdown mode with preview mode in the browser.</span>
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">markdown-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
<span style="color: #808080;">; </span><span style="color: #808080;">This is the one that I got from openSUSE.</span>
(custom-set-variables
'(markdown-command <span style="color: #ffffaf;">"/usr/bin/markdown-calibre"</span>))
<span style="color: #808080;">; </span><span style="color: #808080;">Preview mode does its things through websockets, so it's a requirement.</span>
<span style="color: #808080;">; </span><span style="color: #808080;">After that, we can safely require it.</span>
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">websocket</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">markdown-preview-mode</span>
<span style="color: #87afd7;">:ensure</span> t)))
<span style="color: #808080;">; </span><span style="color: #808080;">YAML</span>
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">yaml-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(add-hook 'yaml-mode-hook 'warnings-mode-hook))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-10" class="outline-3">
<h3 id="sec-15-10"><span class="section-number-3">15.10</span> Web-related stuff.</h3>
<div class="outline-text-3" id="text-15-10">
<p>
Slim and SCSS.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">slim-mode</span>
<span style="color: #87afd7;">:ensure</span> t)
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">scss-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(<span style="color: #87afd7;">setq</span> scss-compile-at-save nil)
(add-hook 'yaml-mode-hook 'warnings-mode-hook))
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">coffee-mode</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
<p>
Languages specific for backend code like PHP, and <code>web-mode</code>, which provides a
bundle of features which are interesting for web-related stuff.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">php-mode</span>
<span style="color: #87afd7;">:ensure</span> t)
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">web-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(add-to-list 'auto-mode-alist '(<span style="color: #ffffaf;">"\\.erb\\'"</span> . web-mode))
(add-to-list 'auto-mode-alist '(<span style="color: #ffffaf;">"\\.jinja\\'"</span> . web-mode))
(add-to-list 'auto-mode-alist '(<span style="color: #ffffaf;">"\\.html?\\'"</span> . web-mode))
(add-hook 'web-mode-hook
(<span style="color: #87afd7;">lambda</span> ()
(<span style="color: #87afd7;">setq</span> web-mode-markup-indent-offset 2)
(<span style="color: #87afd7;">setq</span> web-mode-css-indent-offset 2)
(<span style="color: #87afd7;">setq</span> web-mode-code-indent-offset 2)))
(add-hook 'js-mode-hook
(<span style="color: #87afd7;">lambda</span> ()
(<span style="color: #87afd7;">setq</span> js-indent-level 2)
(rainbow-delimiters-mode 1)))
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">vue-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(<span style="color: #87afd7;">setq</span> mmm-submode-decoration-level 0))
<span style="color: #808080;">; </span><span style="color: #808080;">React: treat it as a derived mode. Idea taken from spacemacs.</span>
(<span style="color: #87afd7;">define-derived-mode</span> <span style="color: #d0d0d0;">react-mode</span> web-mode <span style="color: #ffffaf;">"react"</span>)
(add-to-list 'auto-mode-alist '(<span style="color: #ffffaf;">"\\.jsx\\'"</span> . react-mode))
(add-to-list 'auto-mode-alist '(<span style="color: #ffffaf;">"\\.react.js\\'"</span> . react-mode))
(add-hook 'react-mode-hook
(<span style="color: #87afd7;">lambda</span> ()
(yas-activate-extra-mode 'js-mode)
(web-mode-set-content-type <span style="color: #ffffaf;">"jsx"</span>)
(<span style="color: #87afd7;">setq-local</span> web-mode-enable-auto-quoting nil)
(rainbow-delimiters 1))))
</pre>
</div>
<p>
The <code>json-reformat</code> package provides functions for reformatting JSON strings. It
happens from time to time that I have to read JSON output from responses, and it
can be frustrating without proper formatting.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">json-reformat</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-11" class="outline-3">
<h3 id="sec-15-11"><span class="section-number-3">15.11</span> Devops</h3>
<div class="outline-text-3" id="text-15-11">
<p>
Highlighting for Dockerfiles.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">dockerfile-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(add-to-list 'auto-mode-alist '(<span style="color: #ffffaf;">"Dockerfile\\'"</span> . dockerfile-mode)))
</pre>
</div>
<p>
Stuff from Hashicorp like terraform and HCL.
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">terraform-mode</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(terraform-format-on-save-mode))
(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">hcl-mode</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">salt-mode</span>
<span style="color: #87afd7;">:ensure</span> t)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-15-12" class="outline-3">
<h3 id="sec-15-12"><span class="section-number-3">15.12</span> Others</h3>
<div class="outline-text-3" id="text-15-12">
<p>
The <i>soria</i> theme has the <code>soria-purple-identifiers</code> hook. This hook instructs
the theme to use purple for identifiers instead of the default color. This is a
remnant from my Vim times, and I only apply it to some languages (random
criteria really).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">dolist</span> (lang-hook '(ruby-mode-hook
php-mode-hook
perl-mode-hook
emacs-lisp-mode-hook))
(add-hook lang-hook 'soria-purple-identifiers))
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-sec-16" class="outline-2">
<h2 id="sec-16"><span class="section-number-2">16</span> WoMan</h2>
<div class="outline-text-2" id="text-16">
<p>
<code>WoMan</code> is a package that is included inside of GNU Emacs by default, and that
takes care of visualizing man pages. Let's properly setup Evil mode for this:
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">with-eval-after-load</span> <span style="color: #ffffaf;">"evil"</span>
(evil-set-initial-state 'woman-mode 'normal)
(<span style="color: #87afd7;">evil-define-key</span> 'normal woman-mode-map
<span style="color: #ffffaf;">"J"</span> 'Man-next-section
<span style="color: #ffffaf;">"K"</span> 'Man-previous-section
<span style="color: #ffffaf;">"\C-h"</span> 'evil-window-left
<span style="color: #ffffaf;">"\C-l"</span> 'evil-window-right
<span style="color: #ffffaf;">"\C-j"</span> 'evil-window-down
<span style="color: #ffffaf;">"\C-k"</span> 'evil-window-up
<span style="color: #ffffaf;">"\C-u"</span> 'evil-scroll-up))
</pre>
</div>
<p>
Finally, I want man pages to fill all the frame:
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">setq</span> woman-fill-frame t)
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-17" class="outline-2">
<h2 id="sec-17"><span class="section-number-2">17</span> Misc</h2>
<div class="outline-text-2" id="text-17">
<p>
Install a set of useful functions from <a href="https://github.com/bbatsov">@bbatsov</a>. The bindings are following
Emacs style instead of being more Vim-like on purpose (I don't want to put
too many things into my leader and these shortcuts look sensible to me).
</p>
<div class="org-src-container">
<pre class="src src-elisp">(<span style="color: #87afd7;">use-package</span> <span style="color: #ffffaf;">crux</span>
<span style="color: #87afd7;">:ensure</span> t
<span style="color: #87afd7;">:config</span>
(global-set-key (kbd <span style="color: #ffffaf;">"C-c d"</span>) 'crux-delete-file-and-buffer)
(global-set-key (kbd <span style="color: #ffffaf;">"C-c r"</span>) 'crux-rename-file-and-buffer)
(global-set-key (kbd <span style="color: #ffffaf;">"C-c o"</span>) 'crux-open-with))
</pre>
</div>
</div>
</div>
<div id="outline-container-sec-18" class="outline-2">
<h2 id="sec-18"><span class="section-number-2">18</span> Credits</h2>
<div class="outline-text-2" id="text-18">
<p>
I've built this file by simply scavenging from other people's emacs.d/dotfiles
repositories. I have taken lots of pieces from here and there, but most notably:
</p>
<ul class="org-ul">
<li><a href="https://github.com/ereslibre/dotfiles">@ereslibre</a>
</li>
<li><a href="https://github.com/dmacvicar/dotfiles">@dmacvicar</a>
</li>
<li><a href="https://github.com/bbatsov/emacs.d">@bbatsov</a>
</li>
<li><a href="https://github.com/aaronbieber/dotfiles">@aaronbieber</a>
</li>
<li><a href="https://github.com/purcell/emacs.d">@purcell</a>
</li>
<li><a href="https://github.com/sachac/.emacs.d">@sachac</a> (<a href="http://pages.sachachua.com/.emacs.d/Sacha.html">HTML version</a>)
</li>
<li><a href="https://github.com/larstvei/dot-emacs">@larstvei</a>
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-19" class="outline-2">
<h2 id="sec-19"><span class="section-number-2">19</span> License</h2>
<div class="outline-text-2" id="text-19">
<div class="org-src-container">
<pre class="src src-text">Copyright (C) 2014-2017 Miquel Sabaté Solà <a href="mailto:mikisabate%40gmail.com"><mikisabate@gmail.com></a>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <a href="http://www.gnu.org/licenses/"><http://www.gnu.org/licenses/></a>.
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Miquel Sabaté Solà</p>
<p class="date">Created: 2017-12-06 Wed 13:33</p>
<p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.3.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10)</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>
|