-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2944 lines (2657 loc) · 162 KB
/
index.html
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
<?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>
<!-- 2019-06-16 Sun 12:58 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Emacs Configuration</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="alexander" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-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;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.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; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link href="css/htmlize.css" rel="stylesheet" type="text/css" />
<link href="css/readtheorg.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.stickytableheaders.js"></script>
<script type="text/javascript" src="js/readtheorg.js"></script>
<style>div#content { max-width: 2000px; }</style>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 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">Emacs Configuration</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org1179c5e">1. Core</a>
<ul>
<li><a href="#org38985d3">1.1. Package</a></li>
<li><a href="#org4fa145f">1.2. Libraries</a>
<ul>
<li><a href="#orgc7d285a">1.2.1. config</a></li>
<li><a href="#org3eebfe8">1.2.2. packages</a></li>
</ul>
</li>
<li><a href="#orgbf109d5">1.3. Linux</a></li>
<li><a href="#orgee3e923">1.4. macOS</a></li>
</ul>
</li>
<li><a href="#org7ef104f">2. Modules</a>
<ul>
<li><a href="#org2c47e8f">2.1. General</a></li>
<li><a href="#orgfac11db">2.2. Appearance</a>
<ul>
<li><a href="#org33b659f">2.2.1. config</a></li>
<li><a href="#org6b4704b">2.2.2. Icons</a></li>
<li><a href="#org9e300eb">2.2.3. Doom</a></li>
<li><a href="#orge689bf2">2.2.4. Discoverability</a></li>
<li><a href="#org71e9979">2.2.5. Defaults</a></li>
</ul>
</li>
<li><a href="#org0bd78bc">2.3. Navigation</a>
<ul>
<li><a href="#orgf6eca7e">2.3.1. config</a></li>
<li><a href="#orgada5f1c">2.3.2. Buffers and Windows</a></li>
<li><a href="#org354d744">2.3.3. Directory</a></li>
</ul>
</li>
<li><a href="#org2685feb">2.4. Editor</a>
<ul>
<li><a href="#org7888e03">2.4.1. config</a></li>
<li><a href="#org953d022">2.4.2. Jump / Goto</a></li>
<li><a href="#org570ee44">2.4.3. Selection / Insertion</a></li>
<li><a href="#org3026baa">2.4.4. Syntax checking</a></li>
<li><a href="#org2916a71">2.4.5. Search / Replace</a></li>
<li><a href="#org0c45641">2.4.6. Completion</a></li>
<li><a href="#orgf864bba">2.4.7. Utilities</a></li>
</ul>
</li>
<li><a href="#org874374d">2.5. Project Management</a>
<ul>
<li><a href="#org5c1d7fb">2.5.1. projectile: Manage and navigate projects in Emacs easily</a></li>
<li><a href="#orge6418b2">2.5.2. ibuffer-projectile: Group ibuffer's list by projectile root</a></li>
</ul>
</li>
<li><a href="#orgbe1b8dc">2.6. Version Control</a>
<ul>
<li><a href="#orgdf3325a">2.6.1. magit: Interface to the version control system Git</a></li>
<li><a href="#org0173b14">2.6.2. gist: Emacs integration for gist.github.com</a></li>
<li><a href="#org24669e8">2.6.3. git-timemachine: Walk through git revisions of a file</a></li>
<li><a href="#orga136c19">2.6.4. gitpatch</a></li>
</ul>
</li>
<li><a href="#org20c6a72">2.7. Languages</a>
<ul>
<li><a href="#orgd90d365">2.7.1. org-mode: a powerful system for organizing your complex life with simple plain-text files</a></li>
<li><a href="#orgcd5b346">2.7.2. Markup</a></li>
<li><a href="#org49a3a46">2.7.3. Utilities</a></li>
<li><a href="#orge648e97">2.7.4. Epub</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org1179c5e" class="outline-2">
<h2 id="org1179c5e"><span class="section-number-2">1</span> Core</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org38985d3" class="outline-3">
<h3 id="org38985d3"><span class="section-number-3">1.1</span> Package</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5B6268;">;; </span><span style="color: #5B6268;">`(online?)` is a function that tries to detect whether you are online.</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">We want to refresh our package list on Emacs start if we are.</span>
(<span style="color: #51afef;">require</span> '<span style="color: #a9a1e1;">cl</span>)
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">online?</span> ()
(<span style="color: #51afef;">if</span> (<span style="color: #51afef;">and</span> (functionp 'network-interface-list)
(network-interface-list))
(some (<span style="color: #51afef;">lambda</span> (iface) (<span style="color: #51afef;">unless</span> (equal <span style="color: #98be65;">"lo"</span> (car iface))
(member 'up (first (last (network-interface-info
(car iface)))))))
(network-interface-list))
t))
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Emacs comes with a package manager for installing more features.</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">The default package repository doesn't contain much, so we tell it</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">to use MELPA as well.</span>
(<span style="color: #51afef;">setq</span> package-user-dir (concat dotfiles-dir <span style="color: #98be65;">"elpa"</span>))
(<span style="color: #51afef;">require</span> '<span style="color: #a9a1e1;">package</span>)
(add-to-list 'package-archives '(<span style="color: #98be65;">"melpa"</span> . <span style="color: #98be65;">"https://melpa.org/packages/"</span>) t)
(add-to-list 'package-archives '(<span style="color: #98be65;">"org"</span> . <span style="color: #98be65;">"http://orgmode.org/elpa/"</span>) t)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">To get the package manager going, we invoke its initialise function.</span>
(package-initialize)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">If we're online, we attempt to fetch the package directories if</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">we don't have a local copy already. This lets us start installing</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">packages right away from a clean install.</span>
(<span style="color: #51afef;">when</span> (online?)
(<span style="color: #51afef;">unless</span> package-archive-contents (package-refresh-contents)))
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">`</span><span style="color: #a9a1e1;">Paradox</span><span style="color: #5B6268;">' is an enhanced interface for package management, which also</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">provides some helpful utility functions we're going to be using</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">extensively. Thus, the first thing we do is install it if it's not there</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">already.</span>
(<span style="color: #51afef;">when</span> (not (package-installed-p 'paradox))
(package-install 'paradox))
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">We're going to be using `</span><span style="color: #a9a1e1;">use-package</span><span style="color: #5B6268;">' to manage our dependencies.</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">In its simplest form, we can call eg. `(use-package lolcode-mode)'</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">to install the `</span><span style="color: #a9a1e1;">lolcode-mode</span><span style="color: #5B6268;">' package. We'd also declare one or more</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">entry points so the module isn't loaded unneccesarily at startup.</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">For instance, `(use-package my-module :commands (my-function))' will</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">defer loading `</span><span style="color: #a9a1e1;">my-module</span><span style="color: #5B6268;">' until you actually call `(my-function)'.</span>
<span style="color: #5B6268;">;;</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Read about it in detail at https://github.com/jwiegley/use-package</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">First, we make sure it's installed, using a function provided by</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Paradox, which we've just installed the hard way.</span>
(paradox-require 'use-package)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Next, we load it so it's always available.</span>
(<span style="color: #51afef;">require</span> '<span style="color: #a9a1e1;">use-package</span>)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Finally, we enable `</span><span style="color: #a9a1e1;">use-package-always-ensure</span><span style="color: #5B6268;">' which makes</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">use-package install every declared package automatically from ELPA,</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">instead of expecting you to do it manually.</span>
(<span style="color: #51afef;">setq</span> use-package-always-ensure t)
</pre>
</div>
</div>
</div>
<div id="outline-container-org4fa145f" class="outline-3">
<h3 id="org4fa145f"><span class="section-number-3">1.2</span> Libraries</h3>
<div class="outline-text-3" id="text-1-2">
</div>
<div id="outline-container-orgc7d285a" class="outline-4">
<h4 id="orgc7d285a"><span class="section-number-4">1.2.1</span> config</h4>
<div class="outline-text-4" id="text-1-2-1">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">eval-when-compile</span> (<span style="color: #51afef;">require</span> '<span style="color: #a9a1e1;">cl-lib</span>))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/font-lock-replace-symbol</span> (mode reg sym)
<span style="color: #83898d;">"Given a major mode `</span><span style="color: #a9a1e1;">mode</span><span style="color: #83898d;">', replace the regular expression `</span><span style="color: #a9a1e1;">reg</span><span style="color: #83898d;">' with</span>
<span style="color: #83898d;"> the symbol `</span><span style="color: #a9a1e1;">sym</span><span style="color: #83898d;">' when rendering."</span>
(font-lock-add-keywords
mode `((,reg
(0 (<span style="color: #51afef;">progn</span> (compose-region (match-beginning 1) (match-end 1)
,sym 'decompose-region)))))))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/exec</span> (command)
<span style="color: #83898d;">"Run a shell command and return its output as a string, whitespace trimmed."</span>
(s-trim (shell-command-to-string command)))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/exec-with-rc</span> (command <span style="color: #ECBE7B;">&rest</span> args)
<span style="color: #83898d;">"Run a shell command and return a list containing two values: its return</span>
<span style="color: #83898d;"> code and its whitespace trimmed output."</span>
(<span style="color: #51afef;">with-temp-buffer</span>
(list (apply 'call-process command nil (current-buffer) nil args)
(s-trim (buffer-string)))))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/is-exec</span> (command)
<span style="color: #83898d;">"Returns true if `</span><span style="color: #a9a1e1;">command</span><span style="color: #83898d;">' is an executable on the system search path."</span>
(f-executable? (s-trim (shell-command-to-string (s-concat <span style="color: #98be65;">"which "</span> command)))))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/resolve-exec</span> (command)
<span style="color: #83898d;">"If `</span><span style="color: #a9a1e1;">command</span><span style="color: #83898d;">' is an executable on the system search path, return its absolute path.</span>
<span style="color: #83898d;"> Otherwise, return nil."</span>
(<span style="color: #51afef;">-let</span> [path (s-trim (shell-command-to-string (s-concat <span style="color: #98be65;">"which "</span> command)))]
(<span style="color: #51afef;">when</span> (f-executable? path) path)))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/exec-if-exec</span> (command args)
<span style="color: #83898d;">"If `</span><span style="color: #a9a1e1;">command</span><span style="color: #83898d;">' satisfies `</span><span style="color: #a9a1e1;">core/is-exec</span><span style="color: #83898d;">', run it with `</span><span style="color: #a9a1e1;">args</span><span style="color: #83898d;">' and return its</span>
<span style="color: #83898d;"> output as per `</span><span style="color: #a9a1e1;">core/exec</span><span style="color: #83898d;">'. Otherwise, return nil."</span>
(<span style="color: #51afef;">when</span> (core/is-exec command) (core/exec (s-concat command <span style="color: #98be65;">" "</span> args))))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/getent</span> (user)
<span style="color: #83898d;">"Get the /etc/passwd entry for the user `</span><span style="color: #a9a1e1;">user</span><span style="color: #83898d;">' as a list of strings,</span>
<span style="color: #83898d;"> or nil if there is no such user. Empty fields will be represented as nil,</span>
<span style="color: #83898d;"> as opposed to empty strings."</span>
(<span style="color: #51afef;">-let</span> [ent (core/exec (s-concat <span style="color: #98be65;">"getent passwd "</span> user))]
(<span style="color: #51afef;">when</span> (not (s-blank? ent))
(<span style="color: #51afef;">-map</span> (<span style="color: #51afef;">lambda</span> (i) (<span style="color: #51afef;">if</span> (s-blank? i) nil i))
(s-split <span style="color: #98be65;">":"</span> ent)))))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/user-full-name</span> ()
<span style="color: #83898d;">"Guess the user's full name. Returns nil if no likely name could be found."</span>
(<span style="color: #51afef;">or</span> (core/exec-if-exec <span style="color: #98be65;">"git"</span> <span style="color: #98be65;">"config --get user.name"</span>)
(elt (core/getent (getenv <span style="color: #98be65;">"USER"</span>)) 4)))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">core/user-email</span> ()
<span style="color: #83898d;">"Guess the user's email address. Returns nil if none could be found."</span>
(<span style="color: #51afef;">or</span> (core/exec-if-exec <span style="color: #98be65;">"git"</span> <span style="color: #98be65;">"config --get user.email"</span>)
(getenv <span style="color: #98be65;">"EMAIL"</span>)))
(<span style="color: #51afef;">defmacro</span> <span style="color: #c678dd;">after!</span> (feature <span style="color: #ECBE7B;">&rest</span> forms)
<span style="color: #83898d;">"A smart wrapper around `</span><span style="color: #a9a1e1;">with-eval-after-load</span><span style="color: #83898d;">'. Supresses warnings during</span>
<span style="color: #83898d;">compilation."</span>
(<span style="color: #51afef;">declare</span> (indent defun) (debug t))
`(,(<span style="color: #51afef;">if</span> (<span style="color: #51afef;">or</span> (not (<span style="color: #51afef;">bound-and-true-p</span> byte-compile-current-file))
(<span style="color: #51afef;">if</span> (symbolp feature)
(<span style="color: #51afef;">require</span> <span style="color: #a9a1e1;">feature</span> nil <span style="color: #c678dd;">:no-error</span>)
(load feature <span style="color: #c678dd;">:no-message</span> <span style="color: #c678dd;">:no-error</span>)))
#'progn
#'with-no-warnings)
(<span style="color: #51afef;">with-eval-after-load</span> ',feature ,@forms)))
(<span style="color: #51afef;">eval-and-compile</span>
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">my/resolve-hook-forms</span> (hooks)
(<span style="color: #51afef;">cl-loop</span> with quoted-p = (eq (car-safe hooks) 'quote)
for hook in (doom-enlist (doom-unquote hooks))
if (eq (car-safe hook) 'quote)
collect (cadr hook)
else if quoted-p
collect hook
else collect (intern (format <span style="color: #98be65;">"%s-hook"</span> (symbol-name hook)))))
(<span style="color: #51afef;">defvar</span> <span style="color: #dcaeea;">my/transient-counter</span> 0)
(<span style="color: #51afef;">defmacro</span> <span style="color: #c678dd;">add-transient-hook!</span> (hook <span style="color: #ECBE7B;">&rest</span> forms)
<span style="color: #83898d;">"Attaches transient forms to a HOOK.</span>
<span style="color: #83898d;"> HOOK can be a quoted hook or a sharp-quoted function (which will be advised).</span>
<span style="color: #83898d;"> These forms will be evaluated once when that function/hook is first invoked,</span>
<span style="color: #83898d;"> then it detaches itself."</span>
(<span style="color: #51afef;">declare</span> (indent 1))
(<span style="color: #51afef;">let</span> ((append (eq (car forms) <span style="color: #c678dd;">:after</span>))
(fn (intern (format <span style="color: #98be65;">"my/transient-hook-%s"</span> (<span style="color: #51afef;">cl-incf</span> my/transient-counter)))))
`(<span style="color: #51afef;">when</span> ,hook
(fset ',fn
(<span style="color: #51afef;">lambda</span> (<span style="color: #ECBE7B;">&rest</span> _)
,@forms
(<span style="color: #51afef;">cond</span> ((functionp ,hook) (advice-remove ,hook #',fn))
((symbolp ,hook) (remove-hook ,hook #',fn)))
(unintern ',fn nil)))
(<span style="color: #51afef;">cond</span> ((functionp ,hook)
(advice-add ,hook ,(<span style="color: #51afef;">if</span> append <span style="color: #c678dd;">:after</span> <span style="color: #c678dd;">:before</span>) #',fn))
((symbolp ,hook)
(add-hook ,hook #',fn ,append)))))))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">doom-enlist</span> (exp)
<span style="color: #83898d;">"Return EXP wrapped in a list, or as-is if already a list."</span>
(<span style="color: #51afef;">if</span> (listp exp) exp (list exp)))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">doom-unquote</span> (exp)
<span style="color: #83898d;">"Return EXP unquoted."</span>
(<span style="color: #51afef;">while</span> (memq (car-safe exp) '(<span style="color: #51afef;">quote</span> function))
(<span style="color: #51afef;">setq</span> exp (cadr exp)))
exp)
(<span style="color: #51afef;">defmacro</span> <span style="color: #c678dd;">add-hook!</span> (<span style="color: #ECBE7B;">&rest</span> args)
<span style="color: #83898d;">"A convenience macro for `</span><span style="color: #a9a1e1;">add-hook</span><span style="color: #83898d;">'. Takes, in order:</span>
<span style="color: #83898d;"> 1. Optional properties :local and/or :append, which will make the hook</span>
<span style="color: #83898d;"> buffer-local or append to the list of hooks (respectively),</span>
<span style="color: #83898d;"> 2. The hooks: either an unquoted major mode, an unquoted list of major-modes,</span>
<span style="color: #83898d;"> a quoted hook variable or a quoted list of hook variables. If unquoted, the</span>
<span style="color: #83898d;"> hooks will be resolved by appending -hook to each symbol.</span>
<span style="color: #83898d;"> 3. A function, list of functions, or body forms to be wrapped in a lambda.</span>
<span style="color: #83898d;"> Examples:</span>
<span style="color: #83898d;"> (add-hook! 'some-mode-hook 'enable-something)</span>
<span style="color: #83898d;"> (add-hook! some-mode '(enable-something and-another))</span>
<span style="color: #83898d;"> (add-hook! '(one-mode-hook second-mode-hook) 'enable-something)</span>
<span style="color: #83898d;"> (add-hook! (one-mode second-mode) 'enable-something)</span>
<span style="color: #83898d;"> (add-hook! :append (one-mode second-mode) 'enable-something)</span>
<span style="color: #83898d;"> (add-hook! :local (one-mode second-mode) 'enable-something)</span>
<span style="color: #83898d;"> (add-hook! (one-mode second-mode) (setq v 5) (setq a 2))</span>
<span style="color: #83898d;"> (add-hook! :append :local (one-mode second-mode) (setq v 5) (setq a 2))</span>
<span style="color: #83898d;"> Body forms can access the hook's arguments through the let-bound variable</span>
<span style="color: #83898d;"> `</span><span style="color: #a9a1e1;">args</span><span style="color: #83898d;">'."</span>
(<span style="color: #51afef;">declare</span> (indent defun) (debug t))
(<span style="color: #51afef;">let</span> ((hook-fn 'add-hook)
append-p local-p)
(<span style="color: #51afef;">while</span> (keywordp (car args))
(<span style="color: #51afef;">pcase</span> (<span style="color: #51afef;">pop</span> args)
(<span style="color: #c678dd;">:append</span> (<span style="color: #51afef;">setq</span> append-p t))
(<span style="color: #c678dd;">:local</span> (<span style="color: #51afef;">setq</span> local-p t))
(<span style="color: #c678dd;">:remove</span> (<span style="color: #51afef;">setq</span> hook-fn 'remove-hook))))
(<span style="color: #51afef;">let</span> ((hooks (my/resolve-hook-forms (<span style="color: #51afef;">pop</span> args)))
(funcs
(<span style="color: #51afef;">let</span> ((val (car args)))
(<span style="color: #51afef;">if</span> (memq (car-safe val) '(<span style="color: #51afef;">quote</span> function))
(<span style="color: #51afef;">if</span> (cdr-safe (cadr val))
(cadr val)
(list (cadr val)))
(list args))))
forms)
(<span style="color: #51afef;">dolist</span> (fn funcs)
(<span style="color: #51afef;">setq</span> fn (<span style="color: #51afef;">if</span> (symbolp fn)
`(<span style="color: #51afef;">function</span> ,fn)
`(<span style="color: #51afef;">lambda</span> (<span style="color: #ECBE7B;">&rest</span> _) ,@args)))
(<span style="color: #51afef;">dolist</span> (hook hooks)
(<span style="color: #51afef;">push</span> (<span style="color: #51afef;">cond</span> ((eq hook-fn 'remove-hook)
`(remove-hook ',hook ,fn ,local-p))
(t
`(add-hook ',hook ,fn ,append-p ,local-p)))
forms)))
`(<span style="color: #51afef;">progn</span> ,@(nreverse forms)))))
(<span style="color: #51afef;">defmacro</span> <span style="color: #c678dd;">remove-hook!</span> (<span style="color: #ECBE7B;">&rest</span> args)
<span style="color: #83898d;">"Convenience macro for `</span><span style="color: #a9a1e1;">remove-hook</span><span style="color: #83898d;">'. Takes the same arguments as</span>
<span style="color: #83898d;"> `</span><span style="color: #a9a1e1;">add-hook!</span><span style="color: #83898d;">'."</span>
`(<span style="color: #51afef;">add-hook!</span> <span style="color: #c678dd;">:remove</span> ,@args))
</pre>
</div>
</div>
</div>
<div id="outline-container-org3eebfe8" class="outline-4">
<h4 id="org3eebfe8"><span class="section-number-4">1.2.2</span> packages</h4>
<div class="outline-text-4" id="text-1-2-2">
</div>
<ol class="org-ol">
<li><a id="org7d55c6c"></a>async<br />
<div class="outline-text-5" id="text-1-2-2-1">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">async</span> <span style="color: #c678dd;">:demand</span> t
<span style="color: #c678dd;">:config</span>
(dired-async-mode 1))
</pre>
</div>
</div>
</li>
<li><a id="org29a0df6"></a>subr-x<br />
<div class="outline-text-5" id="text-1-2-2-2">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">subr-x</span> <span style="color: #c678dd;">:demand</span> t <span style="color: #c678dd;">:ensure</span> nil)
</pre>
</div>
</div>
</li>
<li><a id="org3f0c10d"></a>dash<br />
<div class="outline-text-5" id="text-1-2-2-3">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">dash</span>
<span style="color: #c678dd;">:ensure</span> t
<span style="color: #c678dd;">:config</span>
(dash-enable-font-lock))
(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">dash-functional</span>
<span style="color: #c678dd;">:ensure</span> t)
</pre>
</div>
</div>
</li>
<li><a id="org374b05e"></a>f<br />
<div class="outline-text-5" id="text-1-2-2-4">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">f</span>
<span style="color: #c678dd;">:ensure</span> t)
</pre>
</div>
</div>
</li>
<li><a id="org5fc0fa6"></a>s<br />
<div class="outline-text-5" id="text-1-2-2-5">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">s</span>
<span style="color: #c678dd;">:ensure</span> t)
</pre>
</div>
</div>
</li>
<li><a id="org562116a"></a>ht<br />
<div class="outline-text-5" id="text-1-2-2-6">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">ht</span>
<span style="color: #c678dd;">:ensure</span> t)
</pre>
</div>
</div>
</li>
<li><a id="org574392f"></a>a<br />
<div class="outline-text-5" id="text-1-2-2-7">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">require</span> '<span style="color: #a9a1e1;">let-alist</span>)
(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">a</span>
<span style="color: #c678dd;">:ensure</span> t)
</pre>
</div>
</div>
</li>
<li><a id="org61161b3"></a>persistent-soft<br />
<div class="outline-text-5" id="text-1-2-2-8">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">persistent-soft</span>
<span style="color: #c678dd;">:ensure</span> t)
</pre>
</div>
</div>
</li>
<li><a id="org97e00b9"></a>request<br />
<div class="outline-text-5" id="text-1-2-2-9">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">request</span> <span style="color: #c678dd;">:ensure</span> t)
</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
<div id="outline-container-orgbf109d5" class="outline-3">
<h3 id="orgbf109d5"><span class="section-number-3">1.3</span> Linux</h3>
<div class="outline-text-3" id="text-1-3">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">gpastel</span>
<span style="color: #c678dd;">:if</span> (eq system-type 'gnu/linux))
(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">exec-path-from-shell</span>
<span style="color: #c678dd;">:if</span> (eq system-type 'gnu/linux)
<span style="color: #c678dd;">:config</span>
(exec-path-from-shell-initialize))
(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">counsel</span>
<span style="color: #c678dd;">:if</span> (eq system-type 'gnu/linux)
<span style="color: #c678dd;">:config</span>
(<span style="color: #51afef;">push</span> (concat (getenv <span style="color: #98be65;">"HOME"</span>) <span style="color: #98be65;">"/.local/share/applications/"</span>) counsel-linux-apps-directories)
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">my/counsel-linux-app-format-function</span> (name comment exec)
<span style="color: #83898d;">"Default Linux application name formatter.</span>
<span style="color: #83898d;"> NAME is the name of the application, COMMENT its comment and EXEC</span>
<span style="color: #83898d;"> the command to launch it."</span>
(format <span style="color: #98be65;">"% -45s %s"</span>
(propertize name 'face 'font-lock-builtin-face)
(<span style="color: #51afef;">or</span> comment <span style="color: #98be65;">""</span>)))
(<span style="color: #51afef;">setq</span> counsel-linux-app-format-function #'my/counsel-linux-app-format-function)
(<span style="color: #51afef;">setq</span> x-gtk-use-system-tooltips nil))
(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">desktop-environment</span>
<span style="color: #c678dd;">:if</span> (eq system-type 'gnu/linux)
<span style="color: #c678dd;">:commands</span> (desktop-environment-mode)
<span style="color: #c678dd;">:config</span>
(<span style="color: #51afef;">progn</span>
(<span style="color: #51afef;">unbind-key</span> <span style="color: #98be65;">"s-l"</span> desktop-environment-mode-map)
(desktop-environment-mode)))
</pre>
</div>
</div>
</div>
<div id="outline-container-orgee3e923" class="outline-3">
<h3 id="orgee3e923"><span class="section-number-3">1.4</span> macOS</h3>
<div class="outline-text-3" id="text-1-4">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">if</span> (eq system-type 'gnu/linux)
(set-face-attribute 'default nil
<span style="color: #c678dd;">:family</span> <span style="color: #98be65;">"Hack Nerd Font"</span>
<span style="color: #c678dd;">:height</span> 120
<span style="color: #c678dd;">:weight</span> 'normal
<span style="color: #c678dd;">:width</span> 'normal
)
(set-face-attribute 'Info-quoted nil
<span style="color: #c678dd;">:slant</span> 'Italic)
(set-face-attribute 'font-lock-string-face nil
<span style="color: #c678dd;">:slant</span> 'Italic))
(<span style="color: #51afef;">if</span> (eq system-type 'darwin)
(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">exec-path-from-shell</span>
<span style="color: #c678dd;">:config</span>
(exec-path-from-shell-initialize))
(<span style="color: #51afef;">use-package</span> <span style="color: #a9a1e1;">pbcopy</span>
<span style="color: #c678dd;">:ensure</span> t)
(paradox-require 'exec-path-from-shell)
(<span style="color: #51afef;">setq</span> ns-function-modifier 'hyper)
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">user-swap-meta-and-super</span> ()
<span style="color: #83898d;">"Swap the mapping of Meta and Super.</span>
<span style="color: #83898d;"> Very useful for people using their Mac with a</span>
<span style="color: #83898d;"> Windows external keyboard from time to time."</span>
(<span style="color: #51afef;">interactive</span>)
(<span style="color: #51afef;">if</span> (eq mac-command-modifier 'super)
(<span style="color: #51afef;">progn</span>
(<span style="color: #51afef;">setq</span> mac-command-modifier 'meta)
(<span style="color: #51afef;">setq</span> mac-option-modifier 'super)
(message <span style="color: #98be65;">"Command is now bound to META and Option is bound to SUPER."</span>))
(<span style="color: #51afef;">setq</span> mac-command-modifier 'super)
(<span style="color: #51afef;">setq</span> mac-option-modifier 'meta)
(message <span style="color: #98be65;">"Command is now bound to SUPER and Option is bound to META."</span>)))
(menu-bar-mode +1)
(<span style="color: #51afef;">when</span> (fboundp 'set-fontset-font)
(set-fontset-font t 'unicode <span style="color: #98be65;">"Apple Color Emoji"</span> nil 'prepend))
(<span style="color: #51afef;">setq</span> locate-make-command-line (<span style="color: #51afef;">lambda</span> (s) `(<span style="color: #98be65;">"mdfind"</span> <span style="color: #98be65;">"-name"</span> ,s)))
(<span style="color: #51afef;">setq</span> mac-emulate-three-button-mouse t)
(<span style="color: #51afef;">setq</span> shift-select-mode t)
(global-set-key (kbd <span style="color: #98be65;">"<s-up>"</span>) 'beginning-of-buffer)
(global-set-key (kbd <span style="color: #98be65;">"<s-down>"</span>) 'end-of-buffer)
(global-set-key (kbd <span style="color: #98be65;">"<s-left>"</span>) 'move-beginning-of-line)
(global-set-key (kbd <span style="color: #98be65;">"<s-right>"</span>) 'move-end-of-line)
(define-key global-map (kbd <span style="color: #98be65;">"s-+"</span>) 'text-scale-increase)
(define-key global-map (kbd <span style="color: #98be65;">"s--"</span>) 'text-scale-decrease)
(global-set-key (kbd <span style="color: #98be65;">"s-f"</span>) 'isearch-forward-regexp)
(global-set-key (kbd <span style="color: #98be65;">"<M-up>"</span>) 'backward-paragraph)
(global-set-key (kbd <span style="color: #98be65;">"<M-down>"</span>) 'forward-paragraph)
(global-set-key (kbd <span style="color: #98be65;">"M-<backspace>"</span>) 'backward-kill-word)
(global-set-key (kbd <span style="color: #98be65;">"C-x K"</span>) 'kill-this-buffer)
(<span style="color: #51afef;">setq</span> delete-by-moving-to-trash t)
(<span style="color: #51afef;">setq</span> ns-right-alternate-modifier nil)
(<span style="color: #51afef;">setq</span> mac-option-modifier 'meta)
(<span style="color: #51afef;">setq</span> mac-command-modifier 'super)
(global-set-key [(super a)] 'mark-whole-buffer)
(global-set-key [(super c)] 'kill-ring-save)
(global-set-key [(super g)] 'isearch-repeat-forward)
(global-set-key [(super l)] 'goto-line)
(global-set-key [(super q)] 'save-buffers-kill-terminal)
(global-set-key [(super s)] 'save-buffer)
(global-set-key [(super v)] 'yank)
(global-set-key [(super x)] 'kill-region)
(global-set-key [(super w)] (<span style="color: #51afef;">lambda</span> ()
(<span style="color: #51afef;">interactive</span>)
(kill-buffer (current-buffer))))
(global-set-key [(super z)] 'undo)
(<span style="color: #51afef;">setq</span> visible-bell nil)
(<span style="color: #51afef;">setq</span> mac-right-alternate-modifier nil)
(global-set-key (kbd <span style="color: #98be65;">"s-K"</span>) nil)
(global-set-key (kbd <span style="color: #98be65;">"s-k"</span>) nil)
(add-hook 'prog-mode-hook
(<span style="color: #51afef;">lambda</span> ()
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">compile short cuts</span>
(define-key (current-local-map) (kbd <span style="color: #98be65;">"s-K"</span>) 'compile)
(define-key (current-local-map) (kbd <span style="color: #98be65;">"s-k"</span>) 'recompile)))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">my/open-finder-at</span> (path)
<span style="color: #83898d;">"Open Finder app with the given PATH."</span>
(<span style="color: #51afef;">let*</span> ((finder (executable-find <span style="color: #98be65;">"open"</span>))
(command (format <span style="color: #98be65;">"%s %s"</span> finder path)))
(shell-command command)))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">my/open-project-in-finder</span> ()
<span style="color: #83898d;">"Open current project in Finder app."</span>
(<span style="color: #51afef;">interactive</span>)
(<span style="color: #51afef;">if</span> (projectile-project-p)
(my/open-finder-at (projectile-project-root))
(message <span style="color: #98be65;">"There is no active project."</span>)))
(<span style="color: #51afef;">defun</span> <span style="color: #c678dd;">my/open-current-file-in-finder</span> ()
<span style="color: #83898d;">"Open current file in Finder."</span>
(<span style="color: #51afef;">interactive</span>)
(<span style="color: #51afef;">let</span> ((file (buffer-file-name)))
(<span style="color: #51afef;">if</span> file
(my/open-finder-at (file-name-directory file))
(message <span style="color: #98be65;">"Buffer has not been saved yet!"</span>))))
)
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org7ef104f" class="outline-2">
<h2 id="org7ef104f"><span class="section-number-2">2</span> Modules</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-org2c47e8f" class="outline-3">
<h3 id="org2c47e8f"><span class="section-number-3">2.1</span> General</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #51afef;">setq</span> savehist-file (concat dotfiles-cache-dir <span style="color: #98be65;">"savehist"</span>)
history-length 500
savehist-save-minibuffer-history t
savehist-autosave-interval nil <span style="color: #5B6268;">; </span><span style="color: #5B6268;">save on kill only</span>
savehist-additional-variables '(kill-ring search-ring regexp-search-ring)
save-place-file (concat dotfiles-cache-dir <span style="color: #98be65;">"saveplace"</span>))
(<span style="color: #51afef;">setq-default</span> save-place t)
(add-to-list 'default-frame-alist '(inhibit-double-buffering . t))
(<span style="color: #51afef;">setq</span> byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local))
(<span style="color: #51afef;">setq</span> undo-limit (* 1024 10 10)
undo-outer-limit (* 1024 10 10)
undo-strong-limit (* 1024 10 10))
(<span style="color: #51afef;">setq-default</span>
bookmark-default-file (concat dotfiles-cache-dir <span style="color: #98be65;">"bookmarks"</span>)
abbrev-file-name (concat dotfiles-local-dir <span style="color: #98be65;">"abbrev.el"</span>)
auto-save-list-file-name (concat dotfiles-cache-dir <span style="color: #98be65;">"autosave"</span>)
pcache-directory (concat dotfiles-cache-dir <span style="color: #98be65;">"pcache"</span>))
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">move auto-save to the cache</span>
(<span style="color: #51afef;">let</span> ((dir (expand-file-name (concat dotfiles-cache-dir <span style="color: #98be65;">"auto-save/"</span>))))
(<span style="color: #51afef;">setq</span> auto-save-list-file-prefix (concat dir <span style="color: #98be65;">"saves-"</span>))
(<span style="color: #51afef;">setq</span> auto-save-file-name-transforms `((<span style="color: #98be65;">".*"</span> ,(concat dir <span style="color: #98be65;">"save-"</span>) t))))
(<span style="color: #51afef;">setq</span> help-window-select t)
(<span style="color: #51afef;">setq-default</span>
ad-redefinition-action 'accept <span style="color: #5B6268;">; </span><span style="color: #5B6268;">silence advised function warnings</span>
apropos-do-all t <span style="color: #5B6268;">; </span><span style="color: #5B6268;">make `</span><span style="color: #a9a1e1;">apropos</span><span style="color: #5B6268;">' more useful</span>
compilation-always-kill t <span style="color: #5B6268;">; </span><span style="color: #5B6268;">kill compilation process before starting another</span>
compilation-ask-about-save nil <span style="color: #5B6268;">; </span><span style="color: #5B6268;">save all buffers on `</span><span style="color: #a9a1e1;">compile</span><span style="color: #5B6268;">'</span>
compilation-scroll-output t <span style="color: #5B6268;">; </span><span style="color: #5B6268;">scroll to end of compilation output</span>
confirm-nonexistent-file-or-buffer t <span style="color: #5B6268;">; </span><span style="color: #5B6268;">confirm nonexisting files/buffers when opening</span>
idle-update-delay 2 <span style="color: #5B6268;">; </span><span style="color: #5B6268;">update ui less often (performance)</span>
warning-minimum-level <span style="color: #c678dd;">:error</span> <span style="color: #5B6268;">; </span><span style="color: #5B6268;">don't show warnings only errors</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">keep the point out of the minibuffer</span>
minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt))
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(load-library <span style="color: #98be65;">"iso-transl"</span>)
(<span style="color: #51afef;">setq-default</span>
isearch-allow-scroll t <span style="color: #5B6268;">; </span><span style="color: #5B6268;">Allow scrolling in an isearch session</span>
lazy-highlight-cleanup nil <span style="color: #5B6268;">; </span><span style="color: #5B6268;">Leave highlights after an isearch session</span>
lazy-highlight-initial-delay 0) <span style="color: #5B6268;">; </span><span style="color: #5B6268;">Start highlighting immediately</span>
(<span style="color: #51afef;">require</span> '<span style="color: #a9a1e1;">vc-hooks</span>)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Always follow symlinks to files under source-control. dont ask.</span>
(<span style="color: #51afef;">setq</span> vc-follow-symlinks t)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Modifications related to whitespace management</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Disable tab indentation</span>
(<span style="color: #51afef;">setq-default</span> indent-tabs-mode nil)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Remove trailing whitespace before save.</span>
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(<span style="color: #51afef;">setq</span>
auto-save-default nil
backup-inhibited t
confirm-nonexistent-file-or-buffer nil
create-lockfiles nil
mouse-wheel-progressive-speed nil)
(define-key global-map [remap list-buffers] 'ibuffer)
(winner-mode +1)
(global-set-key (kbd <span style="color: #98be65;">"C-x C-c"</span>) 'save-buffers-kill-emacs)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Always ask for y/n keypress instead of typing out 'yes' or 'no'</span>
(autoload 'ibuffer <span style="color: #98be65;">"ibuffer"</span>)
(fset 'yes-or-no-p 'y-or-n-p)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Emacs writes backup files to `filename~` by default. This is messy,</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">so let's tell it to write them to `~/.emacs.d/bak` instead.</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">If you have an accident, check this directory - you might get lucky.</span>
(<span style="color: #51afef;">setq</span> backup-directory-alist <span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Save backups in $(pwd)/.bak</span>
'((<span style="color: #98be65;">"."</span> . <span style="color: #98be65;">".bak"</span>)) <span style="color: #5B6268;">;;</span>
)
(<span style="color: #51afef;">setq</span> version-control t
backup-by-copying t <span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Copy-on-write-esque</span>
kept-new-versions 64 <span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Indeliable-ink-esque</span>
kept-old-versions 0 <span style="color: #5B6268;">;;</span>
delete-old-versions t <span style="color: #5B6268;">;;</span>
)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Automatically save buffers before launching M-x compile and friends,</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">instead of asking you if you want to save.</span>
(<span style="color: #51afef;">setq</span> compilation-ask-about-save nil)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Make the selection work like most people expect.</span>
(delete-selection-mode 1)
(transient-mark-mode t)
(global-set-key (kbd <span style="color: #98be65;">"DEL"</span>) 'backward-delete-char)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Enable `</span><span style="color: #a9a1e1;">downcase-region</span><span style="color: #5B6268;">' and `</span><span style="color: #a9a1e1;">upcase-region</span><span style="color: #5B6268;">'</span>
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Automatically update unmodified buffers whose files have changed.</span>
(global-auto-revert-mode 1)
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">If available, use `</span><span style="color: #a9a1e1;">xdg-open</span><span style="color: #5B6268;">' to open URLs.</span>
(<span style="color: #51afef;">when</span> (core/is-exec <span style="color: #98be65;">"xdg-open"</span>)
(<span style="color: #51afef;">setq-default</span>
browse-url-browser-function (<span style="color: #51afef;">quote</span> browse-url-generic)
browse-url-generic-program <span style="color: #98be65;">"xdg-open"</span>))
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">Make compilation buffers scroll to follow the output, but stop scrolling</span>
<span style="color: #5B6268;">;; </span><span style="color: #5B6268;">at the first error.</span>
(<span style="color: #51afef;">setq</span> compilation-scroll-output 'first-error)