-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.html
3493 lines (3182 loc) · 256 KB
/
init.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-09-01 Sun 22:47 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Xiaojie's Emacs Init File Written in Org-Mode</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Xiaojie Feng" />
<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 rel="stylesheet" href="./assets/page.css" type="text/css">
<link class="s-css-s--style" rel="stylesheet" title="Default" href="./assets/themes/default.css">
<link class="s-css-s--style" rel="stylesheet alternate" title="Default high contrast" href="./assets/themes/default-high-contrast.css">
<link class="s-css-s--style" rel="stylesheet alternate" title="Solarized dark xterm" href="./assets/themes/solarized-dark-xterm.css">
<link class="s-css-s--style" rel="stylesheet alternate" title="Black on white" href="./assets/themes/black-on-white.css">
<script src="./assets/js/simple-css-switch.js"></script>
<body lang="en" onload="simpleCssSwitch()">
<div id="s-css-s--menu"></div>
<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">Xiaojie's Emacs Init File Written in Org-Mode</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org40c22d1">1. About</a>
<ul>
<li><a href="#orgf0035b6">1.1. My Emacs Init File</a></li>
<li><a href="#orgdce6b94">1.2. License</a></li>
<li><a href="#org299f508">1.3. Commentary</a></li>
<li><a href="#orgf87c615">1.4. What I Want to Say</a></li>
<li><a href="#org2bba385">1.5. How to Use This Document</a></li>
</ul>
</li>
<li><a href="#orgd5215fe">2. Personal Information</a></li>
<li><a href="#orgb9513ad">3. Bootstraping</a>
<ul>
<li><a href="#orga0d3e90">3.1. Load Multiple Emacs Files</a>
<ul>
<li><a href="#org3d15ef9">3.1.1. My Directory Location</a></li>
<li><a href="#org9f8789d">3.1.2. Directory Structure</a></li>
<li><a href="#orgd3d9c9d">3.1.3. Customization</a></li>
<li><a href="#org309d8a1">3.1.4. Setting up the Load Path</a></li>
</ul>
</li>
<li><a href="#org18fd979">3.2. Package Management</a>
<ul>
<li><a href="#orgf721e53">3.2.1. <code>ELPA</code> - Packages Installer and Manager</a></li>
<li><a href="#org1f3c6bd">3.2.2. <code>Use-Package</code> - Package Configuration Macro</a></li>
</ul>
</li>
<li><a href="#org7e1da8b">3.3. Library Dependency</a></li>
<li><a href="#org8bd18a2">3.4. Environment fixup</a></li>
<li><a href="#orgc24e85d">3.5. Keyboard settings for macOS users</a></li>
</ul>
</li>
<li><a href="#org42f6bca">4. Basic settings used everywhere</a>
<ul>
<li><a href="#orgd6c5d0f">4.1. General user interface and appearance</a>
<ul>
<li><a href="#org2bc15ec">4.1.1. Startup screen and errors reporting</a></li>
<li><a href="#org2d3134e">4.1.2. Set frames title with buffer name</a></li>
<li><a href="#org7f4fcf3">4.1.3. Distinguish buffers with the same file name</a></li>
<li><a href="#orge04d36c">4.1.4. Menu bar, tool bar, scroll bar. No!</a></li>
<li><a href="#orgb6fcc0a">4.1.5. Modeline settings</a></li>
<li><a href="#org1172639">4.1.6. Put empty line markers into the left hand side</a></li>
<li><a href="#org1878779">4.1.7. Display Line Numbers</a></li>
<li><a href="#orgb4dd24c">4.1.8. Cursor and mouse</a></li>
<li><a href="#orgd6d495d">4.1.9. Sweet highlight</a></li>
<li><a href="#org14da4d0">4.1.10. Nice scrolling</a></li>
<li><a href="#orgb5d969d">4.1.11. No <code>#autosave#</code> and <code>backup~</code> files</a></li>
<li><a href="#org3507206">4.1.12. Change "yes or no" to "y or n"</a></li>
<li><a href="#org9dbac5d">4.1.13. Confirm before quit</a></li>
</ul>
</li>
<li><a href="#orgab416a9">4.2. Commands - useful interactive functions</a>
<ul>
<li><a href="#org1fe34dd">4.2.1. Reload emacs initialization file</a></li>
<li><a href="#org9805775">4.2.2. macOS swap Meta and Super</a></li>
<li><a href="#orge0bc6b6">4.2.3. Copy filename to clipboard</a></li>
<li><a href="#org2363f2e">4.2.4. Open File in external app</a></li>
</ul>
</li>
<li><a href="#org245dd46">4.3. Navigation</a>
<ul>
<li><a href="#orgdb07faa">4.3.1. <code>Projectile</code> - project interaction</a></li>
<li><a href="#org580f8ae">4.3.2. <code>Dired</code> - directory editor</a></li>
<li><a href="#orga141e17">4.3.3. <code>Neotree</code> - tree layout directory explorer</a></li>
<li><a href="#orgfe23ace">4.3.4. <code>Winner</code> - undo and redo window configuration</a></li>
<li><a href="#orgf9d4ba6">4.3.5. <code>Windmove</code> - switch between windows</a></li>
<li><a href="#org24da4a3">4.3.6. <code>Buffer-move</code> - move or swap buffer to other window</a></li>
<li><a href="#org31b6d98">4.3.7. <code>C-x o</code> : Moving to another window</a></li>
<li><a href="#org4f0a77a">4.3.8. <code>C-x k</code> : Quick kill buffer</a></li>
<li><a href="#org0b3c712">4.3.9. <code>Avy</code> - fast cursor movement</a></li>
<li><a href="#org55a7e4a">4.3.10. <code>C-a</code> : Smart beginning of line</a></li>
<li><a href="#org2e38be9">4.3.11. <code>C-w</code> and <code>M-w</code> : Smart cut and copy</a></li>
<li><a href="#org199dea3">4.3.12. <code>M-\</code> : Smart delete whitespaces around cursor</a></li>
<li><a href="#org41bfc13">4.3.13. <code>C-k</code> : Smart kill entire lines</a></li>
<li><a href="#org195504f">4.3.14. <code>Expand-region</code> - Smart region selection</a></li>
<li><a href="#org1d4939e">4.3.15. <code>Fancy-narrow</code> - Smart narrowing</a></li>
<li><a href="#org2cf1f28">4.3.16. <code>M-;</code> : Smart Comment</a></li>
<li><a href="#org391a8f6">4.3.17. <code>M-p</code> and <code>M-n</code> : Smart Scan</a></li>
<li><a href="#orge19c167">4.3.18. Better Searching and Visual Regular Expressions</a></li>
</ul>
</li>
<li><a href="#org72f0f95">4.4. Editing</a>
<ul>
<li><a href="#orgac74a56">4.4.1. Coding - always UTF-8</a></li>
<li><a href="#orgb2ec81d">4.4.2. Tabs, spaces, enters</a></li>
<li><a href="#org3ebc4a3">4.4.3. Delete the selection with a keypress</a></li>
<li><a href="#org65416a8">4.4.4. <code>Whitespace</code> - show and clean devil</a></li>
<li><a href="#org6e6e11b">4.4.5. <code>Smartparents</code> - Insert closing parens automagically</a></li>
<li><a href="#orgc2500ab">4.4.6. <code>Undo-tree</code> - visualize your undos and branches</a></li>
<li><a href="#org7b7cc7d">4.4.7. <code>Auto-fill</code> - warp long lines</a></li>
<li><a href="#org83349b1">4.4.8. <code>Hippie-expand</code> - Text Expansion</a></li>
<li><a href="#org326bef5">4.4.9. <code>Company</code> - Completion for Anything</a></li>
<li><a href="#org5ef5f99">4.4.10. <code>Yasnippet</code> - Code Templates</a></li>
<li><a href="#org3ee95e6">4.4.11. <code>Flyspell</code> - Spelling Checking</a></li>
<li><a href="#org0282cbd">4.4.12. <code>Multiple Cursors</code> - edit with multiple cursors</a></li>
</ul>
</li>
<li><a href="#orgcc09406">4.5. Helm - interactive completion and selection</a>
<ul>
<li><a href="#org53da2a4">4.5.1. Helm core - amazing utils used everywhere</a></li>
<li><a href="#org9eae549">4.5.2. Helm-projectile - project maintaining</a></li>
<li><a href="#org182d2bf">4.5.3. Helm-swoop - searching tool</a></li>
<li><a href="#org438c6ae">4.5.4. Helm-describe - keybings describe</a></li>
<li><a href="#org3bf20ef">4.5.5. Helm-flyspell - flyspell correct</a></li>
</ul>
</li>
<li><a href="#orgcfa53fb">4.6. Backup and autosave</a></li>
<li><a href="#org550bef9">4.7. Persistence and history</a>
<ul>
<li><a href="#orge820de4">4.7.1. Recentf - recent files</a></li>
<li><a href="#org0583cee">4.7.2. Saveplace - save file position</a></li>
<li><a href="#org19fedd5">4.7.3. Savehist - save history</a></li>
<li><a href="#orgdf00bf0">4.7.4. Desktop - save and restore opened files and windows config</a></li>
<li><a href="#orge73dee1">4.7.5. Bookmark - emacs bookmark</a></li>
<li><a href="#org9776cf4">4.7.6. Eshell - emacs shell</a></li>
</ul>
</li>
<li><a href="#orge5721e4">4.8. Global Key Bindings</a>
<ul>
<li><a href="#org3822179">4.8.1. Function keys</a></li>
<li><a href="#org7d2b14d">4.8.2. Easy keys for frequently used commands</a></li>
<li><a href="#org62b05f7">4.8.3. Toggles</a></li>
<li><a href="#org2a1b9c9">4.8.4. Miscellaneous</a></li>
<li><a href="#org515152b">4.8.5. <code>Which-key</code> - keys cheat sheet</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org95ee843">5. Aesthetics</a>
<ul>
<li><a href="#org7b2d953">5.1. Color Themes</a></li>
<li><a href="#orgb3cea75">5.2. Modeline Theme</a></li>
<li><a href="#org1fec352">5.3. Icons</a></li>
<li><a href="#orgd0174c6">5.4. Fonts</a></li>
<li><a href="#org3aa3f60">5.5. <code>Nyan-mode</code> - Nyan cat in modeline</a></li>
<li><a href="#org7879fca">5.6. <code>Rainbow-delimiters</code> - color delimiters for LISP</a></li>
<li><a href="#org5023f55">5.7. <code>Rainbow-mode</code> - color words for CSS</a></li>
</ul>
</li>
<li><a href="#org2d45e76">6. Programming Environment</a>
<ul>
<li><a href="#orgbbdbc3c">6.1. Editing Support</a>
<ul>
<li><a href="#orga4e314f">6.1.1. Aggressive Indent</a></li>
<li><a href="#org84a6db2">6.1.2. Indent Guide</a></li>
<li><a href="#org51c57ee">6.1.3. Code Folding</a></li>
</ul>
</li>
<li><a href="#org60a6ee2">6.2. Document</a></li>
<li><a href="#org454e553">6.3. Error checking</a></li>
</ul>
</li>
<li><a href="#orgbaf193b">7. Programming Languages</a>
<ul>
<li><a href="#org6bcb334">7.1. Shell</a></li>
</ul>
</li>
<li><a href="#orgaaeb5c0">8. Typesetting Languages</a>
<ul>
<li><a href="#org41d9938">8.1. Markdown</a></li>
<li><a href="#org5550191">8.2. LaTeX</a></li>
</ul>
</li>
<li><a href="#org8a7daa7">9. Git and Magit</a>
<ul>
<li><a href="#org7c5bf1e">9.1. Git basic settings</a></li>
<li><a href="#org3dde1b7">9.2. Magit - git interface</a></li>
</ul>
</li>
<li><a href="#orgd9cb109">10. Org-Mode</a>
<ul>
<li><a href="#org48f0163">10.1. Exporter Setup</a></li>
</ul>
</li>
<li><a href="#orgffdc68a">11. Acknowledges</a></li>
</ul>
</div>
</div>
<div id="outline-container-org40c22d1" class="outline-2">
<h2 id="org40c22d1"><span class="section-number-2">1</span> About</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-orgf0035b6" class="outline-3">
<h3 id="orgf0035b6"><span class="section-number-3">1.1</span> My Emacs Init File</h3>
<div class="outline-text-3" id="text-1-1">
<p>
This is my Emacs configuration file. Inspired by <a href="http://pages.sachachua.com/.emacs.d/Sacha.html">Sacha</a> and <a href="http://doc.norang.ca/org-mode.html">Bernt</a>, l written it
using <a href="https://orgmode.org/worg/org-contrib/babel/intro.html">Org-babel</a> in literate style, to make it easy to explain.
</p>
<div class="org-src-container">
<pre class="src src-org">Author: Xiaojie Feng
Keywords: emacs, dotfile, config
<span style="text-decoration: underline;">___</span> _ <span style="text-decoration: underline;">__ </span><span style="text-decoration: underline;">___</span> <span style="text-decoration: underline;">__ _ </span><span style="text-decoration: underline;">___</span> <span style="text-decoration: underline;">___</span>
/ _ \ '_ ` _ \ / _` |/ __/ __|
<span style="color: #9FC59F;">| __/ | | | | | (_| | (</span><span style="color: #9FC59F; text-decoration: underline;">__\__</span><span style="color: #9FC59F;"> \</span>
(<span style="text-decoration: underline;">_)___|_| |_| |_|\__</span>,_|\___|___/
</pre>
</div>
</div>
</div>
<div id="outline-container-orgdce6b94" class="outline-3">
<h3 id="orgdce6b94"><span class="section-number-3">1.2</span> License</h3>
<div class="outline-text-3" id="text-1-2">
<blockquote>
<p>
Copyright (C) 2016-2019 Xiaojie Feng
</p>
<p>
Permission is granted to copy, distribute and/or modify this document under the
terms of the GNU Free Documentation License, Version 1.3 or any later version
published by the Free Software Foundation; with no Invariant Sections, no
Front-Cover Texts, and no Back-Cover Texts.
</p>
<p>
Code in this document is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
</p>
<p>
This code is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
</p>
</blockquote>
</div>
</div>
<div id="outline-container-org299f508" class="outline-3">
<h3 id="org299f508"><span class="section-number-3">1.3</span> Commentary</h3>
<div class="outline-text-3" id="text-1-3">
<blockquote>
<p>
Emacs outshines all other editing software in approximately the same way that
the noonday sun does the stars. It is not just bigger and brighter; it simply
makes everything else vanish.
[Neal Stephenson]
</p>
<p>
People talk about getting used to a new editor, but over time, it is precisely
the opposite that should happen — the editor should get used to us.
[Vivek Haldar]
</p>
<p>
"Show me your ~/.emacs and I will tell you who you are."
[Bogdan Maryniuk]
</p>
<p>
"Emacs is like a laser guided missile. It only has to be slightly
mis-configured to ruin your whole day."
[Sean McGrath]
</p>
<p>
"While any text editor can save your files, only Emacs can save your
soul."
[Per Abrahamsen]
</p>
</blockquote>
</div>
</div>
<div id="outline-container-orgf87c615" class="outline-3">
<h3 id="orgf87c615"><span class="section-number-3">1.4</span> What I Want to Say</h3>
<div class="outline-text-3" id="text-1-4">
<p>
If you are not familiar with the Emacs basic usage, I highly recommend you to
read some sophisticated Emacs users' Emacs guide, such as <a href="http://tuhdo.github.io/emacs-tutor.html">Tuhdo's Emacs Mini
Manual (PART 1) - THE BASICS</a> and <a href="http://ergoemacs.org/emacs/emacs.html">Xah Lee's Practical Emacs Tutorial</a>, instead of
<a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/">the official Emacs Manual</a>. The official manual is too long to read for Emacs
newbies.
</p>
<p>
You can always use my init file as long as you master the basic usage of Emacs,
even though my configuration contains something a little advanced to Emacs (and
Emacs Lisp) beginners. As I think, the init file was well organized in
structural and code blocks (<code>setq</code>, <code>defun</code>, package configuration etc.) were
written together with plenty explanation about why and how to use, thanks to
the <a href="https://en.wikipedia.org/wiki/Literate_programming">Literate programming paradigm</a> introduced by Donald Knuth.
</p>
</div>
</div>
<div id="outline-container-org2bba385" class="outline-3">
<h3 id="org2bba385"><span class="section-number-3">1.5</span> How to Use This Document</h3>
<div class="outline-text-3" id="text-1-5">
<p>
This document is available as an org file which you can load in Emacs and
tangle with <code>M-x org-babel-tangle (C-c C-v C-t)</code> which will create
<code>org-mode.el</code> in the same directory as the <code>org-mode.org</code> file. This will
extract all of the elisp examples in this document into a file you can include
in your <code>$HOME/.emacs.d/init.el</code> file.
</p>
<p>
If you're new to <a href="https://www.gnu.org/software/emacs/manual/html_node/eintr/index.html">Emacs Lisp</a>, you probably don't want to copy and paste large
chunks of this code. Instead, copy small parts of it (always making sure to
copy a complete set of parentheses) into your <code>*scratch*</code> buffer or some other
buffer in <code>emacs-lisp-mode</code>. Use <code>M-x eval-buffer</code> to evaluate the code and see
if you like the way that Emacs behaves.
</p>
<p>
If you're viewing the Org file, you can open source code blocks (those are the
ones in begin_src) in a separate buffer by moving your point inside them and
typing C-c ' (<code>M-x org-edit-special</code>). This opens another buffer in
<code>emacs-lisp-mode</code>, so you can use <code>M-x eval-buffer</code> to load the changes.
</p>
</div>
</div>
</div>
<div id="outline-container-orgd5215fe" class="outline-2">
<h2 id="orgd5215fe"><span class="section-number-2">2</span> Personal Information</h2>
<div class="outline-text-2" id="text-2">
<p>
Emacs will normally pick this up automatically, but this way I can be sure the
right information is always present.
</p>
<p>
<b>Note: You should modify this with your personal info.</b>
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> user-full-name <span style="color: #CC9393;">"Xiaojie Feng"</span>
user-mail-address <span style="color: #CC9393;">"[email protected]"</span><span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb9513ad" class="outline-2">
<h2 id="orgb9513ad"><span class="section-number-2">3</span> Bootstraping</h2>
<div class="outline-text-2" id="text-3">
</div>
<div id="outline-container-orga0d3e90" class="outline-3">
<h3 id="orga0d3e90"><span class="section-number-3">3.1</span> Load Multiple Emacs Files</h3>
<div class="outline-text-3" id="text-3-1">
</div>
<div id="outline-container-org3d15ef9" class="outline-4">
<h4 id="org3d15ef9"><span class="section-number-4">3.1.1</span> My Directory Location</h4>
<div class="outline-text-4" id="text-3-1-1">
<p>
Conventionally, additional per-user Emacs-specific files are placed in
<code>.emacs.d</code> directory in the <code>HOME</code> directory. The variable
<code>user-emacs-directory</code> holds that.
</p>
<p>
Structure the <code>.emacs.d</code> directory by putting some sub-directories in it.
Following functions make it easy to get the location (whole path) of these
sub-directories (and files):
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">defun</span> <span style="color: #93E0E3;">user-emacs-subdirectory</span> <span style="color: #bf62a6;">(</span>d<span style="color: #bf62a6;">)</span> <span style="color: #bf62a6;">(</span>expand-file-name d user-emacs-directory<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">defun</span> <span style="color: #93E0E3;">user-emacs-file</span> <span style="color: #bf62a6;">(</span>f<span style="color: #bf62a6;">)</span> <span style="color: #bf62a6;">(</span>expand-file-name f user-emacs-directory<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
</pre>
</div>
<p>
But, in practice, I didn't use them.
</p>
</div>
</div>
<div id="outline-container-org9f8789d" class="outline-4">
<h4 id="org9f8789d"><span class="section-number-4">3.1.2</span> Directory Structure</h4>
<div class="outline-text-4" id="text-3-1-2">
<p>
In case this is the first time running this on a computer, we need to make sure
the following directories have been created.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">defconst</span> <span style="color: #DFAF8F;">user-emacs-savefile-dir</span>
<span style="color: #bf62a6;">(</span>expand-file-name <span style="color: #CC9393;">"savefile"</span> user-emacs-directory<span style="color: #bf62a6;">)</span>
<span style="color: #9FC59F;">"This folder stores all the history and cache files"</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">defconst</span> <span style="color: #DFAF8F;">user-emacs-backup-dir</span>
<span style="color: #bf62a6;">(</span>expand-file-name <span style="color: #CC9393;">"backup"</span> user-emacs-directory<span style="color: #bf62a6;">)</span>
<span style="color: #9FC59F;">"This folder stores all the backup~ files"</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">defconst</span> <span style="color: #DFAF8F;">user-emacs-autosave-dir</span>
<span style="color: #bf62a6;">(</span>expand-file-name <span style="color: #CC9393;">"autosave"</span> user-emacs-directory<span style="color: #bf62a6;">)</span>
<span style="color: #9FC59F;">"This folder stores all the #autosave# files"</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">unless</span> <span style="color: #bf62a6;">(</span>file-exists-p user-emacs-savefile-dir<span style="color: #bf62a6;">)</span>
<span style="color: #bf62a6;">(</span>make-directory user-emacs-savefile-dir<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">unless</span> <span style="color: #bf62a6;">(</span>file-exists-p user-emacs-backup-dir<span style="color: #bf62a6;">)</span>
<span style="color: #bf62a6;">(</span>make-directory user-emacs-backup-dir<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">unless</span> <span style="color: #bf62a6;">(</span>file-exists-p user-emacs-autosave-dir<span style="color: #bf62a6;">)</span>
<span style="color: #bf62a6;">(</span>make-directory user-emacs-autosave-dir<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd3d9c9d" class="outline-4">
<h4 id="orgd3d9c9d"><span class="section-number-4">3.1.3</span> Customization</h4>
<div class="outline-text-4" id="text-3-1-3">
<p>
While I would rather program my configurations, sometimes the Emacs
menu system is "good enough", but I want it in its own file:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> custom-file <span style="color: #bf62a6;">(</span>expand-file-name <span style="color: #CC9393;">"custom.el"</span> user-emacs-directory<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">when</span> <span style="color: #bf62a6;">(</span>file-exists-p custom-file<span style="color: #bf62a6;">)</span>
<span style="color: #bf62a6;">(</span>load custom-file<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org309d8a1" class="outline-4">
<h4 id="org309d8a1"><span class="section-number-4">3.1.4</span> Setting up the Load Path</h4>
<div class="outline-text-4" id="text-3-1-4">
<p>
Extra packages not available via the package manager go in my personal stash at
<code>$HOME/.emacs.d/elisp</code>. As long as they're in a directory in my <code>load-path</code>,
Emacs can find them.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span>add-to-list 'load-path <span style="color: #bf62a6;">(</span>expand-file-name <span style="color: #CC9393;">"elisp"</span> user-emacs-directory<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org18fd979" class="outline-3">
<h3 id="org18fd979"><span class="section-number-3">3.2</span> Package Management</h3>
<div class="outline-text-3" id="text-3-2">
</div>
<div id="outline-container-orgf721e53" class="outline-4">
<h4 id="orgf721e53"><span class="section-number-4">3.2.1</span> <code>ELPA</code> - Packages Installer and Manager</h4>
<div class="outline-text-4" id="text-3-2-1">
<p>
Emacs has become like every other operating system, and now has a package
manager called <a href="http://tromey.com/elpa/">Emacs Lisp Package Archive (ELPA)</a> with its own collection
repository. This provides a nice way to <a href="http://ergoemacs.org/emacs/emacs_package_system.html">install additional packages</a>. But since
it is so conservative, we need to add more package source.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">require</span> '<span style="color: #BFEBBF;">package</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> package-archives
'<span style="color: #bf62a6;">(</span><span style="color: #459ba8;">(</span><span style="color: #CC9393;">"gnu"</span> . <span style="color: #CC9393;">"https://elpa.gnu.org/packages/"</span><span style="color: #459ba8;">)</span>
<span style="color: #459ba8;">(</span><span style="color: #CC9393;">"org"</span> . <span style="color: #CC9393;">"http://orgmode.org/elpa/"</span><span style="color: #459ba8;">)</span>
<span style="color: #459ba8;">(</span><span style="color: #CC9393;">"melpa"</span> . <span style="color: #CC9393;">"https://melpa.org/packages/"</span><span style="color: #459ba8;">)</span><span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span>package-initialize<span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> package-enable-at-startup nil<span style="color: #78c5d6;">)</span>
</pre>
</div>
<p>
<b>Note:</b> As a Chinese user, I use the following mirrors instead. If you want to
use my emacs init file directly, you should change the value <code>yes</code> and <code>no</code>
after variable <code>:tangle</code> in the org file, then tangle the org file with
<code>org-babel</code> to use the official package source.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">require</span> '<span style="color: #BFEBBF;">package</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> package-archives
'<span style="color: #bf62a6;">(</span><span style="color: #459ba8;">(</span><span style="color: #CC9393;">"gnu"</span> . <span style="color: #CC9393;">"http://elpa.emacs-china.org/gnu/"</span><span style="color: #459ba8;">)</span>
<span style="color: #459ba8;">(</span><span style="color: #CC9393;">"melpa"</span> . <span style="color: #CC9393;">"http://elpa.emacs-china.org/melpa/"</span><span style="color: #459ba8;">)</span>
<span style="color: #459ba8;">(</span><span style="color: #CC9393;">"org"</span> . <span style="color: #CC9393;">"http://elpa.emacs-china.org/org/"</span><span style="color: #459ba8;">)</span><span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span>package-initialize<span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> package-enable-at-startup nil<span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org1f3c6bd" class="outline-4">
<h4 id="org1f3c6bd"><span class="section-number-4">3.2.2</span> <code>Use-Package</code> - Package Configuration Macro</h4>
<div class="outline-text-4" id="text-3-2-2">
<p>
This <a href="https://github.com/jwiegley/use-package">use-package</a> macro provides more concise ways to setup package autoloads,
keybindings, and various mode configuration. The focus is on decreasing startup
time by <i>autoloading</i> packages instead loading them on startup.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">unless</span> <span style="color: #bf62a6;">(</span>package-installed-p 'use-package<span style="color: #bf62a6;">)</span>
<span style="color: #bf62a6;">(</span>package-refresh-contents<span style="color: #bf62a6;">)</span>
<span style="color: #bf62a6;">(</span>package-install 'use-package<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> use-package-verbose t
use-package-always-ensure t<span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">eval-when-compile</span>
<span style="color: #bf62a6;">(</span><span style="color: #F0DFAF; font-weight: bold;">require</span> '<span style="color: #BFEBBF;">use-package</span><span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
<span style="color: #5F7F5F;">;; </span><span style="color: #7F9F7F;">Please don't load outdated byte code</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> load-prefer-newer t<span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org7e1da8b" class="outline-3">
<h3 id="org7e1da8b"><span class="section-number-3">3.3</span> Library Dependency</h3>
<div class="outline-text-3" id="text-3-3">
<p>
Load up a collection of enhancements to Emacs Lisp, to make the configuration
and its dependencies work properly.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">require</span> '<span style="color: #BFEBBF;">cl</span><span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">provides useful things like `</span><span style="color: #BFEBBF;">loop</span><span style="color: #7F9F7F;">' and `</span><span style="color: #BFEBBF;">setf</span><span style="color: #7F9F7F;">'</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">use-package</span> <span style="color: #BFEBBF;">dash</span> <span style="color: #DCDCCC; font-weight: bold;">:ensure</span> t<span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">a modern list library</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">use-package</span> <span style="color: #BFEBBF;">diminish</span> <span style="color: #DCDCCC; font-weight: bold;">:ensure</span> t<span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">diminish keeps the modeline tidy</span>
</pre>
</div>
<p>
Benefiting from org-mode's contrib:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">use-package</span> <span style="color: #BFEBBF;">org</span>
<span style="color: #DCDCCC; font-weight: bold;">:ensure</span> org-plus-contrib<span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org8bd18a2" class="outline-3">
<h3 id="org8bd18a2"><span class="section-number-3">3.4</span> Environment fixup</h3>
<div class="outline-text-3" id="text-3-4">
<p>
On macOS, Emacs doesn't use the shell PATH if it's not started from the shell
(started from the GUI). <a href="https://github.com/purcell/exec-path-from-shell">Exec-path-from-shell</a> can fix this problem. It ensure
environment variables inside Emacs look the same as in the user's shell.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">use-package</span> <span style="color: #BFEBBF;">exec-path-from-shell</span>
<span style="color: #DCDCCC; font-weight: bold;">:defer</span> t
<span style="color: #DCDCCC; font-weight: bold;">:init</span>
<span style="color: #bf62a6;">(</span><span style="color: #F0DFAF; font-weight: bold;">progn</span>
<span style="color: #459ba8;">(</span><span style="color: #F0DFAF; font-weight: bold;">when</span> <span style="color: #e868a2;">(</span>memq window-system '<span style="color: #79c267;">(</span>mac ns<span style="color: #79c267;">)</span><span style="color: #e868a2;">)</span>
<span style="color: #e868a2;">(</span>exec-path-from-shell-initialize<span style="color: #e868a2;">)</span><span style="color: #459ba8;">)</span><span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc24e85d" class="outline-3">
<h3 id="orgc24e85d"><span class="section-number-3">3.5</span> Keyboard settings for macOS users</h3>
<div class="outline-text-3" id="text-3-5">
<p>
Set keys for Apple keyboard, for Emacs in macOS.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">when</span> <span style="color: #bf62a6;">(</span>eq system-type 'darwin<span style="color: #bf62a6;">)</span>
<span style="color: #bf62a6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> mac-command-modifier 'meta<span style="color: #bf62a6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">make command key do Meta</span>
<span style="color: #bf62a6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> mac-option-modifier 'super<span style="color: #bf62a6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">make option key do Super</span>
<span style="color: #bf62a6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> mac-control-modifier 'control<span style="color: #bf62a6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">make control key do Control</span>
<span style="color: #bf62a6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> ns-function-modifier 'hyper<span style="color: #bf62a6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">make fn key do Hyper</span>
<span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org42f6bca" class="outline-2">
<h2 id="org42f6bca"><span class="section-number-2">4</span> Basic settings used everywhere</h2>
<div class="outline-text-2" id="text-4">
</div>
<div id="outline-container-orgd6c5d0f" class="outline-3">
<h3 id="orgd6c5d0f"><span class="section-number-3">4.1</span> General user interface and appearance</h3>
<div class="outline-text-3" id="text-4-1">
</div>
<div id="outline-container-org2bc15ec" class="outline-4">
<h4 id="org2bc15ec"><span class="section-number-4">4.1.1</span> Startup screen and errors reporting</h4>
<div class="outline-text-4" id="text-4-1-1">
<p>
Turn off the startup messages when entering Emacs.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> inhibit-startup-screen t<span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">disable startup screen</span>
</pre>
</div>
<p>
No beep when reporting errors.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> ring-bell-function <span style="color: #bf62a6;">(</span><span style="color: #F0DFAF; font-weight: bold;">lambda</span> <span style="color: #459ba8;">()</span><span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">disable the annoying bell ring</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org2d3134e" class="outline-4">
<h4 id="org2d3134e"><span class="section-number-4">4.1.2</span> Set frames title with buffer name</h4>
<div class="outline-text-4" id="text-4-1-2">
<p>
Use project and buffer name as frame title.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> frame-title-format
<span style="color: #bf62a6;">(</span>list <span style="color: #CC9393;">"["</span> '<span style="color: #459ba8;">(</span><span style="color: #DCDCCC; font-weight: bold;">:eval</span> <span style="color: #e868a2;">(</span>projectile-project-name<span style="color: #e868a2;">)</span><span style="color: #459ba8;">)</span> <span style="color: #CC9393;">"]"</span>
<span style="color: #CC9393;">" ψωETωψ ◎ %b"</span><span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org7f4fcf3" class="outline-4">
<h4 id="org7f4fcf3"><span class="section-number-4">4.1.3</span> Distinguish buffers with the same file name</h4>
<div class="outline-text-4" id="text-4-1-3">
<p>
Make two buffers with the same file name distinguishable.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">require</span> '<span style="color: #BFEBBF;">uniquify</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> uniquify-buffer-name-style 'forward<span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> uniquify-separator <span style="color: #CC9393;">"/"</span><span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> uniquify-after-kill-buffer-p t<span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">rename after killing uniquified</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> uniquify-ignore-buffers-re <span style="color: #CC9393;">"^\\*"</span><span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">don't muck with special buffers</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orge04d36c" class="outline-4">
<h4 id="orge04d36c"><span class="section-number-4">4.1.4</span> Menu bar, tool bar, scroll bar. No!</h4>
<div class="outline-text-4" id="text-4-1-4">
<p>
Get rid of the menu bar, tool bar, and scroll bar. Useless!
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span>menu-bar-mode -1<span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span>tool-bar-mode -1<span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span>scroll-bar-mode -1<span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb6fcc0a" class="outline-4">
<h4 id="orgb6fcc0a"><span class="section-number-4">4.1.5</span> Modeline settings</h4>
<div class="outline-text-4" id="text-4-1-5">
<p>
Show current line and cursor column position.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span>line-number-mode 1<span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span>column-number-mode 1<span style="color: #78c5d6;">)</span>
</pre>
</div>
<p>
Indicate current file size.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span>size-indication-mode t<span style="color: #78c5d6;">)</span>
</pre>
</div>
<p>
Display the time.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span>display-time-mode 1<span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org1172639" class="outline-4">
<h4 id="org1172639"><span class="section-number-4">4.1.6</span> Put empty line markers into the left hand side</h4>
<div class="outline-text-4" id="text-4-1-6">
<p>
Put empty line markers into the left hand side to see when a file actually
ends.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq-default</span> indicate-empty-lines t<span style="color: #78c5d6;">)</span>
<span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">when</span> <span style="color: #bf62a6;">(</span>not indicate-empty-lines<span style="color: #bf62a6;">)</span>
<span style="color: #bf62a6;">(</span>toggle-indicate-empty-lines<span style="color: #bf62a6;">)</span><span style="color: #78c5d6;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org1878779" class="outline-4">
<h4 id="org1878779"><span class="section-number-4">4.1.7</span> Display Line Numbers</h4>
<div class="outline-text-4" id="text-4-1-7">
<p>
According to <a href="http://ergoemacs.org/emacs/emacs_line_number_mode.html">this article</a>, Emacs now has two line numbers mode: <code>linum-mode</code>
and <code>display-line-numbers-mode</code> (Emacs 26). Use the new one :)
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span>global-display-line-numbers-mode<span style="color: #78c5d6;">)</span>
</pre>
</div>
<p>
With the <code>display-line-numbers-mode</code> turned on, we can use <code>M-g g</code>
(<code>goto-line</code>) to go to the desired line quickly.
</p>
</div>
</div>
<div id="outline-container-orgb4dd24c" class="outline-4">
<h4 id="orgb4dd24c"><span class="section-number-4">4.1.8</span> Cursor and mouse</h4>
<div class="outline-text-4" id="text-4-1-8">
<p>
The blinking cursor is nothing, but an annoyance.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span>blink-cursor-mode -1<span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">No blinking cursor</span>
</pre>
</div>
<p>
Hide the mouse while typing.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #78c5d6;">(</span><span style="color: #F0DFAF; font-weight: bold;">setq</span> make-pointer-invisible t<span style="color: #78c5d6;">)</span> <span style="color: #5F7F5F;">; </span><span style="color: #7F9F7F;">Hide the mouse while typing</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd6d495d" class="outline-4">
<h4 id="orgd6d495d"><span class="section-number-4">4.1.9</span> Sweet highlight</h4>
<div class="outline-text-4" id="text-4-1-9">