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
|
This is (will be) my Emacs literate configuration file. A self
contained file with all my configuration is useful for documentation
purposes. It will be modeled using the technique described by
Protesilaos for his own Emacs config file:
<https://protesilaos.com/emacs/dotemacs>.
This method consists in generating all files /a priori/, after modifying
this file, and *not* at load time, as that would be too slow.
#+begin_src emacs-lisp :tangle no :results none
(org-babel-tangle)
#+end_src
* Overview of files and directories
- =early-init.el=: quoting the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Early-Init-File.html][Emacs documentation]], this file is "loaded
before the package system and GUI is initialized, so in it you can
customize variables that affect the package initialization process"
- =init.el=: the skeleton of my configuration framework. It will load
the rest of the modules.
- =rul-emacs-modules/=: a directory with Emacs modules specific to my
configuration. Modules group code related to a topic or theme of
configuration. For example, =rul-prog.el= contains code related to
programming, and =rul-org.el= contains code related to org-mode. If a
module gets too big, I can create a smaller module under the same
topic; for example, =rul-org-agenda.el=.
- =rul-post-init.el=: this file will be loaded after =init.el=, and will
normally live in other git repository. Here I normally add overrides
needed in my work computer.
- =rul-emacs.org=: this file. It (will) generate the rest of the structure.
* Early configuration file (=early-init.el=)
** Graphical aspects
Customization of graphical aspects of Emacs, such as size, panels, etc.
#+begin_src emacs-lisp :tangle "early-init.el"
;; I don't use any of these
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
#+end_src
** Frame configuration
I like to keep a few frames open all the time. A main frame, where I
open my org files, code, etc. A frame for communication and reading,
such as email and feeds, and a frame for terminals.
Currently, the frames are all the same, but I will add configuration
to distinguish them so I can automate their placement in my desktop
environment.
#+begin_src emacs-lisp :tangle "early-init.el"
;; Do not resize when font size changes
(setq frame-resize-pixelwise t)
;; By default, start maximized, undecorated
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(add-to-list 'default-frame-alist '(undecorated . t))
;; Extend this list from to add more startup frames.
(defvar rul-startup-frames
'(("main" . nil)
("terminals" . multi-vterm))
"Startup frame specifications.
Each entry has the form (NAME . SETUP). NAME is the frame name.
SETUP is an optional function or interactive command called in that frame.")
(defun rul-run-startup-frame-setup (setup)
"Run startup frame SETUP."
(cond
((null setup) nil)
((commandp setup) (call-interactively setup))
((functionp setup) (funcall setup))
(t (message "Ignoring invalid startup frame setup: %S" setup))))
(defun rul-apply-startup-frame-name (frame name)
"Set FRAME name and title to NAME."
(with-selected-frame frame
(set-frame-name name)
(modify-frame-parameters frame `((title . ,name)))))
(defun rul-create-startup-frames ()
"Create the configured startup frames."
(when (display-graphic-p)
(let ((initial-frame (selected-frame))
(specs rul-startup-frames))
(when specs
(pcase-let ((`(,name . ,setup) (car specs)))
(rul-apply-startup-frame-name initial-frame name)
(with-selected-frame initial-frame
(rul-run-startup-frame-setup setup)))
(dolist (spec (cdr specs))
(pcase-let ((`(,name . ,setup) spec))
(let ((frame (make-frame `((name . ,name)
(title . ,name)))))
(rul-apply-startup-frame-name frame name)
(with-selected-frame frame
(rul-run-startup-frame-setup setup)))))
(select-frame initial-frame)))))
(add-hook 'emacs-startup-hook #'rul-create-startup-frames)
#+end_src
** Miscellany
#+begin_src emacs-lisp :tangle "early-init.el"
;; Initialise installed packages, otherwise, basic functions are not
;; available during the initialization stage.
(setq package-enable-at-startup t)
;; Do not report warnings. It's too noisy.
(setq native-comp-async-report-warnings-errors 'silent)
;; Keep things minimal
(setq inhibit-startup-screen t)
(setq inhibit-startup-echo-area-message user-login-name)
#+end_src
* Main configuration file (=init.el=)
** Package matters
I use package from both stable and bleeding-edge Melpa.
#+begin_src emacs-lisp :tangle "init.el"
;; package.el
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
#+end_src
** Backups
Emacs tends to clutter the filesystem with backup files. A backup file is normally the filename with a =~= suffix. I rather have my filesystem clean, and centralize all backups in a single directory.
#+begin_src emacs-lisp :tangle "init.el"
(let ((backup-dir "~/.backup"))
(unless (file-directory-p backup-dir)
(make-directory backup-dir t))
(setq backup-directory-alist `(("." . ,backup-dir))))
(setq
backup-by-copying t ; Don't delink hardlinks
delete-old-versions t ; Clean up the backups
kept-new-versions 3 ; keep some new versions
kept-old-versions 2 ; and some old ones, too
version-control t) ; Use version numbers on backups
#+end_src
** Customizations
Customizations don't place nicely with version control, so I do them in a random file that won't get persisted.
Configurations that need persisting will be added to =custom-set-variables= and =custom-set-faces=.
#+begin_src emacs-lisp :tangle "init.el"
;; Do not persist customizations
(setq custom-file (make-temp-file "emacs-custom-"))
#+end_src
** Editor interface
General configurations related to text editing across all modes.
#+begin_src emacs-lisp :tangle "init.el"
(setq fill-column 79) ; Wrap lines
(setq mouse-yank-at-point t) ; Do not follow mouse curors when mouse-yanking
(setq-default indent-tabs-mode nil) ; No tabs when indenting
(setq-default tab-width 4) ; How many spaces a tab represents
(setq initial-scratch-message "")
(defalias 'yes-or-no-p 'y-or-n-p)
;; Only flash the mode line
(setq ring-bell-function
(lambda ()
(let ((orig-fg (face-foreground 'mode-line)))
(set-face-foreground 'mode-line "#F2804F")
(run-with-idle-timer 0.1 nil
(lambda (fg) (set-face-foreground 'mode-line fg))
orig-fg))))
;; Highlight parens
(setq show-paren-delay 0)
(show-paren-mode 1)
(savehist-mode 1) ; Save histories, including minibuffer
(save-place-mode 1) ; Remember and restore cursor information
(setq auto-save-no-message t) ; Do not print a message when auto-saving
(pixel-scroll-precision-mode 1) ; Precision scrolling
;; Source: https://protesilaos.com/codelog/2024-12-11-emacs-diff-save-some-buffers/
(add-to-list 'save-some-buffers-action-alist
(list "d"
(lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer)))
"show diff between the buffer and its file"))
#+end_src
** Emacs server
I used to run Emacs as a systemd daemon, but it was not too deterministic as sometimes it would break.
https://rbenencia.name/blog/emacs-daemon-as-a-systemd-service/
Now, I simply start it from Emacs itself. This approach works well for me.
#+begin_src emacs-lisp :tangle "init.el"
;; Server
(require 'server)
(setq server-client-instructions nil) ; Keep it quiet when opening an ec
(unless (server-running-p)
(server-start))
#+end_src
** Modules machinery
#+begin_src emacs-lisp :tangle "init.el"
(dolist (path '("~/.emacs.d/rul-lisp/packages"))
(add-to-list 'load-path path))
(when-let* ((file (locate-user-emacs-file "rul-pre-init.el"))
((file-exists-p file)))
(load-file file))
(require 'rul-themes)
(require 'rul-bindings)
(require 'rul-completion)
(require 'rul-dashboard)
(require 'rul-fm)
(require 'rul-fonts)
(require 'rul-io)
(require 'rul-mail)
(require 'rul-modeline)
(require 'rul-org)
(require 'rul-prog)
(require 'rul-terminals)
(require 'rul-vc)
(require 'rul-wm)
(require 'rul-write)
(when-let* ((file (locate-user-emacs-file "rul-post-init.el"))
((file-exists-p file)))
(load-file file))
;; init.el ends here
#+end_src
* Modules
I group my configuration in logical modules. In general, a module
contains configuration for more than one package.
** The =themes= module
The =themes= module contains code pertaining to Emacs themes.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-themes.el"
(use-package ef-themes :ensure t)
(use-package modus-themes
:ensure t
:config
(setq
modus-themes-mode-line '(accented borderless padded)
modus-themes-region '(bg-only)
modus-themes-bold-constructs t
modus-themes-italic-constructs t
modus-themes-paren-match '(bold intense)
modus-themes-headings (quote ((1 . (rainbow variable-pitch 1.3))
(2 . (rainbow 1.1))
(t . (rainbow))))
modus-themes-org-blocks 'tinted))
#+end_src
Additionally, this module subscribes to =org.freedesktop.appearance color-theme=
to detect what color theme is preferred, and set our Emacs theme accordingly.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-themes.el"
(use-package dbus)
(defun mf/set-theme-from-dbus-value (value)
"Set the appropiate theme according to the color-scheme setting value."
(message "value is %s" value)
(if (equal value '1)
(progn (message "Switch to dark theme")
(modus-themes-select 'modus-vivendi))
(progn (message "Switch to light theme")
(modus-themes-select 'modus-operandi))))
(defun mf/color-scheme-changed (path var value)
"DBus handler to detect when the color-scheme has changed."
(when (and (string-equal path "org.freedesktop.appearance")
(string-equal var "color-scheme"))
(mf/set-theme-from-dbus-value (car value))
))
;; Register for future changes
(dbus-register-signal
:session "org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop" "org.freedesktop.portal.Settings"
"SettingChanged"
#'mf/color-scheme-changed)
;; Request the current color-scheme
(dbus-call-method-asynchronously
:session "org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop" "org.freedesktop.portal.Settings"
"Read"
(lambda (value) (mf/set-theme-from-dbus-value (caar value)))
"org.freedesktop.appearance"
"color-scheme"
)
(provide 'rul-themes)
#+end_src
** The =bindings= module
This module contains code pertaining to keybindings. It starts by
defining a set global keys.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-bindings.el"
;; Global keybindings
(global-set-key (kbd "C-c R") 'revert-buffer)
(global-set-key (kbd "C-c w") 'whitespace-cleanup)
(defun help/insert-em-dash ()
"Inserts an EM-DASH (not a HYPEN, not an N-DASH)"
(interactive)
(insert "—"))
(global-set-key (kbd "C--") #'help/insert-em-dash)
#+end_src
Next, we define a few /hydras/. /Hydras/ are a way of grouping keybindings
together, offering a menu on the way.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-bindings.el"
(use-package hydra
:ensure t
:defer 1)
;; tab-bar
(defhydra hydra-tab-bar (:color amaranth)
"Tab Bar Operations"
("t" tab-new "Create a new tab" :column "Creation" :exit t)
("d" dired-other-tab "Open Dired in another tab")
("f" find-file-other-tab "Find file in another tab")
("x" tab-close "Close current tab")
("m" tab-move "Move current tab" :column "Management")
("r" tab-rename "Rename Tab")
("<return>" tab-bar-select-tab-by-name "Select tab by name" :column "Navigation")
("l" tab-next "Next Tab")
("j" tab-previous "Previous Tab")
("q" nil "Exit" :exit t))
(global-set-key (kbd "C-x t") 'hydra-tab-bar/body)
;; Zoom
(defhydra hydra-zoom ()
"zoom"
("g" text-scale-increase "in")
("l" text-scale-decrease "out"))
(global-set-key (kbd "C-c z") 'hydra-zoom/body)
;; Go
(defhydra hydra-go ()
"zoom"
("=" gofmt :exit t)
("c" go-coverage :exit t))
(global-set-key (kbd "C-c m") 'hydra-go/body)
#+end_src
Finally, we make use of =which-key=, which will show a menu with all
keybinding options after a prefix is pressed. I think this package has
the potential to obsolete =hydra=, so I'll have to revisit that code.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-bindings.el"
(use-package which-key
:ensure t
:config
(which-key-mode))
(provide 'rul-bindings)
#+end_src
** The =completions= module
This module contains code pertaining to completion and the minibuffer.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-completion.el"
(use-package orderless :ensure t)
(setq completion-styles '(basic substring initials orderless))
(setq completion-category-overrides
'(
(file (styles . (basic partial-completion orderless)))
(project-file (styles . (flex basic substring partial-completion orderless)))
))
(setq completion-ignore-case t)
#+end_src
The =vertico= package provides a vertical completion UI based on the default completion
system.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-completion.el"
;; Enable vertico
(use-package vertico
:ensure t
:init
(vertico-mode)
:config
(add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
#+end_src
The =marginalia= package annotates the completion candidates with useful contextual
information.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-completion.el"
;; Enable rich annotations using the Marginalia package
(use-package marginalia
:ensure t
:bind (:map minibuffer-local-map
("M-A" . marginalia-cycle))
:init
(marginalia-mode))
#+end_src
The =consult= package replaces most of Emacs core functions with
completion-friendly alternatives that integrates well with =vertico= and
=marginalia=.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-completion.el"
(use-package consult
:ensure t
:bind (;; C-c bindings in `mode-specific-map'
("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
([remap Info-search] . consult-info)
;; C-x bindings in `ctl-x-map'
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
;; M-g bindings in `goto-map'
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ;; orig. goto-line
("M-g M-g" . consult-goto-line) ;; orig. goto-line
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings in `search-map'
("M-s d" . consult-find)
("M-s D" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history) ;; orig. next-matching-history-element
("M-r" . consult-history)) ;; orig. previous-matching-history-element
:init
(setq xref-show-xrefs-function #'consult-xref)
(setq xref-show-definitions-function #'consult-xref)
(add-hook 'completion-list-mode-hook #'consult-preview-at-point-mode)
:config
(setq consult-preview-key 'any)
(setq consult-narrow-key "<")
)
#+end_src
The next piece of code corresponds to =embark=, a package that enables
context-specific actions in the minibuffer, or common buffers.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-completion.el"
(use-package embark
:ensure t
:bind
(("C-." . embark-act) ;; pick some comfortable binding
("M-." . embark-dwim) ;; good alternative: M-.
("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
:init
(setq prefix-help-command #'embark-prefix-help-command)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
(use-package embark-consult
:ensure t
:hook
(embark-collect-mode . consult-preview-at-point-mode))
(provide 'rul-completion)
#+end_src
** The =dashboard= module
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-dashboard.el"
(use-package page-break-lines :ensure t)
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook)
:custom
(dashboard-center-content t)
(dashboard-startup-banner 3)
(dashboard-items '((recents . 5)
(bookmarks . 5)
(projects . 5)
(agenda . 5)
))
(dashboard-icon-type 'nerd-icons)
(dashboard-set-heading-icons t)
(dashboard-set-file-icons t)
)
(provide 'rul-dashboard)
#+end_src
** The =fm= module
The =fm= module contains code pertaining to file management. In
particular, it's the module that configures =dired= and adds a few extra
packages.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-fm.el"
;;; rul-fm.el --- File management
;; dired
(add-hook 'dired-mode-hook #'dired-hide-details-mode)
(setq dired-guess-shell-alist-user
'(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open")
("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open")
(".*" "xdg-open")))
(setq dired-kill-when-opening-new-dired-buffer t)
(put 'dired-find-alternate-file 'disabled nil)
;;; Icons
(use-package nerd-icons :ensure t )
(use-package nerd-icons-dired :ensure t
:config
(add-hook 'dired-mode-hook #'nerd-icons-dired-mode))
(provide 'rul-fm)
#+end_src
** The =fonts= module
The =fonts= module contains code pertaining to fonts. In particular, it
installs =fontaine=, a software that allows defining font presets.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-fonts.el"
;;; rul-fonts.el --- Fonts configuration
(use-package fontaine
:ensure t
:config
(setq fontaine-presets
'((tiny
:default-height 100)
(small
:default-height 120)
(medium
:default-height 150)
(wayland-medium
:default-height 320)
(large
:default-weight semilight
:default-height 180
:bold-weight extrabold)
(presentation
:default-weight semilight
:default-height 200
:bold-weight extrabold)
(jumbo
:default-weight semilight
:default-height 230
:bold-weight extrabold)
(writing
:default-height 140
:default-family "Lato"
:variable-pitch-family "Regular"
)
(t
:default-family "Iosevka"
:default-weight regular
:default-height 150
:variable-pitch-family "Iosevka Aile")))
(fontaine-set-preset 'medium))
(provide 'rul-fonts)
#+end_src
** The =io= module
The =io= module contains configurations for packages related to Internet
services and media. I don't have excessive costumizations in these
packages, so they're somewhat unrelated fragments of code grouped in
the same file.
We install =elfeed= to browse RSS and Atom feeds.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-io.el"
;;; rul-io.el --- Configuration for Internet and media packages
(use-package elfeed :ensure t)
(provide 'rul-feeds)
#+end_src
The =empv= package allow us to use the =mpv= player from within
Emacs. Here we're simply installing it and configuring it with some
Internet radio channels. It requires =mpv= to be installed.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-io.el"
(use-package empv
:ensure t
:config
(bind-key "C-x m" empv-map)
(setq empv-radio-channels
'(
("SomaFM - Groove Salad" . "http://www.somafm.com/groovesalad.pls")
("SomaFM - DEFCON" . "https://somafm.com/defcon256.pls")
("SomaFM - Metal" . "https://somafm.com/metal.pls")
("SomaFM - Lush" . "https://somafm.com/lush130.pls")
("KCSM Jazz 91" . "http://ice5.securenetsystems.net/KCSM")
("KSUA 91.5 FM" . "https://stream.radio.co/se776fab22/listen")
))
(setq empv-fd-binary "fdfind")
)
(provide 'rul-io)
#+end_src
** The =mail= module
Emacs can act as Mail User Agent. My preferred package for this is
=notmuch=.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-mail.el"
;;; rul-mail.el --- Email configuration
;; mml-sec.el
;; Use sender to find GPG key.
(setq mml-secure-openpgp-sign-with-sender t)
(use-package notmuch
:ensure t
:config
;; UI
(setq notmuch-show-logo nil
notmuch-column-control 1.0
notmuch-hello-auto-refresh t
notmuch-hello-recent-searches-max 20
notmuch-hello-thousands-separator ""
notmuch-show-all-tags-list t
notmuch-show-text/html-blocked-images nil
)
(setq notmuch-draft-folder "current/Drafts")
;; Keymaps
(defun rul/capture-mail()
"Capture mail to org mode."
(interactive)
(org-store-link nil)
(org-capture nil "m")
)
(bind-key "c" 'rul/capture-mail notmuch-show-mode-map)
(define-key notmuch-show-mode-map "R" 'notmuch-show-reply)
(define-key notmuch-search-mode-map "R" 'notmuch-search-reply-to-thread)
;; Spam
(define-key notmuch-show-mode-map "S"
(lambda ()
"mark message as spam"
(interactive)
(notmuch-show-tag (list "+spam" "-inbox" "-unread"))))
(define-key notmuch-search-mode-map "S"
(lambda (&optional beg end)
"mark thread as spam"
(interactive (notmuch-search-interactive-region))
(notmuch-search-tag (list "+spam" "-inbox" "-unread") beg end)))
;; Archive
(setq notmuch-archive-tags (list "-inbox" "+archive"))
(define-key notmuch-show-mode-map "A"
(lambda ()
"archive"
(interactive)
(notmuch-show-tag (list "+archive" "-inbox" "-unread"))
(notmuch-refresh-this-buffer)))
(define-key notmuch-search-mode-map "A"
(lambda (&optional beg end)
"archive thread"
(interactive (notmuch-search-interactive-region))
(notmuch-search-tag (list "+archive" "-inbox" "-unread") beg end)
(notmuch-refresh-this-buffer)))
;; Mark as read
(define-key notmuch-search-mode-map "r"
(lambda (&optional beg end)
"mark thread as read"
(interactive (notmuch-search-interactive-region))
(notmuch-search-tag (list "-unread") beg end)
(notmuch-search-next-thread)))
(define-key notmuch-search-mode-map (kbd "RET")
(lambda ()
"Show the selected thread with notmuch-tree if it has more
than one email. Use notmuch-show otherwise."
(interactive)
(if (= (plist-get (notmuch-search-get-result) :total) 1)
(notmuch-search-show-thread)
(notmuch-tree (notmuch-search-find-thread-id)
notmuch-search-query-string
nil
(notmuch-prettify-subject (notmuch-search-find-subject))))))
(defun color-inbox-if-unread () (interactive)
(save-excursion
(goto-char (point-min))
(let ((cnt (car (process-lines "notmuch" "count" "tag:inbox and tag:unread"))))
(when (> (string-to-number cnt) 0)
(save-excursion
(when (search-forward "inbox" (point-max) t)
(let* ((overlays (overlays-in (match-beginning 0) (match-end 0)))
(overlay (car overlays)))
(when overlay
(overlay-put overlay 'face '((:inherit bold) (:foreground "green")))))))))))
(defvar notmuch-hello-refresh-count 0)
(defun notmuch-hello-refresh-status-message ()
(let* ((new-count
(string-to-number
(car (process-lines notmuch-command "count"))))
(diff-count (- new-count notmuch-hello-refresh-count)))
(cond
((= notmuch-hello-refresh-count 0)
(message "You have %s messages."
(notmuch-hello-nice-number new-count)))
((> diff-count 0)
(message "You have %s more messages since last refresh."
(notmuch-hello-nice-number diff-count)))
((< diff-count 0)
(message "You have %s fewer messages since last refresh."
(notmuch-hello-nice-number (- diff-count)))))
(setq notmuch-hello-refresh-count new-count)))
(add-hook 'notmuch-hello-refresh-hook 'color-inbox-if-unread)
(add-hook 'notmuch-hello-refresh-hook 'notmuch-hello-refresh-status-message)
(setq notmuch-hello-sections '(notmuch-hello-insert-saved-searches
notmuch-hello-insert-search
notmuch-hello-insert-recent-searches
notmuch-hello-insert-alltags
))
;; https://git.sr.ht/~tslil/dotfiles/tree/4e51afbb/emacs/notmuch-config.el#L76-82
(defmacro make-binds (mode-map binds argfunc &rest body)
"Create keybindings in `mode-map' using a list of (keystr . arg)
pairs in `binds' of the form ( ... (argfunc arg) body)."
`(progn ,@(mapcar (lambda (pair)
`(define-key ,mode-map (kbd ,(car pair))
(lambda () (interactive) (,argfunc ,(cdr pair)) ,@body)))
(eval binds))))
(defvar notmuch-hello-tree-searches '(("u" . "tag:unread")
("i" . "tag:inbox")
("*" . "*"))
"List of (key . query) pairs to bind in notmuch-hello.")
(make-binds notmuch-hello-mode-map
notmuch-hello-tree-searches
notmuch-search)
) ;; ends use-package notmuch
(use-package notmuch-indicator :ensure t)
(provide 'rul-mail)
#+end_src
** The =modeline= module
The =modeline= module contains code pertaining to Emacs modeline.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-modeline.el"
;;; rul-modeline.el --- Modeline configuration
;; Most of the code in this file is based on:
;; https://git.sr.ht/~protesilaos/dotfiles/tree/cf26bc34/item/emacs/.emacs.d/prot-lisp/prot-modeline.el
;;
;; All Kudos to Prot.
;;;; Faces
(defface rul-modeline-indicator-red
'((default :inherit bold)
(((class color) (min-colors 88) (background light))
:foreground "#880000")
(((class color) (min-colors 88) (background dark))
:foreground "#ff9f9f")
(t :foreground "red"))
"Face for modeline indicators.")
;;;; Common helper functions
(defcustom rul-modeline-string-truncate-length 9
"String length after which truncation should be done in small windows."
:type 'natnum)
(defun rul-modeline--string-truncate-p (str)
"Return non-nil if STR should be truncated."
(and (< (window-total-width) split-width-threshold)
(> (length str) rul-modeline-string-truncate-length)
(not (one-window-p :no-minibuffer))))
(defun rul-modeline-string-truncate (str)
"Return truncated STR, if appropriate, else return STR.
Truncation is done up to `rul-modeline-string-truncate-length'."
(if (rul-modeline--string-truncate-p str)
(concat (substring str 0 rul-modeline-string-truncate-length) "...")
str))
;;;; Major mode
(defun rul-modeline-major-mode-indicator ()
"Return appropriate propertized mode line indicator for the major mode."
(let ((indicator (cond
((derived-mode-p 'text-mode) "§")
((derived-mode-p 'prog-mode) "λ")
((derived-mode-p 'comint-mode) ">_")
(t "◦"))))
(propertize indicator 'face 'shadow)))
(defun rul-modeline-major-mode-name ()
"Return capitalized `major-mode' without the -mode suffix."
(capitalize (string-replace "-mode" "" (symbol-name major-mode))))
(defun rul-modeline-major-mode-help-echo ()
"Return `help-echo' value for `rul-modeline-major-mode'."
(if-let ((parent (get major-mode 'derived-mode-parent)))
(format "Symbol: `%s'. Derived from: `%s'" major-mode parent)
(format "Symbol: `%s'." major-mode)))
(defvar-local rul-modeline-major-mode
(list
(propertize "%[" 'face 'rul-modeline-indicator-red)
'(:eval
(concat
(rul-modeline-major-mode-indicator)
" "
(propertize
(rul-modeline-string-truncate
(rul-modeline-major-mode-name))
'mouse-face 'mode-line-highlight
'help-echo (rul-modeline-major-mode-help-echo))))
(propertize "%]" 'face 'rul-modeline-indicator-red))
"Mode line construct for displaying major modes.")
(with-eval-after-load 'eglot
(setq mode-line-misc-info
(delete '(eglot--managed-mode (" [" eglot--mode-line-format "] ")) mode-line-misc-info)))
(defvar-local prot-modeline-eglot
`(:eval
(when (and (featurep 'eglot) (mode-line-window-selected-p))
'(eglot--managed-mode eglot--mode-line-format)))
"Mode line construct displaying Eglot information.
Specific to the current window's mode line.")
;;;; Miscellaneous
(defvar-local rul-modeline-misc-info
'(:eval
(when (mode-line-window-selected-p)
mode-line-misc-info))
"Mode line construct displaying `mode-line-misc-info'.
Specific to the current window's mode line.")
;;;; Display current time
(setq display-time-format " %a %e %b, %H:%M ")
(setq display-time-default-load-average nil)
(setq display-time-mail-string "")
;;;; Variables used in the modeline need to be in `risky-local-variable'.
(dolist (construct '(
rul-modeline-major-mode
rul-modeline-misc-info
))
(put construct 'risky-local-variable t))
;;;; Finally, define the modeline format
(setq-default mode-line-format
'("%e"
mode-line-front-space
mode-line-buffer-identification
mode-line-front-space
mode-line-percent-position
mode-line-front-space
rul-modeline-major-mode
prot-modeline-eglot
mode-line-format-right-align
rul-modeline-misc-info
mode-line-front-space
mode-line-front-space
))
(provide 'rul-modeline)
#+end_src
** The =org= module
My org mode configuration is quite big, so I split it across multiple files.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-org.el"
;;; rul-org.el --- Org configuration
(require 'org)
(require 'org-capture)
(require 'org-protocol)
(require 'org-habit)
(require 'rul-org-agenda)
(setq org-attach-use-inheritance t)
(setq org-cycle-separator-lines 0)
(setq org-hide-leading-stars nil)
(setq org-startup-indented t)
(setq org-edit-src-content-indentation 0)
(use-package org-modern :ensure t)
(use-package org-pomodoro
:ensure t
:config
(defun rul/disable-notifications ()
"Disable GNOME notifications."
(shell-command "gsettings set org.gnome.desktop.notifications show-banners false"))
(defun rul/enable-notifications ()
"Enable GNOME notifications."
(shell-command "gsettings set org.gnome.desktop.notifications show-banners true"))
;; Add hooks for Pomodoro start and finish
(add-hook 'org-pomodoro-started-hook #'rul/disable-notifications)
(add-hook 'org-pomodoro-finished-hook #'rul/enable-notifications)
(add-hook 'org-pomodoro-killed-hook #'rul/enable-notifications))
;; (add-hook 'org-mode-hook 'turn-off-auto-fill)
;; (add-hook 'auto-save-hook 'org-save-all-org-buffers)
(add-hook 'org-mode-hook 'visual-line-mode)
(use-package org-download
:ensure t
:config
(add-hook 'dired-mode-hook 'org-download-enable))
(setq org-startup-indented t
org-pretty-entities nil
org-hide-emphasis-markers t
;; show actually italicized text instead of /italicized text/
org-fontify-whole-heading-line t
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t)
;; ORG BINDINGS ;;
(global-set-key (kbd "C-c l") #'org-store-link)
(global-set-key (kbd "C-c c") #'org-capture)
(global-set-key (kbd "C-c s") #'org-schedule)
(global-set-key (kbd "<f6>") 'org-clock-goto)
(global-set-key (kbd "<f9>") 'org-clock-in-last)
(global-set-key (kbd "<f10>") 'org-clock-out)
(global-set-key (kbd "<f12>") 'org-agenda)
;; ORG STATES ;;
(setq org-todo-keywords
(quote ((sequence "TODO(t)" "MAYBE(m)" "NEXT(n)" "|" "DONE(d)")
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "MEETING"))))
(setq org-use-fast-todo-selection t)
(setq org-todo-state-tags-triggers
(quote (("CANCELLED" ("CANCELLED" . t))
("WAITING" ("WAITING" . t))
("HOLD" ("WAITING") ("HOLD" . t))
(done ("WAITING") ("HOLD"))
("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
(setq org-enforce-todo-dependencies t)
(setq org-log-done (quote time))
(setq org-log-redeadline (quote time))
(setq org-log-reschedule (quote time))
(setq org-log-into-drawer t)
;; CAPTURE ;;
(setq org-capture-templates
(quote
(
("w" "Todo" entry
(file+headline org-refile-path "Tasks")
"* TODO %?"
:empty-lines 1)
("m"
"Capture incoming email"
entry
(file+headline org-refile-path "Incoming")
"* TODO Re: %:description\n\n Source: %u, %a\n"
:empty-lines 1)
("e" "Elfeed entry" entry
(file+headline org-refile-path "Read later")
"* %? [[%:link][%:description]]\n %U\n %:description\n")
("L" "Web Link" entry
(file+headline org-refile-path "Read later")
"* %?[[%:link][%:description]]\n %:initial\n \nCaptured On: %U"
)
("l" "Web Link with Selection" entry
(file+headline org-refile-path "Read later")
"* [[%:link][%:description]]\n %:initial\n \nCaptured On: %U")
)))
;; REFILE ;;
; Targets include this file and any file contributing to the agenda - up to 3 levels deep
(setq org-refile-targets
'((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 3)))
; Targets complete directly with IDO
(setq org-outline-path-complete-in-steps nil)
; Allow refile to create parent tasks with confirmation
(setq org-refile-allow-creating-parent-nodes (quote confirm))
;; ORG REPORTS ;;
; Set default column view headings: Task Effort Clock_Summary
(setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
(defun my-org-clocktable-indent-string (level)
(if (= level 1)
""
(let ((str "^"))
(while (> level 2)
(setq level (1- level)
str (concat str "--")))
(concat str "-> "))))
(advice-add 'org-clocktable-indent-string :override #'my-org-clocktable-indent-string)
(setq org-clock-clocktable-default-properties '(:maxlevel 4 :scope file :formula %))
; global Effort estimate values
; global STYLE property values for completion
(setq org-global-properties (quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00")
("STYLE_ALL" . "habit"))))
;; TAGS ;;
; Tags with fast selection keys
(setq org-tag-alist (quote ((:startgroup)
("@errand" . ?e)
("@office" . ?o)
("@home" . ?H)
(:endgroup)
("WAITING" . ?w)
("HOLD" . ?h)
("CANCELLED" . ?c)
("FLAGGED" . ??))))
(setq org-stuck-projects
'("+LEVEL=2+PROJECT/-MAYBE-DONE" ("NEXT") ("@shop")
"\\<IGNORE\\>"))
; Allow setting single tags without the menu
(setq org-fast-tag-selection-single-key (quote expert))
;; org-modern
(add-hook 'org-mode-hook 'org-modern-mode)
(add-hook 'org-agenda-finalize-hook #'org-modern-agenda)
;; Honor ATTR_ORG attribute. Defaults to image's width if not set.
(setq org-image-actual-width nil)
(setq org-clock-mode-line-total 'today)
;; org-tempus
(unless (package-installed-p 'org-tempus)
(package-vc-install "https://github.com/rul/org-tempus.git"))
(use-package org-tempus
:init
(org-tempus-mode 1))
(use-package org-remark-global-tracking
;; It is recommended that `org-remark-global-tracking-mode' be
;; enabled when Emacs initializes. You can set it in
;; `after-init-hook'.
:hook after-init
:config
;; Selectively keep or comment out the following if you want to use
;; extensions for Info-mode, EWW, and NOV.el (EPUB) respectively.
(use-package org-remark-eww :after eww :config (org-remark-eww-mode +1))
(use-package org-remark-nov :after nov :config (org-remark-nov-mode +1)))
(use-package org-remark
:bind (;; :bind keyword also implicitly defers org-remark itself.
;; Keybindings before :map is set for global-map. Adjust the keybinds
;; as you see fit.
("C-c n m" . org-remark-mark)
("C-c n l" . org-remark-mark-line)
:map org-remark-mode-map
("C-c n o" . org-remark-open)
("C-c n ]" . org-remark-view-next)
("C-c n [" . org-remark-view-prev)
("C-c n r" . org-remark-remove)
("C-c n d" . org-remark-delete)))
(provide 'rul-org)
#+end_src
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-org-agenda.el"
;;; rul-org-agenda.el --- Org agenda configuration
(require 'org)
(global-set-key (kbd "<f12>") #'org-agenda)
(global-set-key (kbd "C-c a") #'org-agenda)
(defun bh/is-project-p ()
"Any task with a todo keyword subtask"
(save-restriction
(widen)
(let ((has-subtask)
(subtree-end (save-excursion (org-end-of-subtree t)))
(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
(save-excursion
(forward-line 1)
(while (and (not has-subtask)
(< (point) subtree-end)
(re-search-forward "^\*+ " subtree-end t))
(when (member (org-get-todo-state) org-todo-keywords-1)
(setq has-subtask t))))
(and is-a-task has-subtask))))
(defun bh/is-project-subtree-p ()
"Any task with a todo keyword that is in a project subtree.
Callers of this function already widen the buffer view."
(let ((task (save-excursion (org-back-to-heading 'invisible-ok)
(point))))
(save-excursion
(bh/find-project-task)
(if (equal (point) task)
nil
t))))
(defun bh/is-task-p ()
"Any task with a todo keyword and no subtask"
(save-restriction
(widen)
(let ((has-subtask)
(subtree-end (save-excursion (org-end-of-subtree t)))
(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
(save-excursion
(forward-line 1)
(while (and (not has-subtask)
(< (point) subtree-end)
(re-search-forward "^\*+ " subtree-end t))
(when (member (org-get-todo-state) org-todo-keywords-1)
(setq has-subtask t))))
(and is-a-task (not has-subtask)))))
(defun bh/is-subproject-p ()
"Any task which is a subtask of another project"
(let ((is-subproject)
(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
(save-excursion
(while (and (not is-subproject) (org-up-heading-safe))
(when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
(setq is-subproject t))))
(and is-a-task is-subproject)))
(defun bh/list-sublevels-for-projects-indented ()
"Set org-tags-match-list-sublevels so when restricted to a subtree we list all subtasks.
This is normally used by skipping functions where this variable is already local to the agenda."
(if (marker-buffer org-agenda-restrict-begin)
(setq org-tags-match-list-sublevels 'indented)
(setq org-tags-match-list-sublevels nil))
nil)
(defun bh/list-sublevels-for-projects ()
"Set org-tags-match-list-sublevels so when restricted to a subtree we list all subtasks.
This is normally used by skipping functions where this variable is already local to the agenda."
(if (marker-buffer org-agenda-restrict-begin)
(setq org-tags-match-list-sublevels t)
(setq org-tags-match-list-sublevels nil))
nil)
(defvar bh/hide-scheduled-and-waiting-next-tasks t)
(defun bh/toggle-next-task-display ()
(interactive)
(setq bh/hide-scheduled-and-waiting-next-tasks (not bh/hide-scheduled-and-waiting-next-tasks))
(when (equal major-mode 'org-agenda-mode)
(org-agenda-redo))
(message "%s WAITING and SCHEDULED NEXT Tasks" (if bh/hide-scheduled-and-waiting-next-tasks "Hide" "Show")))
(defun bh/skip-stuck-projects ()
"Skip trees that are not stuck projects"
(save-restriction
(widen)
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
(if (bh/is-project-p)
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
(has-next ))
(save-excursion
(forward-line 1)
(while (and (not has-next) (< (point) subtree-end) (re-search-forward "^\\*+ NEXT " subtree-end t))
(unless (member "WAITING" (org-get-tags-at))
(setq has-next t))))
(if has-next
nil
next-headline)) ; a stuck project, has subtasks but no next task
nil))))
(defun bh/skip-non-stuck-projects ()
"Skip trees that are not stuck projects"
;; (bh/list-sublevels-for-projects-indented)
(save-restriction
(widen)
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
(if (bh/is-project-p)
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
(has-next ))
(save-excursion
(forward-line 1)
(while (and (not has-next) (< (point) subtree-end) (re-search-forward "^\\*+ NEXT " subtree-end t))
(unless (member "WAITING" (org-get-tags-at))
(setq has-next t))))
(if has-next
next-headline
nil)) ; a stuck project, has subtasks but no next task
next-headline))))
(defun bh/skip-non-projects ()
"Skip trees that are not projects"
;; (bh/list-sublevels-for-projects-indented)
(if (save-excursion (bh/skip-non-stuck-projects))
(save-restriction
(widen)
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
(cond
((bh/is-project-p)
nil)
((and (bh/is-project-subtree-p) (not (bh/is-task-p)))
nil)
(t
subtree-end))))
(save-excursion (org-end-of-subtree t))))
(defun bh/skip-non-tasks ()
"Show non-project tasks.
Skip project and sub-project tasks, habits, and project related tasks."
(save-restriction
(widen)
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
(cond
((bh/is-task-p)
nil)
(t
next-headline)))))
(defun bh/skip-project-trees-and-habits ()
"Skip trees that are projects"
(save-restriction
(widen)
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
(cond
((bh/is-project-p)
subtree-end)
((org-is-habit-p)
subtree-end)
(t
nil)))))
(defun bh/skip-projects-and-habits-and-single-tasks ()
"Skip trees that are projects, tasks that are habits, single non-project tasks"
(save-restriction
(widen)
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
(cond
((org-is-habit-p)
next-headline)
((and bh/hide-scheduled-and-waiting-next-tasks
(member "WAITING" (org-get-tags-at)))
next-headline)
((bh/is-project-p)
next-headline)
((and (bh/is-task-p) (not (bh/is-project-subtree-p)))
next-headline)
(t
nil)))))
(defun bh/skip-project-tasks-maybe ()
"Show tasks related to the current restriction.
When restricted to a project, skip project and sub project tasks, habits, NEXT tasks, and loose tasks.
When not restricted, skip project and sub-project tasks, habits, and project related tasks."
(save-restriction
(widen)
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
(next-headline (save-excursion (or (outline-next-heading) (point-max))))
(limit-to-project (marker-buffer org-agenda-restrict-begin)))
(cond
((bh/is-project-p)
next-headline)
((org-is-habit-p)
subtree-end)
((and (not limit-to-project)
(bh/is-project-subtree-p))
subtree-end)
((and limit-to-project
(bh/is-project-subtree-p)
(member (org-get-todo-state) (list "NEXT")))
subtree-end)
(t
nil)))))
(defun bh/skip-project-tasks ()
"Show non-project tasks.
Skip project and sub-project tasks, habits, and project related tasks."
(save-restriction
(widen)
(let* ((subtree-end (save-excursion (org-end-of-subtree t))))
(cond
((bh/is-project-p)
subtree-end)
((org-is-habit-p)
subtree-end)
((bh/is-project-subtree-p)
subtree-end)
((not (org-entry-is-todo-p))
subtree-end)
(t
nil)))))
(defun bh/skip-non-project-tasks ()
"Show project tasks.
Skip project and sub-project tasks, habits, and loose non-project tasks."
(save-restriction
(widen)
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
(next-headline (save-excursion (or (outline-next-heading) (point-max)))))
(cond
((bh/is-project-p)
next-headline)
((org-is-habit-p)
subtree-end)
((and (bh/is-project-subtree-p)
(member (org-get-todo-state) (list "NEXT")))
subtree-end)
((not (bh/is-project-subtree-p))
subtree-end)
(t
nil)))))
(defun bh/skip-projects-and-habits ()
"Skip trees that are projects and tasks that are habits"
(save-restriction
(widen)
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
(cond
((bh/is-project-p)
subtree-end)
((org-is-habit-p)
subtree-end)
(t
nil)))))
(defun bh/skip-non-subprojects ()
"Skip trees that are not projects"
(let ((next-headline (save-excursion (outline-next-heading))))
(if (bh/is-subproject-p)
nil
next-headline)))
;; CLOCKING ;;
;; Resume clocking task when emacs is restarted
(org-clock-persistence-insinuate)
;;
;; Show lot of clocking history so it's easy to pick items off the C-F11 list
(setq org-clock-history-length 23)
;; Resume clocking task on clock-in if the clock is open
(setq org-clock-in-resume t)
;; Separate drawers for clocking and logs
(setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
;; Save clock data and state changes and notes in the LOGBOOK drawer
(setq org-clock-into-drawer t)
;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
(setq org-clock-out-remove-zero-time-clocks t)
;; Clock out when moving task to a done state
(setq org-clock-out-when-done t)
;; Save the running clock and all clock history when exiting Emacs, load it on startup
(setq org-clock-persist t)
;; Do not prompt to resume an active clock
(setq org-clock-persist-query-resume nil)
;; Enable auto clock resolution for finding open clocks
(setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
;; Include current clocking task in clock reports
(setq org-clock-report-include-clocking-task t)
(defun bh/find-project-task ()
"Move point to the parent (project) task if any"
(save-restriction
(widen)
(let ((parent-task (save-excursion (org-back-to-heading 'invisible-ok) (point))))
(while (org-up-heading-safe)
(when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
(setq parent-task (point))))
(goto-char parent-task)
parent-task)))
;; https://stackoverflow.com/a/10091330
(defun zin/org-agenda-skip-tag (tag &optional others)
"Skip all entries that correspond to TAG.
If OTHERS is true, skip all entries that do not correspond to TAG."
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max))))
(current-headline (or (and (org-at-heading-p)
(point))
(save-excursion (org-back-to-heading)))))
(if others
(if (not (member tag (org-get-tags-at current-headline)))
next-headline
nil)
(if (member tag (org-get-tags-at current-headline))
next-headline
nil))))
;; AGENDA VIEW ;;
;; Do not dim blocked tasks
(setq org-agenda-compact-blocks nil)
(setq org-agenda-dim-blocked-tasks nil)
(setq org-agenda-block-separator 61)
;; Agenda log mode items to display (closed and state changes by default)
(setq org-agenda-log-mode-items (quote (closed state)))
; For tag searches ignore tasks with scheduled and deadline dates
(setq org-agenda-tags-todo-honor-ignore-options t)
(setq org-icalendar-include-body nil)
(setq org-icalendar-include-bbdb-anniversaries t)
(setq org-icalendar-include-todo t)
(setq org-icalendar-use-scheduled '(todo-start event-if-not-todo event-if-todo-not-done))
(provide 'rul-org-agenda)
#+end_src
** The =prog= module
This package contains code related to programming or markup languages
modes. As my configurations are generally small, I prefer to have them
on a single file.
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-prog.el"
;;; rul-prog.el --- Configuration related to programming and markup
;;; languages
(use-package eglot :ensure t)
;; Go
(use-package go-mode
:ensure t
:init
(progn
(bind-key [remap find-tag] #'godef-jump))
:config
(add-hook 'go-mode-hook 'electric-pair-mode)
(add-hook 'before-save-hook 'gofmt-before-save))
(use-package go-eldoc
:ensure t
:init
(add-hook 'go-mode-hook 'go-eldoc-setup))
;; Latex
(add-hook 'latex-mode-hook 'flyspell-mode)
(setq TeX-PDF-mode t)
(defun pdfevince ()
(add-to-list 'TeX-output-view-style
'("^pdf$" "." "evince %o %(outpage)")))
(add-hook 'LaTeX-mode-hook 'pdfevince t) ; AUCTeX LaTeX mode
;; Markdown
(use-package markdown-mode
:ensure t
:config
(setq auto-mode-alist
(cons '("\\.mdwn" . markdown-mode) auto-mode-alist)))
;; Python
(use-package blacken :ensure t :defer t)
;; Terraform
(use-package terraform-mode :ensure t :defer t)
;; YAML
(use-package yaml-mode :ensure t :defer t)
;; Rust
(use-package rust-mode
:defer t
:init
(setq rust-mode-treesitter-derive t)
:config
(add-hook 'rust-mode-hook 'eglot-ensure))
(provide 'rul-prog)
#+end_src
** The =terminals= module
TODO
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-terminals.el"
(use-package vterm
:ensure t
:init
(setq vterm-always-compile-module t
vterm-max-scrollback 100000)
:hook
(vterm-mode . goto-address-mode)
:bind
(:map vterm-mode-map
("C-c C-t" . vterm-copy-mode)
("C-l" . vterm-clear))
:config
(define-key vterm-mode-map (kbd "C-c C-c")
(lambda ()
(interactive)
(vterm-send-string "\C-c")))
(defun rul/vterm-copy-and-exit (beg end)
"Copy region and exit `vterm-copy-mode'."
(interactive "r")
(kill-ring-save beg end)
(vterm-copy-mode -1))
(define-key vterm-copy-mode-map (kbd "w") #'rul/vterm-copy-and-exit)
(define-key vterm-copy-mode-map (kbd "M-w") #'rul/vterm-copy-and-exit))
(use-package multi-vterm
:ensure t
:after vterm
:bind (("C-c t" . multi-vterm))
:config
(setq vterm-kill-buffer-on-exit t)
(defvar-local rul/vterm-close-tab-on-kill nil
"When non-nil, close this buffer's tab when the vterm buffer is killed.")
(defun rul/vterm-maybe-close-tab ()
"Close the current tab if this vterm buffer was opened in its own tab."
(when rul/vterm-close-tab-on-kill
(tab-close)))
(defun rul/vterm-new-tab ()
"Create a new tab and open a new vterm."
(interactive)
(tab-new)
(multi-vterm)
(setq-local rul/vterm-close-tab-on-kill t)
(add-hook 'kill-buffer-hook #'rul/vterm-maybe-close-tab nil t))
;; Inside vterm buffers, make C-c t spawn a new tab + vterm
(define-key vterm-mode-map (kbd "C-c t") #'rul/vterm-new-tab)
(define-key vterm-mode-map (kbd "C-S-t") #'rul/vterm-new-tab))
(provide 'rul-terminals)
#+end_src
** The =vc= module
TODO
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-vc.el"
;;; rul-vc.el --- Version control configuration -*- lexical-binding: t; -*-
(setq vc-follow-symlinks nil)
(use-package magit
:ensure t
:bind (("C-c g s" . magit-status)
("C-c g F" . magit-pull-from-upstream)
("C-c g b" . magit-blame))
:hook (git-commit-setup . rul/git-commit-setup)
:config
(defun rul/git-commit-setup ()
"Enable useful text modes for Git commit buffers."
(flyspell-mode 1)
(auto-fill-mode 1))
(defun rul/magit-status-save-window-config (&rest _)
"Save current window configuration before invoking `magit-status'."
(window-configuration-to-register :magit-fullscreen))
(defun rul/magit-status-single-window (&rest _)
"Display `magit-status' in a single window."
(delete-other-windows))
(advice-add 'magit-status :before #'rul/magit-status-save-window-config)
(advice-add 'magit-status :after #'rul/magit-status-single-window))
(with-eval-after-load 'project
(add-to-list 'project-switch-commands
'(magit-project-status "Magit" "m")))
(provide 'rul-vc)
;;; rul-vc.el ends here
#+end_src
** The =wm= module
TODO
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-wm.el"
;;;; window.el
;; Inspiration: https://christiantietze.de/posts/2022/12/updated-org-mode-agenda-display-buffer-alist/
(defun rul/display-buffer-org-agenda-managed-p (buffer-name action)
"Determine whether BUFFER-NAME is an org-agenda managed buffer."
(with-current-buffer buffer-name
(or (derived-mode-p 'org-mode 'org-agenda-mode)
(member (buffer-file-name) (org-agenda-files)))))
;; Side window for dictionary
(setq switch-to-buffer-obey-display-actions t)
(add-to-list 'display-buffer-alist
'("^\\*Dictionary\\*" display-buffer-in-side-window
(side . bottom)
(window-height . 12)
))
;;;; tab-bar.el
(let ((map global-map))
(define-key map (kbd "C-<next>") 'tab-bar-switch-to-next-tab)
(define-key map (kbd "C-<prior>") 'tab-bar-switch-to-prev-tab)
(define-key map (kbd "<f8>") 'tab-bar-mode))
(setq tab-bar-format
'(tab-bar-format-tabs
;; tab-bar-format-align-right
;; tab-bar-format-global
))
(setq tab-bar-new-tab-to 'rightmost)
(setq tab-bar-close-button-show nil)
(set-face-attribute 'tab-bar nil :height 0.8)
;; I've moved to a frame oriented workflow, so I no longer use tabs.
;; (tab-bar-mode 1)
;; Pop-up buffers
;; https://protesilaos.com/codelog/2024-09-19-emacs-command-popup-frame-emacsclient/
(defun prot-window-delete-popup-frame (&rest _)
"Kill selected selected frame if it has parameter `prot-window-popup-frame'.
Use this function via a hook."
(when (frame-parameter nil 'prot-window-popup-frame)
(delete-frame)))
(defmacro prot-window-define-with-popup-frame (command)
"Define interactive function which calls COMMAND in a new frame.
Make the new frame have the `prot-window-popup-frame' parameter."
`(defun ,(intern (format "prot-window-popup-%s" command)) ()
,(format "Run `%s' in a popup frame with `prot-window-popup-frame' parameter.
Also see `prot-window-delete-popup-frame'." command)
(interactive)
(let ((frame (make-frame '((prot-window-popup-frame . t)))))
(select-frame frame)
;; Placeholder for frame, otherwise it'll get autoclosed.
(switch-to-buffer " prot-window-hidden-buffer-for-popup-frame")
(condition-case nil
(call-interactively ',command)
((quit error user-error)
(delete-frame frame))))))
(declare-function org-capture "org-capture" (&optional goto keys))
(defvar org-capture-after-finalize-hook)
;;;###autoload (autoload 'prot-window-popup-org-capture "prot-window")
(prot-window-define-with-popup-frame org-capture)
(add-hook 'org-capture-after-finalize-hook #'prot-window-delete-popup-frame)
(use-package olivetti
:ensure t
:defer t
:config
(setq olivetti-body-width 100))
(use-package logos
:ensure t
:config
;; If you want to use outlines instead of page breaks (the ^L)
(setq logos-outlines-are-pages t)
(setq logos-outline-regexp-alist
`((emacs-lisp-mode . "^;;;+ ")
(org-mode . "^\\*+ +")
(markdown-mode . "^\\#+ +")
))
;; These apply when `logos-focus-mode' is enabled. Their value is
;; buffer-local.
(setq-default logos-hide-mode-line t
logos-hide-buffer-boundaries t
logos-hide-fringe t
logos-variable-pitch nil
logos-buffer-read-only nil
logos-scroll-lock nil
logos-olivetti t
olivetti-body-width 100
)
(let ((map global-map))
(define-key map [remap narrow-to-region] #'logos-narrow-dwim)
(define-key map [remap forward-page] #'logos-forward-page-dwim)
(define-key map [remap backward-page] #'logos-backward-page-dwim)
(define-key map (kbd "<f7>") #'logos-focus-mode))
)
(use-package beframe
:ensure t
:hook (after-init . beframe-mode)
:config
(setq beframe-functions-in-frames '(project-prompt-project-dir))
(setq beframe-global-buffers nil)
(define-key global-map (kbd "C-c b") beframe-prefix-map)
;;Integration with Consult
(defvar consult-buffer-sources)
(declare-function consult--buffer-state "consult")
(with-eval-after-load 'consult
(defface beframe-buffer
'((t :inherit font-lock-string-face))
"Face for `consult' framed buffers.")
(defun my-beframe-buffer-names-sorted (&optional frame)
"Return the list of buffers from `beframe-buffer-names' sorted by visibility.
With optional argument FRAME, return the list of buffers of FRAME."
(beframe-buffer-names frame :sort #'beframe-buffer-sort-visibility))
(defvar beframe-consult-source
`( :name "Frame-specific buffers (current frame)"
:narrow ?F
:category buffer
:face beframe-buffer
:history beframe-history
:items ,#'my-beframe-buffer-names-sorted
:action ,#'switch-to-buffer
:state ,#'consult--buffer-state))
(add-to-list 'consult-buffer-sources 'beframe-consult-source)))
(defun kill-project-buffers-and-close-frame ()
(interactive)
(project-kill-buffers)
(delete-frame (selected-frame)))
(define-key global-map (kbd "C-x p K") 'kill-project-buffers-and-close-frame)
(add-hook 'text-mode-hook 'context-menu-mode)
(defun my-context-menu (menu click)
"My context menu"
(define-key-after menu [dictionary-lookup]
'(menu-item "Dict" dictionary-search-word-at-mouse
:help "Look up in dictionary"))
menu)
;; hook into context menu
(add-hook 'context-menu-functions #'my-context-menu)
(provide 'rul-wm)
#+end_src
** The =write= module
TODO
#+begin_src emacs-lisp :tangle "rul-lisp/packages/rul-write.el"
;;;; `dictionary'
(setq dictionary-server "localhost"
dictionary-default-popup-strategy "lev"
dictionary-create-buttons nil
dictionary-use-single-buffer t)
(define-key global-map (kbd "C-c d") #'dictionary-lookup-definition)
(use-package denote
:ensure t
:hook (dired-mode . denote-dired-mode)
:bind
(("C-c n n" . denote)
("C-c n r" . denote-rename-file)
("C-c n l" . denote-link)
("C-c n b" . denote-backlinks))
:config
(denote-rename-buffer-mode 1)
(setq denote-infer-keywords t)
(setq denote-sort-keywords t)
(setq denote-file-type 'org)
(setq denote-excluded-directories-regexp nil)
(setq denote-allow-multi-word-keywords nil)
(setq denote-link-fontify-backlinks t)
(setq denote-rename-no-confirm t)
(let ((map global-map))
(define-key map (kbd "C-c n j") #'denote-journal-new-or-existing-entry)
(define-key map (kbd "C-c n n") #'denote)
(define-key map (kbd "C-c n f") #'denote-open-or-create)
(define-key map (kbd "C-c n i") #'denote-link)
(define-key map (kbd "C-c n r") #'denote-rename-file)
)
)
(use-package electric
:init
(setq electric-quote-replace-double t)
:hook
(message-mode . electric-quote-local-mode))
(use-package message
:hook
(message-mode . my/message-mode-setup))
(defun my/message-mode-setup ()
(setq fill-column 72
sentence-end-double-space nil)
(auto-fill-mode 1))
;; Flycheck
(use-package flycheck
:ensure t
:config
(flycheck-define-checker proselint
"A linter for prose."
:command ("proselint" source-inplace)
:error-patterns
((warning line-start (file-name) ":" line ":" column ": "
(id (one-or-more (not (any " "))))
(message) line-end))
:modes (text-mode markdown-mode gfm-mode org-mode))
(add-to-list 'flycheck-checkers 'proselint)
;; TODO: docker run --rm -p 8010:8010 erikvl87/languagetool
(use-package flycheck-languagetool
:ensure t
:hook (message-mode . flycheck-languagetool-setup)
:init
(setq flycheck-languagetool-url "http://localhost:8010")
))
;; Flyspell
(defcustom flyspell-delayed-commands nil
"List of commands that are \"delayed\" for Flyspell mode.
After these commands, Flyspell checking is delayed for a short time,
whose length is specified by `flyspell-delay'."
:group 'flyspell
:type '(repeat (symbol)))
(setq ispell-dictionary "en")
(setq flyspell-default-dictionary "en")
(setq flyspell-issue-welcome-flag nil)
(setq-default ispell-list-command "list")
(provide 'rul-write)
#+end_src
|