-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot.emacs
More file actions
849 lines (770 loc) · 37.7 KB
/
Copy pathdot.emacs
File metadata and controls
849 lines (770 loc) · 37.7 KB
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
;;; -*- mode: emacs-lisp -*-
;;; Evan Moses .emacs
;;; Feel free to copy
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;;(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(connection-local-criteria-alist
'(((:machine "newerheart") newerheart-vars)
((:application tramp :protocol "kubernetes") tramp-kubernetes-connection-local-default-profile)
((:application tramp :machine "Mac.fortytwo.local") tramp-connection-local-darwin-ps-profile)
((:application tramp :machine "Computery.local") tramp-connection-local-darwin-ps-profile)
((:application tramp :machine "FK00M29L63") tramp-connection-local-darwin-ps-profile)
((:application eshell) eshell-connection-default-profile)
((:application tramp :machine "localhost") tramp-connection-local-darwin-ps-profile)
((:application tramp :machine "C02DR5M6MD6T") tramp-connection-local-darwin-ps-profile)
((:application tramp) tramp-connection-local-default-system-profile tramp-connection-local-default-shell-profile)))
'(connection-local-profile-alist
'((newerheart-vars (company-gtags--executable-connection))
(tramp-kubernetes-connection-local-default-profile (tramp-config-check . tramp-kubernetes--current-context-data)
(tramp-extra-expand-args 97
(tramp-kubernetes--container
(car tramp-current-connection))
104
(tramp-kubernetes--pod
(car tramp-current-connection))
120
(tramp-kubernetes--context-namespace
(car tramp-current-connection))))
(eshell-connection-default-profile (eshell-path-env-list))
(tramp-connection-local-darwin-ps-profile
(tramp-process-attributes-ps-args "-acxww" "-o"
"pid,uid,user,gid,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"-o" "state=abcde" "-o"
"ppid,pgid,sess,tty,tpgid,minflt,majflt,time,pri,nice,vsz,rss,etime,pcpu,pmem,args")
(tramp-process-attributes-ps-format (pid . number) (euid . number) (user . string) (egid . number) (comm . 52)
(state . 5) (ppid . number) (pgrp . number) (sess . number) (ttname . string)
(tpgid . number) (minflt . number) (majflt . number) (time . tramp-ps-time)
(pri . number) (nice . number) (vsize . number) (rss . number)
(etime . tramp-ps-time) (pcpu . number) (pmem . number) (args)))
(tramp-connection-local-busybox-ps-profile
(tramp-process-attributes-ps-args "-o" "pid,user,group,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"-o" "stat=abcde" "-o" "ppid,pgid,tty,time,nice,etime,args")
(tramp-process-attributes-ps-format (pid . number) (user . string) (group . string) (comm . 52) (state . 5)
(ppid . number) (pgrp . number) (ttname . string) (time . tramp-ps-time)
(nice . number) (etime . tramp-ps-time) (args)))
(tramp-connection-local-bsd-ps-profile
(tramp-process-attributes-ps-args "-acxww" "-o"
"pid,euid,user,egid,egroup,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"-o"
"state,ppid,pgid,sid,tty,tpgid,minflt,majflt,time,pri,nice,vsz,rss,etimes,pcpu,pmem,args")
(tramp-process-attributes-ps-format (pid . number) (euid . number) (user . string) (egid . number)
(group . string) (comm . 52) (state . string) (ppid . number) (pgrp . number)
(sess . number) (ttname . string) (tpgid . number) (minflt . number)
(majflt . number) (time . tramp-ps-time) (pri . number) (nice . number)
(vsize . number) (rss . number) (etime . number) (pcpu . number)
(pmem . number) (args)))
(tramp-connection-local-default-shell-profile (shell-file-name . "/bin/sh") (shell-command-switch . "-c"))
(tramp-connection-local-default-system-profile (path-separator . ":") (null-device . "/dev/null"))))
'(custom-safe-themes
'("6fc9e40b4375d9d8d0d9521505849ab4d04220ed470db0b78b700230da0a86c1"
"0b98215401d426a6514f0842193272844002ca70e56b3519ea8fcd0a17f0d0de"
"8b9d07b01f2a9566969c2049faf982cab6a4b483dd43de7fd6a016bb861f7762"
"06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a"
"b9e9ba5aeedcc5ba8be99f1cc9301f6679912910ff92fdf7980929c2fc83ab4d"
"84d2f9eeb3f82d619ca4bfffe5f157282f4779732f48a5ac1484d94d5ff5b279"
"3380a2766cf0590d50d6366c5a91e976bdc3c413df963a0ab9952314b4577299"
"4cdea318a3efab7ff7c832daea05f6b2d5d0a18b9bfa79763b674e860ecbc6da"
"3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa"
"75c0b1d2528f1bce72f53344939da57e290aa34bea79f3a1ee19d6808cb55149"
"a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e"
"8022cea21aa4daca569aee5c1b875fbb3f3248a5debc6fc8cf5833f2936fbb22"
"a0fdc9976885513b03b000b57ddde04621d94c3a08f3042d1f6e2dbc336d25c7"
"8db4b03b9ae654d4a57804286eb3e332725c84d7cdab38463cb6b97d5762ad26"
"a8245b7cc985a0610d71f9852e9f2767ad1b852c2bdea6f4aadc12cce9c4d6d0"
"9dae95cdbed1505d45322ef8b5aa90ccb6cb59e0ff26fef0b8f411dfc416c552"
"cdc7555f0b34ed32eb510be295b6b967526dd8060e5d04ff0dce719af789f8e5"
"6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f"
"756597b162f1be60a12dbd52bab71d40d6a2845a3e3c2584c6573ee9c332a66e" default))
'(evil-overriding-maps
'((Buffer-menu-mode-map) (color-theme-mode-map) (comint-mode-map) (compilation-mode-map) (grep-mode-map)
(dictionary-mode-map) (ert-results-mode-map . motion) (Info-mode-map . motion) (speedbar-key-map)
(speedbar-file-key-map) (speedbar-buffers-key-map) (cider-popup-buffer-mode-map) (cider-stacktrace-mode-map)))
'(fill-column 120)
'(flycheck-disabled-checkers '(emacs-lisp-checkdoc python-pylint))
'(flycheck-global-modes '(not elisp-mode))
'(flycheck-temp-prefix "__flycheck")
'(global-treesit-auto-modes
'(typescript-mode typescript-ts-mode tsx-ts-mode toml-mode conf-toml-mode toml-ts-mode rust-mode rust-ts-mode ruby-mode
ruby-ts-mode ess-mode r-ts-mode python-mode python-ts-mode protobuf-mode protobuf-ts-mode
markdown-mode poly-markdown-mode markdown-ts-mode makefile-mode makefile-ts-mode lua-mode
lua-ts-mode latex-mode latex-ts-mode kotlin-mode kotlin-ts-mode julia-mode julia-ts-mode
js-json-mode json-ts-mode js2-mode javascript-mode js-mode js-ts-mode java-mode java-ts-mode
sgml-mode mhtml-mode html-ts-mode heex-mode heex-ts-mode go-mod-mode go-mod-ts-mode go-mode
go-ts-mode elixir-mode elixir-ts-mode dockerfile-mode dockerfile-ts-mode css-mode css-ts-mode
c++-mode c++-ts-mode common-lisp-mode commonlisp-ts-mode cmake-mode cmake-ts-mode clojure-mode
clojure-ts-mode csharp-mode csharp-ts-mode c-mode c-ts-mode bibtex-mode bibtex-ts-mode sh-mode
bash-ts-mode))
'(isearch-allow-motion t)
'(js2-bounce-indent-flag nil)
'(js2-global-externs '("require" "module"))
'(js2-strict-inconsistent-return-warning nil)
'(lsp-eslint-auto-fix-on-save t)
'(lsp-imenu-sort-methods '(position kind))
'(lsp-ui-imenu-auto-refresh t)
'(lsp-ui-imenu-buffer-position 'left)
'(lsp-ui-imenu-window-width 60)
'(mac-auto-operator-composition-characters "!\"#$%&'()+,-./:;<=>?@[]^_`{|}~")
'(magit-blame-heading-format "%-20a %C %.10H %s")
'(mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))))
'(native-comp-async-report-warnings-errors 'silent)
'(org-agenda-files nil)
'(org-export-backends '(ascii html icalendar latex md odt))
'(org-log-done 'time)
'(org-modules
'(org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-wl org-w3m org-mouse))
'(org-refile-targets '((org-agenda-files :maxlevel . 3)))
'(package-selected-packages
'(forge origami lsp-python-ms el-patch lsp-ui lsp-mode htmlize emacs-htmlize racket-mode evil-cleverparens
scad-mode neotree eldoc-overlay quelpa-use-package quelpa add-node-modules-path ace-window
evil-collection php-mode dockerfile-mode xterm-color pyenv-mode elpy ace-jump-mode evil-org evil-org-mode
dired+ plantuml-mode graphql-mode org nlinum evil-leader inf-clojure esup groovy-mode yaml-mode win-switch
web-mode typescript-mode smartparens smart-mode-line rainbow-delimiters projectile p4 markdown-mode lua-mode
less-css-mode json-mode js2-mode jade-mode ido-completing-read+ haskell-mode haml-mode google-c-style flx-ido
find-file-in-repository exec-path-from-shell evil-paredit evil-lispy emacs-eclim elm-mode editorconfig
dired-details+ cider base16-theme auto-complete ag ack-and-a-half))
'(projectile-project-root-files
'("rebar.config" "project.clj" "build.boot" "deps.edn" "SConstruct" "pom.xml" "build.sbt" "gradlew" "build.gradle"
".ensime" "Gemfile" "requirements.txt" "setup.py" "tox.ini" "composer.json" "Cargo.toml" "mix.exs" "stack.yaml"
"info.rkt" "DESCRIPTION" "TAGS" "GTAGS" "configure.in" "configure.ac" "cscope.out" "package.json"))
'(safe-local-variable-values
'((rustic-default-test-arguments . "--all-targets") (projectile-go-compile-test-flags . "-tags=testonly")
(lsp-golangci-lint-build-tags quote ("testonly")) (lsp-go-build-flags . ["-tags=testonly"])
(checkdoc-allow-quoting-nil-and-t . t) (lsp-rust-features . ["tpe" "partial-eval"])
(backup-directory-alist ("." . "~/dev/.go.sudo.wtf~/")) (backup-directory-alist ("." . "~/.emacs.d/backup-files/"))
(eval turn-on-auto-fill) (web-mode-engines-alist ("go" . "\\.tpl\\.html")) (lsp-enabled-clients deno-ls)
(org-html-metadata-timestamp-format . "%Y-%m-%d") (my:prettify . t) (lsp-eslint-package-manager . "yarn")
(lsp-eslint-working-directories . ["frontend/"]) (lsp-eslint-package-manager . yarn)
(jest-executable . "yarn utest --") (projectile-indexing-method quote hybrid)
(projectile-project-test-suffix . "_spec.js") (projectile-project-test-suffix . "_spec")
(mocha-command . "node_modules/.bin/mocha")
(mocha-options . "-u bdd --no-timeouts server/lib/testing/bootstrap_js_tests.js")
(mocha-opts-file . "config/mocha/local.opts") (mocha-reporter)
(projectile-project-test-cmd
. "$(npm bin)/mocha -u bdd --no-timeouts --opts config/mocha/local.opts server/lib/testing/bootstrap_js_tests.js")
(lsp-python-ms-python-executable-cmd . "python3") (my:lsp-go-directory-filters . ["-frontend"])
(my:lsp-go-directory-filters quote ("-frontend")) (lsp-nested-project-separator)
(lsp--override-calculate-lisp-indent? . t)
(lsp-go-gopls-server-args "-rpc.trace" "--debug=localhost:6061"
"-logfile=/Users/evanmoses/sev/go/src/github.com/ScaleFT/device-tools/gopls.log")
(lsp-go-gopls-server-args "-rpc.trace" "--debug=localhost:6060"
"-logfile=/Users/evanmoses/dev/go/src/go.sudo.wtf/gopls.log")
(lsp-go-gopls-server-args "-rpc.trace" "--debug=localhost:6060")
(flycheck-disabled-checkers quote (emacs-lisp-checkdoc))
(eval set (make-local-variable '-dirlocal-project-path)
(when-let ((d (dir-locals-find-file "."))) (file-name-directory (if (stringp d) d (car d)))))
(eval setq flycheck-golangci-lint-config (concat -dirlocal-project-path ".golangci.yml")) (sql-product . postgres)
(auto-save-file-name-transforms ("." "~/dev/.go.sudo.wtf~/frontend/" t))
(backup-directory-alist ("." . "~/dev/.go.sudo.wtf~/frontend/")) (projectile-indexing-method . hybrid)
(auto-save-file-name-transforms quote (("." "~/dev/.go.sudo.wtf~/frontend" t)))
(backup-directory-alist quote (("." . "~/dev/.go.sudo.wtf~/frontend"))) (jest-executable . "yarn utest")
(checkdoc-package-keywords-flag)
(eval font-lock-add-keywords nil
`
((,(concat "("
(regexp-opt
'("sp-do-move-op" "sp-do-move-cl" "sp-do-put-op" "sp-do-put-cl" "sp-do-del-op" "sp-do-del-cl") t)
"\\_>")
1 'font-lock-variable-name-face)))
(projectile-project-type quote go)
(eval set (make-local-variable 'my-project-path)
(if-let ((root (projectile-project-root))) root
(if-let
((dir-local-root
(file-name-directory (let ((d (dir-locals-find-file "."))) (if (stringp d) d (car d))))))
dir-local-root)
nil))
(eval setq lsp-clients-typescript-server-args
(list "--stdio" "--log-level 3" "--tsserver-log-file /Users/evanmoses/tsserver-log.txt"
(concat "--tsserver-path " (file-name-as-directory my-project-path) "node_modules/.bin/tsserver")))
(eval setq lsp-clients-typescript-server-args
(list "--stdio"
(concat "--tsserver-path " (file-name-as-directory my-project-path) "node_modules/.bin/tsserver")))
(eval setq lsp-clients-typescript-server-args
(list "--stdio" (concat (file-name-as-directory my-project-path) "node_modules/.bin/tsserver")))
(eval setq lsp-clients-typescript-server-args
(list "--stdio"
(concat (file-name-as-directory my-project-path) "node_modules/.bin/tsserver" my-project-path)))
(eval progn
(set (make-local-variable my-project-path)
(file-name-directory (let ((d (dir-locals-find-file "."))) (if (stringp d) d (car d)))))
(let
((tsserver-path
(concat (file-name-as-directory my-project-path) "node_modules/.bin/tsserver" my-project-path)))
(setq lsp-clients-typescript-server-args (list "--stdio" tsserver-path))))
(eval setq (make-local-variable my-project-path)
(file-name-directory (let ((d (dir-locals-find-file "."))) (if (stringp d) d (car d)))))
(eval let
((tsserver-path
(concat (file-name-as-directory my-project-path) "node_modules/.bin/tsserver" my-project-path)))
(setq lsp-clients-typescript-server-args (list "--stdio" tsserver-path)))
(eval set (make-local-variable my-project-path)
(file-name-directory (let ((d (dir-locals-find-file "."))) (if (stringp d) d (car d)))))
(delete-old-versions . t) (backup-by-copying . t) (create-lockfiles) (add-node-modules-path-command "yarn bin")))
'(sml/mode-width (if (eq (powerline-current-separator) 'arrow) 'right 'full))
'(sml/name-width 44)
'(sml/pos-id-separator
'("" (:propertize " " face powerline-active1)
(:eval
(propertize " " 'display
(funcall
(intern
(format "powerline-%s-%s" (powerline-current-separator) (car powerline-default-separator-dir)))
'powerline-active1 'powerline-active2)))
(:propertize " " face powerline-active2)))
'(sml/pos-minor-modes-separator
'("" (:propertize " " face powerline-active1)
(:eval
(propertize " " 'display
(funcall
(intern
(format "powerline-%s-%s" (powerline-current-separator) (cdr powerline-default-separator-dir)))
'powerline-active1 'sml/global)))
(:propertize " " face sml/global)))
'(sml/pre-id-separator
'("" (:propertize " " face sml/global)
(:eval
(propertize " " 'display
(funcall
(intern
(format "powerline-%s-%s" (powerline-current-separator) (car powerline-default-separator-dir)))
'sml/global 'powerline-active1)))
(:propertize " " face powerline-active1)))
'(sml/pre-minor-modes-separator
'("" (:propertize " " face powerline-active2)
(:eval
(propertize " " 'display
(funcall
(intern
(format "powerline-%s-%s" (powerline-current-separator) (cdr powerline-default-separator-dir)))
'powerline-active2 'powerline-active1)))
(:propertize " " face powerline-active1)))
'(sml/pre-modes-separator (propertize " " 'face 'sml/modes))
'(sml/replacer-regexp-list
'(("^~/ownCloud/org" ":Org:") ("^~/\\.emacs\\.d/elpa/" ":ELPA:") ("^~/\\.emacs\\.d/" ":ED:") ("^/sudo:.*:" ":SU:")
("^~/Documents/" ":Doc:") ("^~/Dropbox/" ":DB:") ("^:\\([^:]*\\):Documento?s/" ":\\1/Doc:") ("^~/[Gg]it/" ":Git:")
("^~/[Gg]it[Hh]ub/" ":Git:") ("^~/[Gg]it\\([Hh]ub\\|\\)-?[Pp]rojects/" ":Git:") ("^.*/patreon_py/" ":P_PY:")
("~/dev/patreon/" ":WORK:")))
'(sml/shorten-directory nil)
'(tls-checktrust t)
'(undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo-tree-history")))
'(warning-suppress-types '((copilot copilot-exceeds-max-char)))
'(xref-prompt-for-identifier
'(not xref-find-definitions xref-find-definitions-other-window xref-find-definitions-other-frame xref-find-references)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(aw-leading-char-face ((t (:foreground "red" :height 4.0))))
'(ediff-even-diff-C ((t (:background "light grey" :foreground "black"))))
'(ediff-odd-diff-C ((t (:background "Grey" :foreground "black"))))
'(flycheck-color-mode-line-info-face ((t (:foreground "dim gray"))))
'(flycheck-color-mode-line-success-face ((t (:foreground "dark green"))))
'(fringe ((t (:background "#373b41" :foreground "#586e75"))))
'(highlight ((t (:background "#41444a" :inverse-video nil))))
'(js2-error-face ((((class color) (background dark)) (:foreground "pale turquoise" :weight bold))))
'(line-number-current-line ((t (:background "#969896" :foreground "#3b3e44"))))
'(linum ((t (:background "#282a2e" :foreground "#e0e0e0"))))
'(lsp-ui-sideline-global ((t (:background "medium blue"))))
'(magit-diff-file-heading ((t (:background "selectedTextBackgroundColor" :foreground "selectedTextColor"))) t)
'(magit-diff-file-heading-highlight ((t (:background "selectedContentBackgroundColor" :foreground "selectedTextColor" :weight bold))) t)
'(sml/global ((t (:background "grey85" :foreground "grey20" :inverse-video nil :weight semi-light :height 1.05 :family "Avenir")))))
(defconst my:emacs-base "~/dotfiles/emacs/" "Libraries, and the base for configs")
(defconst my:emacs-config-dir (concat my:emacs-base "configs/") "Place that my:load-config-file will look for configs")
;WTF why does the debugger randomly get turned on?
;; (add-variable-watcher 'debug-on-error (lambda (symbol newval op where)
;; (when newval
;; (debug--implement-debug-watch symbol newval op where))))
(add-to-list 'load-path my:emacs-base)
(add-to-list 'load-path (concat user-emacs-directory "elisp"))
;;Performance tuning (see https://github.com/emacs-lsp/lsp-mode#performance)
(setq gc-cons-threshold (* 100 1024 1024))
(setq read-process-output-max (* 1024 1024))
(setq initial-scratch-message nil)
;; utility finction to auto-load my package configurations
(defun my:load-config-file (filelist)
(dolist (fileOrFn filelist)
(let ((file
(if (functionp fileOrFn)
(funcall fileOrFn)
fileOrFn)))
(when file
(load (expand-file-name
(concat my:emacs-config-dir file)))
(message "Loaded config file:%s" file)))
))
(defconst my:xml-mode 'nxml-mode)
;;Mac-specific changes
(defvar my:osx (eq system-type 'darwin))
(defvar my:windows (eq system-type 'windows-nt))
(defvar my:linux (eq system-type 'gnu/linux))
(when my:osx
(require 'auth-source)
(add-to-list 'auth-sources 'macos-keychain-generic)
(add-to-list 'auth-sources 'macos-keychain-internet))
;;Deal with TLS certs. See https://glyph.twistedmatrix.com/2015/11/editor-malware.html
(let ((trustfile
(replace-regexp-in-string
"\\\\" "/"
(replace-regexp-in-string
"\n" ""
(shell-command-to-string "python -m certifi")))))
(setq tls-program
(list
(format "gnutls-cli%s --x509cafile %s -p %%p %%h"
(if (eq window-system 'w32) ".exe" "") trustfile))))
(my:load-config-file '("package-bootstrap.el"
(lambda () (if my:osx "osx.el" nil))
"secrets.el"
"gh.el"
"org-mode-init.el"
"evil.el"
"faces.el"
"mode-customizations.el"
"hugo-markdown-mode.el"
"javascript.el"
"keys.el"
"misc-fns.el"
"ai.el"
"clojure.el"
"lsp.el"
"python.el"
"present-minor-mode.el"
"go.el"))
(defconst my:LOCAL_CONFIG_PATH (file-name-concat (getenv "HOME") ".local" "emacs"))
(when (file-exists-p my:LOCAL_CONFIG_PATH)
(let ((local-el-files (directory-files my:LOCAL_CONFIG_PATH t "\.elc?$")))
(dolist (local-el local-el-files)
(load local-el)
(message "Loaded local config file: %s" local-el))))
;;Random options
(put 'narrow-to-region 'disabled nil)
(setq create-lockfiles nil)
(setq inhibit-splash-screen t)
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(when (fboundp 'scroll-bar-mode)
(scroll-bar-mode -1))
(setq default-frame-alist
'((width . 250)
(height . 70)))
(setq fill-column 120)
(setq split-width-threshold 200)
(setq help-window-select t)
;;New in Emacs 28
(when (>= emacs-major-version 28)
(setq next-error-message-highlight t)
(setq read-minibuffer-restore-windows nil)
(setq dired-kill-when-opening-new-dired-buffer t)
(setq completions-detailed t))
(setq compilation-scroll-output t)
;;Global mode enablement
(show-paren-mode t)
(savehist-mode t)
(electric-indent-mode t)
;;New stuff for emacs 26
(when (>= emacs-major-version 26)
(if (fboundp 'pixel-scroll-precision-mode)
(pixel-scroll-precision-mode)
(pixel-scroll-mode))
(setq mouse-wheel-tilt-scroll t)
(setq mouse-wheel-flip-direction t)
(setq display-line-numbers-width-start 3)
(setq display-line-numbers-grow-only t)
(global-display-line-numbers-mode t))
(when (< emacs-major-version 26)
(use-package nlinum
:config
(defun my:nlinum-hook-min-lines ()
(when (fboundp 'nlinum-mode)
(let* ((approx-lines (ceiling (log (max 1 (/ (buffer-size) 80)) 10)))
(lineno-width (max 3 approx-lines)))
(setq-local nlinum-format
(concat "%" (number-to-string lineno-width) "d")))))
(add-hook 'nlinum-mode-hook #'my:nlinum-hook-min-lines)
(global-nlinum-mode t)))
(use-package editorconfig
:config
(editorconfig-mode 1))
(use-package projectile
:bind (("C-c C-s" . my:projectile-ag-symbol))
:init
(defvar projectile-go-compile-test-extra-env-vars-alist nil
"a plist of Extra environment variables to set when running Go tests")
(defvar projectile-go-compile-test-flags nil
"test flags to pass to go build when compiling tests")
:config
(setq projectile-switch-project-action #'projectile-find-file-dwim)
(add-to-list 'projectile-globally-ignored-directories "node_modules")
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "A-p") 'projectile-command-map)
(define-key projectile-command-map (kbd "s t") #'my:projectile-ag-test)
(define-key projectile-command-map (kbd "C") #'projectile-go-compile-tests)
(defun my:projectile-test-root ()
(let* ((project-root (projectile-project-root))
(test-dir-name (or (projectile-project-type-attribute (projectile-project-type) 'test-dir) ".")))
(expand-file-name test-dir-name project-root)))
(defun projectile-go-compile-tests ()
(interactive)
(if (not (eq (projectile-project-type) 'go))
(message "Not a go project")
(let ((compilation-read-command nil)
(compile-command (format "go test -run=none %s ./..." (or projectile-go-compile-test-flags "")))
(process-environment (copy-sequence process-environment)))
(dolist (e projectile-go-compile-test-extra-env-vars-alist)
(setenv (car e) (cdr e)))
(projectile--run-project-cmd compile-command nil
:save-buffers t))))
(defun my:projectile-ag-test (search-term &optional arg)
"Run an ag search starting at the test root
Largely a copy-paste of projectile-ag, need to refactor"
(interactive
(list (projectile--read-search-string-with-default
(format "Ag %ssearch tests for" (if current-prefix-arg "regexp " "")))
current-prefix-arg))
(if (require 'ag nil 'noerror)
(let ((ag-ignore-list (delq nil
(delete-dups
(append
ag-ignore-list
(projectile--globally-ignored-file-suffixes-glob)
;; ag supports git ignore files directly
(unless (eq (projectile-project-vcs) 'git)
(append (projectile-ignored-files-rel)
(projectile-ignored-directories-rel)
grep-find-ignored-files
grep-find-ignored-directories
'()))))))
;; reset the prefix arg, otherwise it will affect the ag-command
(current-prefix-arg nil)
;; TODO prefix
(suffix (projectile-test-suffix (projectile-project-type))))
(ag/search search-term (my:projectile-test-root) :regexp arg :file-regex suffix))
(error "Package 'ag' is not available")))
;; WIP, needs to turn into a real glob
(defun my:projectile-ripgrep-test (search-term &optional arg)
"Run a Ripgrep search with `SEARCH-TERM' at current project root.
With an optional prefix argument ARG SEARCH-TERM is interpreted as a
regular expression."
(interactive
(list (projectile--read-search-string-with-default
(format "Ripgrep %ssearch tests for" (if current-prefix-arg "regexp " "")))
current-prefix-arg))
(if (require 'ripgrep nil 'noerror)
(let* ((args (mapcar (lambda (val) (concat "--glob !" val))
(append projectile-globally-ignored-files
projectile-globally-ignored-directories)))
(suffix (projectile-test-suffix (projectile-project-type)))
(args (append args (list (concat "--glob '" suffix "*'")))))
(ripgrep-regexp search-term
(my:projectile-test-root)
(if arg
args
(cons "--fixed-strings" args))))
(error "Package `ripgrep' is not available")))
(defun my:projectile-ag-symbol (search-term &optional arg)
"Run an ag search for symbol at point, or region if active.
With optional prefix ARG, SEARCH-TERM is treated as a regexp"
(interactive
(list
(let ((symbol
(if (use-region-p)
(buffer-substring-no-properties (region-beginning)
(region-end))
(thing-at-point 'symbol))))
(if (and symbol (not current-prefix-arg))
symbol
(projectile--read-search-string-with-default
(format "Search in project for %s: " (if current-prefix-arg "regexp" "string")))))
current-prefix-arg))
(projectile-ag search-term arg)))
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse)
(add-hook 'before-save-hook #'delete-trailing-whitespace)
(use-package flycheck
:bind (:map flycheck-mode-map
("<f6>" . flycheck-next-error)
("S-<f6>" . flycheck-previous-error))
:init
(global-flycheck-mode t)
:config
(add-hook 'flycheck-mode-hook (lambda ()
(when-let ((local-eslint (find-executable-in-node-modules "eslint")))
(setq-local flycheck-javascript-eslint-executable local-eslint)))))
;;ido
;; (use-package flx-ido
;; :config
;; (progn
;; (ido-mode t)
;; (ido-everywhere t)
;; (flx-ido-mode t)
;; (setq ido-enable-flex-matching t)
;; (setq ido-use-faces nil)
;; (setq ido-create-new-buffer 'always)))
;; (use-package ido-completing-read+)
;; Fuzzy matching - replaces ivy--regex-fuzzy
(use-package orderless
:init
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
(use-package consult
:bind (("C-x C-f" . find-file)
("C-x b" . consult-buffer)
("C-h f" . describe-function)
("C-h v" . describe-variable)))
;; Persist history across Emacs restarts (replaces ivy-use-virtual-buffers for recent files)
(use-package savehist
:init
(savehist-mode))
;; Vertico-specific settings to match your ivy config
(use-package vertico
:init
(vertico-mode)
:config
;; Replaces ivy-count-format - vertico shows count by default in the prompt
(setq vertico-count 20 ; number of candidates shown
vertico-cycle t)
;; Replaces ivy-on-del-error-function - don't quit on backspace at start
;; (setq minibuffer-electric-default-mode nil)
;; Replaces my:previous-line-or-history
:bind (:map vertico-map
([remap previous-line] . vertico-previous)
("C-s" . vertico-next)
("C-r" . vertico-previous)))
;; For the previous-line-or-history behavior (wrap around to history)
;; vertico has this built in with vertico-cycle
;; Replaces ivy-immediate-done (C-c RET) - submit exactly what's typed
(define-key minibuffer-local-completion-map
(kbd "C-c RET") #'minibuffer-complete-and-exit)
(use-package corfu
:bind (:map corfu-map
("S-SPC" . corfu-insert-separator))
:custom (tab-always-indent 'complete)
:init
(global-corfu-mode))
(use-package cape
:init
;; Add `completion-at-point-functions', used by `completion-at-point'.
(setq-default completion-at-point-functions
(append (default-value 'completion-at-point-functions)
(list #'cape-dabbrev #'cape-file #'cape-abbrev))))
(use-package hydra
:config
(defhydra hydra-next-error
(global-map "C-x")
"
Compilation errors:
_j_: next error _h_: first error _q_uit
_k_: previous error _l_: last error
"
("`" next-error nil)
("j" next-error nil :bind nil)
("k" previous-error nil :bind nil)
("h" first-error nil :bind nil)
("l" (condition-case err
(while t
(next-error))
(user-error nil))
nil :bind nil)
("q" nil nil :color blue)))
(require 'transient)
(defun my:transient-with-keyprefix (key desc cmd &rest args)
(let ((seq (where-is-internal cmd isearch-mode-map)))
(append (list key
(if seq (concat desc "[" (mapconcat #'key-description seq ", ") "]")
desc)
cmd)
args)))
(transient-define-prefix my:isearch-menu ()
"isearch Menu, see
http://yummymelon.com/devnull/improving-emacs-isearch-usability-with-transient.html "
[["Edit Search String"
("e"
"Edit the search string (recursive)"
isearch-edit-string
:transient nil)
("w"
"Pull next word or character word from buffer"
isearch-yank-word-or-char
:transient nil)
("s"
"Pull next symbol or character from buffer"
isearch-yank-symbol-or-char
:transient nil)
("l"
"Pull rest of line from buffer"
isearch-yank-line
:transient nil)
("y"
"Pull string from kill ring"
isearch-yank-kill
:transient nil)
("t"
"Pull thing from buffer"
isearch-forward-thing-at-point
:transient nil)]
["Replace"
("q"
"Start ‘query-replace’"
isearch-query-replace
:if-nil buffer-read-only
:transient nil)
("x"
"Start ‘query-replace-regexp’"
isearch-query-replace-regexp
:if-nil buffer-read-only
:transient nil)]]
[["Toggle"
("X"
"Toggle regexp searching"
isearch-toggle-regexp
:transient nil)
("S"
"Toggle symbol searching"
isearch-toggle-symbol
:transient nil)
("W"
"Toggle word searching"
isearch-toggle-word
:transient nil)
("F"
"Toggle case fold"
isearch-toggle-case-fold
:transient nil)
("L"
"Toggle lax whitespace"
isearch-toggle-lax-whitespace
:transient nil)]
["Misc"
("o"
"occur"
isearch-occur
:transient nil)]])
(define-key isearch-mode-map (kbd "A-s") 'my:isearch-menu)
(use-package ag
:bind (("A-s" . 'ag)
("A-S" . 'ag-regexp)
;;On Macos A-S-s will send §
("§" . 'ag-regexp))
:config
(defun eshell/ag (string)
(ag/search string (eshell/pwd)))
(defun ag-kill-all-buffers ()
(interactive)
(mapc (lambda (buff)
(let ((name (buffer-name buff)))
(when (string-prefix-p "*ag search " name)
(kill-buffer buff))))
(buffer-list))))
(use-package ripgrep)
(use-package find-file-in-repository)
(use-package exec-path-from-shell
:config
(when my:osx
;(add-to-list 'exec-path-from-shell-arguments "--norc")
(exec-path-from-shell-initialize)))
;;Tramp defaults
(setq tramp-default-method "ssh")
(setq-default indent-tabs-mode nil)
;;Misc
;;Visible-bell causes problems in OSX, so blink the mode-line instead
(setq visible-bell nil)
(setq ring-bell-function
(lambda ()
(invert-face 'mode-line)
(run-with-timer 0.1 nil #'invert-face 'mode-line)))
(use-package powerline
:config
(powerline-default-theme))
(use-package smart-mode-line-powerline-theme)
;;Smart mode line
(use-package smart-mode-line
:after (smart-mode-line-powerline-theme powerline)
:config
(sml/apply-theme 'smart-mode-line-light-powerline)
(sml/setup)
;(set-face-attribute 'mode-line-inactive nil :box '(:width -1))
)
(use-package flycheck-color-mode-line
:hook (flycheck-mode . flycheck-color-mode-line-mode)
:config
(setq flycheck-color-mode-line-face-to-color 'sml/filename))
(use-package ace-jump-mode)
(use-package ace-window
:bind ("M-SPC" . ace-window))
(use-package help-fns+)
;; (use-package neotree
;; :bind ("M-\\" . neotree-toggle)
;; :after (projectile)
;; :config
;; (setq neo-smart-open t))
(use-package zoom-frm
:bind (("C-x C--" . zoom-in/out)
("C-x C-=" . zoom-in/out)
("C-x C-0" . zoom-in/out)
("C-x C-+" . zoom-in/out)
([C-S-wheel-right] . zoom-out)
([C-S-wheel-left] . zoom-in)))
(use-package yasnippet
:bind (("C-'" . my:accept-completion)
:map yas-keymap
([tab] . nil)
([backtab] . nil)
("TAB" . nil)
([(shift tab)] . nil)
("C-o" . yas-next-field-or-maybe-expand)
("C-S-o" . yas-prev-field))
:config
(defun my:accept-completion ()
(interactive)
(or
(and (fboundp 'copilot-accept-completion) (copilot-accept-completion))
(yas-expand)))
(yas-global-mode t))
(use-package yasnippet-snippets)
(use-package treemacs
:init
(setq treemacs-width 50)
:config
(setq treemacs-space-between-root-nodes nil)
(treemacs-resize-icons 16)
(add-hook 'treemacs-mode-hook (lambda () (text-scale-set -1))))
(use-package treemacs-projectile
:after treemacs)
(projectile-mode +1)
(use-package edit-server
:bind (:map edit-server-edit-mode-map
("C-c C-q" . edit-server-abort))
:commands edit-server-start
:init (if after-init-time
(edit-server-start)
(add-hook 'after-init-hook #'edit-server-start))
:custom (edit-server-url-major-mode-alist . ('(("^github.com" . markdown-mode)))))
(use-package keychain-environment
:if my:linux
:init
(keychain-refresh-environment))
;; Display buffer
(add-to-list 'display-buffer-alist
`(,(make-display-buffer-matcher-function '(compilation-mode))
(display-buffer-reuse-window)
(inhibit-same-window . t)))
(add-to-list 'display-buffer-alist
'("\\*gud-test\\*"
(display-buffer-use-some-window)
(inhibit-same-window . t) ))
(put 'scroll-left 'disabled nil)
;; (defun -debug-delete-windows (win param val)
;; (when (and (eq param 'no-delete-other-windows) val)
;; (debug)))
;; (advice-add 'set-window-parameter :before #'-debug-delete-windows)
(put 'magit-clean 'disabled nil)