-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
6398 lines (5406 loc) · 223 KB
/
init.el
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
(setq gc-cons-threshold (* 50 1000 1000))
;; ######################################## INSTALL PACKAGES ######################################
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(add-to-list 'package-archives
'("org" . "http://orgmode.org/elpa/") t) ;; for newest version of org mode
(add-to-list 'package-archives
'( "jcs-elpa" . "https://jcs-emacs.github.io/jcs-elpa/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;(customize-set-variable 'package-load-list
;; '((doom-modeline nil) ; never enable or
;; ; install newer versions
;; ; of this package
;;
; (tree-sitter-langs "0.12.8") ; lock this
; ; package to
; ; this version
; ; even if newer
; ; versions are
; ; available
;
; all)) ; enable the
;; ; rest of the
;; ; packages
;; (unless (package-installed-p `better-defaults) (package-install `better-defaults))
;; (unless (package-installed-p `auto-complete) (package-install `auto-complete))
;; ####################################### Addlist #########################################
;; (add-to-list 'package-selected-packages '0blayout)
;; (add-to-list 'package-selected-packages '0xc)
;; (add-to-list 'package-selected-packages 'ac-helm)
;; (add-to-list 'package-selected-packages 'ac-ispell)
;; (add-to-list 'package-selected-packages 'ace-window)
(add-to-list 'package-selected-packages 'ack)
(add-to-list 'package-selected-packages 'ack-menu)
;;(add-to-list 'package-selected-packages 'aide)
(add-to-list 'package-selected-packages 'all-the-icons)
(add-to-list 'package-selected-packages 'all-the-icons-ivy-rich)
;; (add-to-list 'package-selected-packages 'anaconda-mode)
(add-to-list 'package-selected-packages 'atomic-chrome)
(add-to-list 'package-selected-packages 'auctex)
;;(add-to-list 'package-selected-packages 'auto-virtualenv)
(add-to-list 'package-selected-packages 'auto-yasnippet)
;;(add-to-list 'package-selected-packages 'auto-complete)
;;(add-to-list 'package-selected-packages 'auto-complete-config)
;;(add-to-list 'package-selected-packages 'auto-complete-auctex)
;; (add-to-list 'package-selected-packages 'auto-complete-clang)
;; (add-to-list 'package-selected-packages 'auto-package-update)
(add-to-list 'package-selected-packages 'avy)
(add-to-list 'package-selected-packages 'beframe)
(add-to-list 'package-selected-packages 'better-defaults)
(add-to-list 'package-selected-packages 'bibtex)
(add-to-list 'package-selected-packages 'browse-at-remote)
;; (add-to-list 'package-selected-packages 'c-eldoc)
(add-to-list 'package-selected-packages 'cape)
(add-to-list 'package-selected-packages 'change-region)
(add-to-list 'package-selected-packages 'cider)
(add-to-list 'package-selected-packages 'citar)
(add-to-list 'package-selected-packages 'citar-embark)
(add-to-list 'package-selected-packages 'citar-org)
(add-to-list 'package-selected-packages 'citar-org-roam)
(add-to-list 'package-selected-packages 'citeproc-org)
(add-to-list 'package-selected-packages 'code-cells)
;;(add-to-list 'package-selected-packages 'clomacs) ;; depends on cider-0.22.1
;; (add-to-list 'package-selected-packages 'cmake-ide)
;; (add-to-list 'package-selected-packages 'cmake-mode)
;; (add-to-list 'package-selected-packages 'code-cells)
;; (add-to-list 'package-selected-packages 'combobulate)
(add-to-list 'package-selected-packages 'company) ; required by lsp-mode.302
(add-to-list 'package-selected-packages 'company-box) ; required to avoid conflicts with copilot
(add-to-list 'package-selected-packages 'company-tabnine)
(add-to-list 'package-selected-packages 'company-prescient)
(add-to-list 'package-selected-packages 'company-quickhelp)
(add-to-list 'package-selected-packages 'company-quickhelp-terminal)
(add-to-list 'package-selected-packages 'conda)
;;(add-to-list 'package-selected-packages 'codegpt)
(add-to-list 'package-selected-packages 'consult)
(add-to-list 'package-selected-packages 'consult-projectile)
(add-to-list 'package-selected-packages 'consult-org-roam)
;; (add-to-list 'package-selected-packages 'copilot)
(add-to-list 'package-selected-packages 'corfu)
;; (add-to-list 'package-selected-packages 'corfu-prescient)
;; (add-to-list 'package-selected-packages 'counsel)
(add-to-list 'package-selected-packages 'dash)
(add-to-list 'package-selected-packages 'dashboard-hackernews)
(add-to-list 'package-selected-packages 'dashboard)
(add-to-list 'package-selected-packages 'dap-mode)
(add-to-list 'package-selected-packages 'dired-icon)
(add-to-list 'package-selected-packages 'dired-subtree)
(add-to-list 'package-selected-packages 'discover)
(add-to-list 'package-selected-packages 'dirvish)
(add-to-list 'package-selected-packages 'dot-mode)
(add-to-list 'package-selected-packages 'drag-stuff)
;;(add-to-list 'package-selected-packages 'edwina)
(add-to-list 'package-selected-packages 'ef-themes)
(add-to-list 'package-selected-packages 'eglot)
;; (add-to-list 'package-selected-packages 'ein)
;; (add-to-list 'package-selected-packages 'eldoc-stan)
;; (add-to-list 'package-selected-packages 'electric-spacing)
;; (add-to-list 'package-selected-packages 'elisp-lint)
;; (add-to-list 'package-selected-packages 'elpy)
(add-to-list 'package-selected-packages 'elfeed)
(add-to-list 'package-selected-packages 'elfeed-dashboard)
(add-to-list 'package-selected-packages 'elfeed-org)
(add-to-list 'package-selected-packages 'elfeed-score)
(add-to-list 'package-selected-packages 'elpy)
;; (add-to-list 'package-selected-packages 'emacs-cursorless)
(add-to-list 'package-selected-packages 'emacs-eat)
;; (add-to-list 'package-selected-packages 'embark)
;; (add-to-list 'package-selected-packages 'embark-consult)
(add-to-list 'package-selected-packages 'ement)
(add-to-list 'package-selected-packages 'emojify)
(add-to-list 'package-selected-packages 'engine-mode)
(add-to-list 'package-selected-packages 'eros)
(add-to-list 'package-selected-packages 'ess)
(add-to-list 'package-selected-packages 'expand-region)
(add-to-list 'package-selected-packages 'evil-nerd-commenter)
;; (add-to-list 'package-selected-packages 'evil)
;; (add-to-list 'package-selected-packages 'evil-collection)
;; (add-to-list 'package-selected-packages 'evil-visual-mark-mode)
(add-to-list 'package-selected-packages 'exec-path-from-shell)
;; (add-to-list 'package-selected-packages 'expand-region)
;; (add-to-list 'package-selected-packages 'exwm)
(add-to-list 'package-selected-packages 'file-info)
(add-to-list 'package-selected-packages 'flycheck)
(add-to-list 'package-selected-packages 'flycheck-vale)
;; (add-to-list 'package-selected-packages 'flycheck-grammarly)
;; (add-to-list 'package-selected-packages 'flycheck-plantuml)
;; (add-to-list 'package-selected-packages 'flycheck-pycheckers)
;; (add-to-list 'package-selected-packages 'flycheck-stan)
;; (add-to-list 'package-selected-packages 'flymake)
;; (add-to-list 'package-selected-packages 'flymake-grammarly)
;; (add-to-list 'package-selected-packages 'fn)
;; (add-to-list 'package-selected-packages 'fzf)
(add-to-list 'package-selected-packages 'focus)
(add-to-list 'package-selected-packages 'gcmh)
(add-to-list 'package-selected-packages 'general)
(add-to-list 'package-selected-packages 'git-gutter)
(add-to-list 'package-selected-packages 'gnuplot)
(add-to-list 'package-selected-packages 'gnuplot-mode)
(add-to-list 'package-selected-packages 'gptai)
(add-to-list 'package-selected-packages 'golden-ratio)
(add-to-list 'package-selected-packages 'google-this)
;; (add-to-list 'package-selected-packages 'graphviz-dot-mode)
;; (add-to-list 'package-selected-packages 'greader)
(add-to-list 'package-selected-packages 'gxref)
(add-to-list 'package-selected-packages 'helpful)
(add-to-list 'package-selected-packages 'helm)
(add-to-list 'package-selected-packages 'helm-bibtex)
(add-to-list 'package-selected-packages 'highlight-defined)
(add-to-list 'package-selected-packages 'hydra)
;;(add-to-list 'package-selected-packages 'hyperdrive)
;; (add-to-list 'package-selected-packages 'highlight-parentheses)
(add-to-list 'package-selected-packages 'hyperbole)
(add-to-list 'package-selected-packages 'iedit)
(add-to-list 'package-selected-packages 'impatient-mode)
;; (add-to-list 'package-selected-packages 'jedi)
;; (add-to-list 'package-selected-packages 'jedi-core)
(add-to-list 'package-selected-packages 'ivy)
(add-to-list 'package-selected-packages 'ivy-prescient)
(add-to-list 'package-selected-packages 'ivy-rich)
(add-to-list 'package-selected-packages 'jupyter)
(add-to-list 'package-selected-packages 'julia-snail)
(add-to-list 'package-selected-packages 'kind-icon)
(add-to-list 'package-selected-packages 'languagetool)
(add-to-list 'package-selected-packages 'latex-preview-pane)
(add-to-list 'package-selected-packages 'lsp-mode)
(add-to-list 'package-selected-packages 'lsp-pyright)
(add-to-list 'package-selected-packages 'lsp-ui)
(add-to-list 'package-selected-packages 'lsp-treemacs)
(add-to-list 'package-selected-packages 'magit)
(add-to-list 'package-selected-packages 'magit-commit)
(add-to-list 'package-selected-packages 'major-mode-hydra)
(add-to-list 'package-selected-packages 'marginalia)
(add-to-list 'package-selected-packages 'markdown-mode)
;; (add-to-list 'package-selected-packages 'markdown-preview-eww)
;; (add-to-list 'package-selected-packages 'markdown-preview-mode)
;; (add-to-list 'package-selected-packages 'material-theme)
(add-to-list 'package-selected-packages 'maxframe)
(add-to-list 'package-selected-packages 'mermaid-mode)
(add-to-list 'package-selected-packages 'move-text)
;; (add-to-list 'package-selected-packages 'mu4e-alert)
;; (add-to-list 'package-selected-packages 'mu4e-views)
(add-to-list 'package-selected-packages 'multiple-cursors)
(add-to-list 'package-selected-packages 'mw-thesaurus)
(add-to-list 'package-selected-packages 'my-hydras)
(add-to-list 'package-selected-packages 'my-uniteai)
(add-to-list 'package-selected-packages 'nov)
;; (add-to-list 'package-selected-packages 'ob-diagrams)
;; (add-to-list 'package-selected-packages 'ob-ess-julia)
;; (add-to-list 'package-selected-packages 'ob-ipython)
;; (add-to-list 'package-selected-packages 'ob-mermaid)
(add-to-list 'package-selected-packages 'ob-julia-vterm)
;;(add-to-list 'package-selected-packages 'openai)
(add-to-list 'package-selected-packages 'orderless)
;; (add-to-list 'package-selected-packages 'org-babel-eval-in-repl)
(add-to-list 'package-selected-packages 'org-bookmark-heading)
;; (add-to-list 'package-selected-packages 'org-bullets)
(add-to-list 'package-selected-packages 'org-drill)
;; (add-to-list 'package-selected-packages 'org-evil)
(add-to-list 'package-selected-packages 'org-inline-pdf)
;; (add-to-list 'package-selected-packages 'org-latex-impatient)
;; (add-to-list 'package-selected-packages 'org-msg)
(add-to-list 'package-selected-packages 'org-noter)
(add-to-list 'package-selected-packages 'org-noter-pdftools)
(add-to-list 'package-selected-packages 'org-pdftools)
;; (add-to-list 'package-selected-packages 'org-plus-contrib)
(add-to-list 'package-selected-packages 'org-pomodoro)
(add-to-list 'package-selected-packages 'org-preview-html)
;; (add-to-list 'package-selected-packages 'org-ql)
(add-to-list 'package-selected-packages 'org-ref)
(add-to-list 'package-selected-packages 'org-reveal)
(add-to-list 'package-selected-packages 'org-re-reveal)
(add-to-list 'package-selected-packages 'org-roam)
(add-to-list 'package-selected-packages 'org-roam-bibtex)
(add-to-list 'package-selected-packages 'org-roam-timestamps)
(add-to-list 'package-selected-packages 'org-roam-ui)
(add-to-list 'package-selected-packages 'org-similarity)
(add-to-list 'package-selected-packages 'org-wc)
(add-to-list 'package-selected-packages 'org2blog)
;; (add-to-list 'package-selected-packages 'orgtbl-ascii-plot)
;; (add-to-list 'package-selected-packages 'ox-latex-subfigure)
(add-to-list 'package-selected-packages 'ox-pandoc)
;; (add-to-list 'package-selected-packages 'package-utils)
(add-to-list 'package-selected-packages 'page-break-lines)
(add-to-list 'package-selected-packages 'paredit)
(add-to-list 'package-selected-packages 'parent-mode)
(add-to-list 'package-selected-packages 'pdb-mode)
(add-to-list 'package-selected-packages 'pdf-tools)
;; (add-to-list 'package-selected-packages 'plantuml-mode)
(add-to-list 'package-selected-packages 'poly-markdown)
(add-to-list 'package-selected-packages 'polymode)
;; (add-to-list 'package-selected-packages 'poly-org)
(add-to-list 'package-selected-packages 'poly-R)
;; (add-to-list 'package-selected-packages 'pomodoro)
(add-to-list 'package-selected-packages 'popup)
(add-to-list 'package-selected-packages 'powerline)
;; (add-to-list 'package-selected-packages 'powerline-evil)
(add-to-list 'package-selected-packages 'powershell)
(add-to-list 'package-selected-packages 'prescient)
(add-to-list 'package-selected-packages 'pretty-hydra)
(add-to-list 'package-selected-packages 'projectile)
(add-to-list 'package-selected-packages 'pyvenv-auto)
;; (add-to-list 'package-selected-packages 'pydoc)
;; (add-to-list 'package-selected-packages 'python-pytest)
(add-to-list 'package-selected-packages 'qclj)
(add-to-list 'package-selected-packages 'qemacs)
;; (add-to-list 'package-selected-packages 'qvoice)
(add-to-list 'package-selected-packages 'qtalonvoice)
(add-to-list 'package-selected-packages 'quelpa)
(add-to-list 'package-selected-packages 'quelpa-use-package)
(add-to-list 'package-selected-packages 'query-replace-parallel)
;;(add-to-list 'package-selected-packages 'racket-mode)
(add-to-list 'package-selected-packages 'rainbow-delimiters)
(add-to-list 'package-selected-packages 'repl-driven-development)
;; (add-to-list 'package-selected-packages 'rtags)
(add-to-list 'package-selected-packages 'selcand)
(add-to-list 'package-selected-packages 'simple-httpd)
;;(add-to-list 'package-selected-packages 'slime)
;;(add-to-list 'package-selected-packages 'sound-wav)
(add-to-list 'package-selected-packages 'ssh)
(add-to-list 'package-selected-packages 'serenade-mode)
;; (add-to-list 'package-selected-packages 'stan-mode)
;; (add-to-list 'package-selected-packages 'stan-snippets)
;; (add-to-list 'package-selected-packages 'standoff-mode)
(add-to-list 'package-selected-packages 'swiper)
;; (add-to-list 'package-selected-packages 'sx)
(add-to-list 'package-selected-packages 'tabnine)
(add-to-list 'package-selected-packages 'tempel)
(add-to-list 'package-selected-packages 'tempel-collection)
;; (add-to-list 'package-selected-packages 'treemacs)
;; (add-to-list 'package-selected-packages 'treemacs-evil)
;; (add-to-list 'package-selected-packages 'treemacs-icons-dired)
;; (add-to-list 'package-selected-packages 'treemacs-magit)
;; (add-to-list 'package-selected-packages 'treemacs-persp)
;; (add-to-list 'package-selected-packages 'treemacs-projectile)
;;(add-to-list 'package-selected-packages 'transient)
(add-to-list 'package-selected-packages 'tree-sitter-ispell)
(add-to-list 'package-selected-packages 'tree-sitter-ess-r)
(add-to-list 'package-selected-packages 'tree-sitter-mode)
(add-to-list 'package-selected-packages 'tree-sitter-langs)
(add-to-list 'package-selected-packages 'vertico)
(add-to-list 'package-selected-packages 'vertico-prescient)
;; (add-to-list 'package-selected-packages 'vertico-repeat)
;; (add-to-list 'package-selected-packages 'try)
;; (add-to-list 'package-selected-packages 'use-package)
;; (add-to-list 'package-selected-packages 'wc-mode)
;; (add-to-list 'package-selected-packages 'web)
(add-to-list 'package-selected-packages 'which-key)
(add-to-list 'package-selected-packages 'whisper)
;; (add-to-list 'package-selected-packages 'wttrin)
;; (add-to-list 'package-selected-packages 'xelb)
;; (add-to-list 'package-selected-packages 'xwidgets-reuse)
;; (add-to-list 'package-selected-packages 'xwwp-follow-link-ivy)
(add-to-list 'package-selected-packages 'yasnippet)
;; (Add-to-list 'package-selected-packages 'yasnippet-classic-snippets)
;; (add-to-list 'package-selected-packages 'yasnippet-snippets)
;; (add-to-list 'package-selected-packages 'ztree)
(add-to-list 'package-selected-packages 'zetteldesk)
(add-to-list 'package-selected-packages 'zetteldesk-kb)
(package-install-selected-packages)
(message "Installing missing packages. Take 4-5 minutes when all are missing.")
;; garbage collection
(use-package gcmh
:diminish gcmh-mode
:config
(setq gcmh-idle-delay 5
gcmh-high-cons-threshold (* 16 1024 1024)) ; 16mb
(gcmh-mode 1))
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-percentage 0.1))) ;; Default value for `gc-cons-percentage'
(add-hook 'emacs-startup-hook
(lambda ()
(message "Emacs ready in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done)))
;; ############################## save current init.el to ~/.saves ####################
;; source https://www.reddit.com/r/emacs/comments/11ap924/the_most_important_snippet_in_my_emacs_init_file/
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.emacs30InitSaves")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
;; ############################## Basics Configuration ################################
;; ==> adjust here
;;(setq openai-key "[]")
;;(setq openai-api-key "")
(setq inhibit-startup-message t) ;; hide the startup message
;; (load-theme 'material t) ;; load material theme
;; (global-linum-mode t) ;; enable line numbers globally
(set-default 'truncate-lines t) ;; do not wrap
(prefer-coding-system 'utf-8) ;; use UTF-8
;;l oad prefers the newest version of a file.
;; This applies when a filename suffix is not explicitly specified and load is trying various possible suffixes (see load-suffixes and load-file-rep-suffixes). Normally, it stops at the first file that exists unless you explicitly specify one or the other. If this option is non-nil, it checks all suffixes and uses whichever file is newest.
;; (setq load-prefer-newer t) --> causes RECURSIVE LOAD error
;; Zoom
(set-face-attribute 'default nil :height 128)
;; Save History
(savehist-mode +1)
(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
;; Size of the starting Window
(setq initial-frame-alist '((top . 1)
(left . 450)
(width . 101)
(height . 90)))
;; Line wrap
(global-visual-line-mode +1)
(delete-selection-mode +1)
(save-place-mode +1)
;; set browser to open url in new tab
(custom-set-variables
'(browse-url-browser-function (quote browse-url-firefox))
'(browse-url-firefox-new-window-is-tab t))
;; Inspried https://sachachua.com/dotemacs/index.html#org4dd39d0
(defun reload-init ()
"Reload my init.el file. Edit the path to suite your needs."
(interactive)
(load-file "~/emacs30/init.el"))
(defun reload-hydras ()
"Reload my-hydras.el. Edit the path to suite your needs."
(interactive)
(load-file "~/emacs30/my-hydras/my-hydras.el"))
(defun reload-uniteai ()
"Reload my-uniteai.el. Edit the path to suite your needs."
(interactive)
(load-file "~/emacs30/my-uniteai.el"))
;; ==> adjust here
;;### Shell configuration
(use-package exec-path-from-shell
:init
(setenv "SHELL" "/opt/local/bin/bash")
:if (memq window-system '(mac ns x))
:config
(setq exec-path-from-shell-variables '("PATH" "GOPATH" "PYTHONPATH"))
(exec-path-from-shell-initialize))
;;### Faked full screen
;; (use-package maxframe
;; (defvar my-fullscreen-p t "Check if fullscreen is on or off")
;; (defun my-toggle-fullscreen ()
;; (interactive)
;; (setq my-fullscreen-p (not my-fullscreen-p))
;; (if my-fullscreen-p
;; (restore-frame)
;; (maximize-frame)))
;; ;; (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) ;; conflicts with an auctex command to insert an \item in a list.
;;### Backups
(setq vc-make-backup-files t)
(setq version-control t ;; Use version numbers for backups.
kept-new-versions 10 ;; Number of newest versions to keep.
kept-old-versions 0 ;; Number of oldest versions to keep.
delete-old-versions t ;; Don't ask to delete excess backup versions.
backup-by-copying t) ;; Copy all files, don't rename them.
;; If you want to avoid 'backup-by-copying', you can instead use
;;
;; (setq backup-by-copying-when-linked t)
;;
;; but that makes the second, "per save" backup below not run, since
;; buffers with no backing file on disk are not backed up, and
;; renaming removes the backing file. The "per session" backup will
;; happen in any case, you'll just have less consistent numbering of
;; per-save backups (i.e. only the second and subsequent save will
;; result in per-save backups).
;; If you want to avoid backing up some files, e.g. large files,
;; then try setting 'backup-enable-predicate'. You'll want to
;; extend 'normal-backup-enable-predicate', which already avoids
;; things like backing up files in '/tmp'.
;; Default and per-save backups go here:
(setq backup-directory-alist '(("" . "~/emacs30/backup/per-save")))
(defun force-backup-of-buffer ()
;; Make a special "per session" backup at the first save of each
;; emacs session.
(when (not buffer-backed-up)
;; Override the default parameters for per-session backups.
(let ((backup-directory-alist '(("" . "~/emacs30/backup/per-session")))
(kept-new-versions 3))
(backup-buffer)))
;; Make a "per save" backup on each save. The first save results in
;; both a per-session and a per-save backup, to keep the numbering
;; of per-save backups consistent.
(let ((buffer-backed-up nil))
(backup-buffer)))
(add-hook 'before-save-hook 'force-backup-of-buffer)
;; Do not move the current file while creating backup.
(setq backup-by-copying t)
;; Disable lockfiles.
(setq create-lockfiles nil)
(column-number-mode)
;; Show stray whitespace.
(setq-default show-trailing-whitespace t)
(setq-default indicate-empty-lines t)
(setq-default indicate-buffer-boundaries 'left)
;; Add a newline automatically at the end of a file while saving.
(setq-default require-final-newline t)
;; A single space follows the end of sentence.
(setq sentence-end-double-space nil)
;;### Turn on font-locking or syntax highlighting
(global-font-lock-mode t)
;;### font size in the modeline
(set-face-attribute 'mode-line nil :height 140)
;; set default coding of buffers
(setq default-buffer-file-coding-system 'utf-8-unix)
;; Switch from tabs to spaces for indentation
;; Set the indentation level to 4.
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;; Indentation setting for various languages.
(setq c-basic-offset 4)
(setq js-indent-level 2)
(setq css-indent-offset 2)
(setq python-basic-offset 4)
(setq user-init-file "/Users/blaine/emacs30/init.el")
(setq user-emacs-directory "/Users/blaine/emacs30/")
(setq default-directory "/Users/blaine")
(setenv "HOME" "/Users/blaine")
;; (load user-init-file)
;; Write customizations to a separate file instead of this file.
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file t)
;; Custom command.
(defun show-current-time ()
"Show current time."
(interactive)
(message (current-time-string)))
;; Custom key sequences.
;; (global-set-key (kbd "C-c t") 'show-current-time)
(global-set-key (kbd "C-c d") 'delete-trailing-whitespace)
;; display line numbers. Need with s-l.
(global-display-line-numbers-mode)
;;### hippie-expand M-/. Seems to be comflicting with Corfu, Cape, and dabrrev.
;; (global-set-key [remap dabbrev-expand] 'hippie-expand)
;; GUI related settings
(if (display-graphic-p)
(progn
;; Removed some UI elements
;; (menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;; Show battery status
(display-battery-mode 1)))
;; Hey, stop being a whimp and learn the Emacs keybindings!
;; ;; Set copy+paste
;; (cua-mode t)
;; (setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
;; (transient-mark-mode 1) ;; No region when it is not highlighted
;; (setq cua-keep-region-after-copy t) ;; Standard Windows behaviour
;; REMOVE THE SCRATCH BUFFER AT STARTUP
;; Makes *scratch* empty.
;; (setq initial-scratch-message "")
;; Removes *scratch* from buffer after the mode has been set.
;; (defun remove-scratch-buffer ()
;; (if (get-buffer "*scratch*")
;; (kill-buffer "*scratch*")))
;; (add-hook 'after-change-major-mode-hook 'remove-scratch-buffer)
;; Disable the C-z sleep/suspend key
;; See http://stackoverflow.com/questions/28202546/hitting-ctrl-z-in-emacs-freezes-everything
(global-unset-key (kbd "C-z"))
;; Disable the C-x C-b key, use helm (C-x b) instead
(global-unset-key (kbd "C-x C-b"))
;; Make copy and paste use the same clipboard as emacs.
(setq select-enable-primary t
select-enable-clipboard t)
(setq display-time-default-load-average nil)
(setq display-time-day-and-date t display-time-24hr-format t)
(display-time-mode t)
;; dired-icon-mode
(add-hook 'dired-mode-hook 'dired-icon-mode)
;; replace dired with dirvish
(dirvish-override-dired-mode)
;; Revert Dired and other buffers after changes to files in directories on disk.
;; Source: [[https://www.youtube.com/watch?v=51eSeqcaikM&list=PLEoMzSkcN8oNmd98m_6FoaJseUsa6QGm2&index=2][Dave Wilson]]
(setq global-auto-revert-non-file-buffers t)
;; customize powerline
;; (line above the command line at the bottom of the screen)
(use-package powerline)
(powerline-default-theme)
;; Add line numbers.
;; (global-nlinum-mode t)
;; highlight current line
(global-hl-line-mode +1)
(set-face-background hl-line-face "wheat1")
(set-face-attribute 'mode-line nil :height 180)
;; List recently opened files.
;; Recent files
(recentf-mode 1)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
;; UTF-8
(set-language-environment "UTF-8")
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8-unix)
(set-terminal-coding-system 'utf-8-unix)
;; Quickly access dot emacs d
(global-set-key (kbd "C-c e")
(lambda()
(interactive)
(find-file "~/emacs30/init.el")))
(set-face-attribute 'default nil :height 140)
(set-frame-parameter (selected-frame) 'buffer-predicate
(lambda (buf)
(let ((name (buffer-name buf)))
(not (or (string-prefix-p "*" name)
(eq 'dired-mode (buffer-local-value 'major-mode buf)))))))
;; Global keys
;; If you use a window manager be careful of possible key binding clashes
(setq recenter-positions '(top middle bottom))
(global-set-key (kbd "C-1") 'kill-this-buffer)
(global-set-key (kbd "C-<down>") (kbd "C-u 1 C-v"))
(global-set-key (kbd "C-<up>") (kbd "C-u 1 M-v"))
(global-set-key [C-tab] 'other-window)
(global-set-key (kbd "C-c c") 'calendar)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "C-`") 'mode-line-other-buffer)
;; (global-set-key (kbd "M-/") #'hippie-expand)
(global-set-key (kbd "C-x C-j") 'dired-jump)
(global-set-key (kbd "C-c r") 'remember)
(setq case-fold-search t)
;; Show the file path in the title of the frame
;; source https://stackoverflow.com/questions/2903426/display-path-of-file-in-status-bar See entry by mortnene
;; This is much more useful than just showing the file name or buffer name in the frame title.
(setq frame-title-format
'(:eval
(if buffer-file-name
(replace-regexp-in-string
"\\\\" "/"
(replace-regexp-in-string
(regexp-quote (getenv "HOME")) "~"
(convert-standard-filename buffer-file-name)))
(buffer-name))))
;; Browse URLS in text mode
(global-goto-address-mode +1)
;; Revert buffers when the underlying file has changed.
(global-auto-revert-mode 1)
;; Save history going back 25 commands.
;; Use M-p to get previous command used in the minibuffer.
;; Use M-n to move to next command.
(setq history-length 25)
(savehist-mode 1)
;; Save place in a file.
(save-place-mode 1)
;; sets monday to be the first day of the week in calendar
(setq calendar-week-start-day 1)
;; save emacs backups in a different directory
;; (some build-systems build automatically all files with a prefix, and .#something.someending breakes that)
(setq backup-directory-alist '(("." . "~/.emacsbackups")))
;; Enable show-paren-mode (to visualize paranthesis) and make it possible to delete things we have marked
(show-paren-mode 1)
(delete-selection-mode 1)
;; use y or n instead of yes or no
(defalias 'yes-or-no-p 'y-or-n-p)
;; These settings enables using the same configuration file on multiple platforms.
;; Note that windows-nt includes [[https://www.gnu.org/software/emacs/manual/html_node/elisp/System-Environment.html][windows 10]].
(defconst *is-a-mac* (eq system-type 'darwin))
(defconst *is-a-linux* (eq system-type 'gnu/linux))
(defconst *is-windows* (eq system-type 'windows-nt))
(defconst *is-cygwin* (eq system-type 'cygwin))
(defconst *is-unix* (not *is-windows*))
;; ==> adjust here
;; See this [[http://ergoemacs.org/emacs/emacs_hyper_super_keys.html][ for more information.]]
;; set keys for Apple keyboard, for emacs in OS X
;; Source http://xahlee.info/emacs/emacs/emacs_hyper_super_keys.html
(setq mac-command-modifier 'meta) ; make cmd key do Meta
(setq mac-option-modifier 'super) ; make option key do Super.
(setq mac-control-modifier 'control) ; make Control key do Control
(setq mac-function-modifier 'hyper) ; make Fn key do Hyper. Only works on Apple produced keyboards.
(setq mac-right-command-modifier 'hyper)
;; Switch to previous buffer
(define-key global-map (kbd "s-<left>") 'previous-buffer)
;; Switch to next buffer
(define-key global-map (kbd "s-<right>") 'next-buffer)
;; Minibuffer history keybindings
;; The calling up of a previously issued command in the minibuffer with ~M-p~ saves times.
(autoload 'edit-server-maybe-dehtmlize-buffer "edit-server-htmlize" "edit-server-htmlize" t)
(autoload 'edit-server-maybe-htmlize-buffer "edit-server-htmlize" "edit-server-htmlize" t)
(add-hook 'edit-server-start-hook 'edit-server-maybe-dehtmlize-buffer)
(add-hook 'edit-server-done-hook 'edit-server-maybe-htmlize-buffer)
(define-key minibuffer-local-map (kbd "M-p") 'previous-complete-history-element)
(define-key minibuffer-local-map (kbd "M-n") 'next-complete-history-element)
(define-key minibuffer-local-map (kbd "<up>") 'previous-complete-history-element)
(define-key minibuffer-local-map (kbd "<down>") 'next-complete-history-element)
(defun switch-to-minibuffer ()
"Switch to minibuffer window."
(interactive)
(if (active-minibuffer-window)
(select-window (active-minibuffer-window))
(error "Minibuffer is not active")))
(global-set-key "\C-cm" 'switch-to-minibuffer) ;; Bind to `C-c m' for minibuffer.
;; Bibtex configuration
(defconst blaine/bib-libraries (list "/Users/blaine/Documents/global.bib"))
;; Combined with emacs-mac, this gives good PDF quality for [[https://www.aidanscannell.com/post/setting-up-an-emacs-playground-on-mac/][retina display]].
(setq pdf-view-use-scaling t)
;; PDF default page width behavior
(setq-default pdf-view-display-size 'fit-page)
;; Set delay in the matching parenthesis to zero.
(setq show-paren-delay 0)
(show-paren-mode t)
;; **** Window management
;; ***** winner-mode C-c <rigth> undo change C-c <left> redo change
(winner-mode 1)
(defun split-vertical-evenly ()
(interactive)
(command-execute 'split-window-vertically)
(command-execute 'balance-windows))
(global-set-key (kbd "C-x 2") 'split-vertical-evenly)
(defun split-horizontal-evenly ()
(interactive)
(command-execute 'split-window-horizontally)
(command-execute 'balance-windows))
(global-set-key (kbd "C-x 3") 'split-horizontal-evenly)
(message "Starting config of packages--takes 5-60 seconds, depending on the operating system.")
;;*** Zoom in and out via C-scroll wheel
(global-set-key [C-wheel-up] 'text-scale-increase)
(global-set-key [C-wheel-down] 'text-scale-decrease)
;; ############################## aliases ################################
;; Source: https://www.youtube.com/watch?v=ufVldIrUOBg
;; Defalias: a quick guide to making an alias in Emacs
;; Usage: M-x ct
(defalias 'ct 'customize-themes)
(defalias 'cz 'customize)
(defalias 'ddl 'delete-duplicate-lines)
(defalias 'dga 'define-global-abbrev)
(defalias 'dma 'define-mode-abbrev)
(defalias 'ea 'edit-abbrevs)
(defalias 'ff 'flip-frame)
(defalias 'fl 'flush-lines)
(defalias 'fnd 'find-name-dired)
(defalias 'klm 'kill-matching-lines)
(defalias 'lc 'langtool-check)
(defalias 'lcu 'langtool-check-buffer)
(defalias 'lp 'list-packages)
(defalias 'pcr 'package-refresh-contents)
(defalias 'pi 'package-install)
(defalias 'pua 'package-upgrade-all)
(defalias 'qr 'query-replace)
(defalias 'rg 'rgrep)
(defalias 'rsv 'replace-smart-quotes)
(defalias 'sl 'sort-lines)
(defalias 'slo 'single-lines-only)
(defalias 'spe 'ispell-region)
(defalias 'udd 'package-upgrade-all)
(defalias 'ugg 'package-upgrade-all)
(defalias 'wr 'write-region)
;; ############################## Package Configurations ################################
;;** A
;;*** ack
(use-package ack)
(use-package ack-menu)
;;*** affe
(use-package affe
:config
;; Manual preview key for `affe-grep'
(consult-customize affe-grep :preview-key "M-."))
;; -*- lexical-binding: t -*-
(defun affe-orderless-regexp-compiler (input _type _ignorecase)
(setq input (orderless-pattern-compiler input))
(cons input (lambda (str) (orderless--highlight input str))))
(setq affe-regexp-compiler #'affe-orderless-regexp-compiler)
;;*** auto-activating-snippets
;;**** latex-auto-activating-snippets
;; source: https://github.com/tecosaur/LaTeX-auto-activating-snippets
(use-package laas
:hook (LaTeX-mode . laas-mode)
:config ; do whatever here
(aas-set-snippets 'laas-mode
;; set condition!
:cond #'texmathp ; expand only while in math
"supp" "\\supp"
"On" "O(n)"
"O1" "O(1)"
"Olog" "O(\\log n)"
"Olon" "O(n \\log n)"
;; bind to functions!
"Sum" (lambda () (interactive)
(yas-expand-snippet "\\sum_{$1}^{$2} $0"))
"jf" (lambda () (interactive)
(yas-expand-snippet "\\\\( $1 \\\\) $0"))
"Span" (lambda () (interactive)
(yas-expand-snippet "\\Span($1)$0"))
;; add accent snippets
:cond #'laas-object-on-left-condition
"qq" (lambda () (interactive) (laas-wrap-previous-object "sqrt"))))
(use-package corfu
:init
(global-corfu-mode)
:config
(setq corfu-auto t
corfu-echo-documentation t
corfu-scroll-margin 0
corfu-count 8
corfu-max-width 50
corfu-min-width corfu-max-width
corfu-auto-prefix 2)
(corfu-history-mode 1)
(savehist-mode 1)
(add-to-list 'savehist-additional-variables 'corfu-history)
(defun corfu-enable-always-in-minibuffer ()
(setq-local corfu-auto nil)
(corfu-mode 1))
(add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
;;
;; (:map corfu-map
;; ("TAB" . corfu-next)
;; ([tab] . corfu-next)
;; ("S-TAB" . corfu-previous)
;; ([backtab] . corfu-previous)
;; ("C-n" . corfu-next)
;; ("C-p" . corfu-previous)
;; ("C-j" . corfu-next)
;; ("C-k" . corfu-previous)
;; ("RET" . corfu-complete)
;; ([escape] . corfu-quit))
;; :bind (:map corfu-map
;; ("M-SPC" . corfu-insert-separator)
;; ("TAB" . corfu-next)
;; ([tab] . corfu-next)
;; ("S-TAB" . corfu-previous)
;; ([backtab] . corfu-previous)
;; ("C-n" . corfu-next)
;; ("C-p" . corfu-previous)
;; ("C-j" . corfu-next)
;; ("C-k" . corfu-previous)
;; ("S-<return>" . corfu-insert)
;; ("RET" . nil))
)
(use-package cape
:init
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-keyword)
;; kinda confusing re length, WIP/TODO
;; :hook (org-mode . (lambda () (add-to-list 'completion-at-point-functions #'cape-dabbrev)))
;; :config
;; (setq dabbrev-check-other-buffers nil
;; dabbrev-check-all-buffers nil
;; cape-dabbrev-min-length 6)
)
(use-package kind-icon
:config
(setq kind-icon-default-face 'corfu-default)
(setq kind-icon-default-style '(:padding 0 :stroke 0 :margin 0 :radius 0 :height 0.9 :scale 1))
(setq kind-icon-blend-frac 0.08)
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)
(add-hook 'counsel-load-theme #'(lambda () (interactive) (kind-icon-reset-cache)))
(add-hook 'load-theme #'(lambda () (interactive) (kind-icon-reset-cache))))
;; (use-package corfu
;; ;; Optional customizations