Repository navigation
Expand file tree
/
Copy pathinit.el
More file actions
executable file
·917 lines (799 loc) · 33 KB
/
Copy pathinit.el
File metadata and controls
executable file
·917 lines (799 loc) · 33 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
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
;;; package -- Summary: initalization
;;; Code
;;(require 'package)
(put 'set-goal-column 'disabled nil)
;; (setq package-enable-at-startup nil)
;;(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
;; ("marmalade" . "http://marmalade-repo.org/packages/")
;; ("melpa" . "http://melpa.org/packages/")))
;;; Let us install elpaca. First we ned to install the version.
(defvar elpaca-installer-version 0.11)
;;; We need an elpaca directory to place everything under.
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil :depth 1 :inherit ignore
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (<= emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (apply #'call-process `("git" nil ,buffer t "clone"
,@(when-let* ((depth (plist-get order :depth)))
(list (format "--depth=%d" depth) "--no-single-branch"))
,(plist-get order :repo) ,repo))))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(let ((load-source-file-function nil)) (load "./elpaca-autoloads"))))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
(defun elpaca-install-from-cask (cask-file)
"Read a CASK-FILE and install packages with Elpaca."
(with-temp-buffer
(insert-file-contents cask-file)
(goto-char (point-min))
(while (re-search-forward "(depends-on \\(\"\\([^\"]+\\)\"\\))" nil t)
(let ((pkg (match-string 2)))
(message "Installing %s via Elpaca..." pkg)
(eval `(elpaca ,(intern pkg)))))))
;; Example usage
(elpaca-install-from-cask "~/.emacs.d/Cask")
(elpaca-wait)
(package-initialize)
;;
(setq sage-shell:sage-root "/Applications/Sage-6.5.app/Contents/MacOS/Sage")
(require 'cask "~/.emacs.d/.cask/27.2/elpa/cask-20220316.1557/cask.el")
;;(cask-initialize)
;;(require 'pallet)
;;(pallet-mode t)
(require 'color)
;; (require 'benchmark-init)
(exec-path-from-shell-initialize)
;;(require 'auto-complete-config)
(require 'go-autocomplete)
(require 'auto-complete)
(global-auto-complete-mode t)
;;(package-initialize)
(auto-complete-mode t)
;; Setup Icicles
;; (require 'icicles)
;; (icy-mode t)
(require 'god-mode)
(require 'smartparens)
(require 'smartparens-config)
(smartparens-global-mode t)
(require 'yasnippet)
(yas-global-mode t)
(require 'semantic)
(semantic-mode t)
(global-ede-mode 1)
(require 'flycheck)
(flycheck-mode t)
(require 'ido)
(ido-mode t)
;;; activate ecb
;; (require 'ecb)
;; (require 'ecb-autoloads)
(setq ecb-examples-bufferinfo-buffer-name nil)
(setq stack-trace-on-error t)
;; (setq ecb-version-check nil)
;; (setq ecb-layout-name "left6")
;; (setq ecb-show-sources-in-directories-buffer 'always)
(require 'company)
(global-company-mode t)
(org-babel-load-file (expand-file-name "rust.org" user-emacs-directory))
(require 'direnv)
;; load files
(load-file (expand-file-name "extra-buffer-functions.el" user-emacs-directory))
(load-file (expand-file-name "tla-mode.el" user-emacs-directory))
(load-file (expand-file-name "cheat-sh.el" user-emacs-directory))
(load-file (expand-file-name "britanize.el" user-emacs-directory))
(load-file (expand-file-name "latex-utils.el" user-emacs-directory))
;;
(add-to-list 'load-path (expand-file-name "hsearch-mode.el" user-emacs-directory))
;; browse in emacs
(add-to-list 'load-path (expand-file-name "eww-custom.el" user-emacs-directory))
;; (add-to-list 'load-path (expand-file-name "xwidget-custom.el" user-emacs-directory))
;; completion popup is a bit slow: tuning the delay down a notch
(setq company-idle-delay 0.3)
;(setq company-tooltip-align-annotations t)
;; functions - TODO : move them somewhere seperately.
(defun my:ac-c-init()
;;
"Setup autocomplete c mode."
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers)
;; running gcc -xc++ -E -v -
(add-to-list 'achead:include-directories '"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include")
)
(add-to-list 'ac-modes 'rust-mode)
(add-hook 'c++-mode-hook 'my:ac-c-init)
(add-hook 'c-mode-hook (lambda ()
(setq comment-style 'extra-line)))
(add-hook 'c-mode-hook 'my:ac-c-init)
(add-hook 'c-mode-hook 'google-set-c-style)
;;we want a saner identation style for C
(defun c-lineup-arglist-tabs-only (ignored)
"Line up argument lists by tabs, not spaces"
(let* ((anchor (c-langelem-pos c-syntactic-element))
(column (c-langelem-2nd-pos c-syntactic-element))
(offset (- (1+ column) anchor))
(steps (floor offset c-basic-offset)))
(* (max steps 1)
c-basic-offset)))
(add-hook 'c-mode-common-hook
(lambda ()
;; Add kernel style
(c-add-style
"linux-tabs-only"
'("linux" (c-offsets-alist
(arglist-cont-nonempty
c-lineup-gcc-asm-reg
c-lineup-arglist-tabs-only))))))
(add-hook 'c-mode-hook
(lambda ()
(setq indent-tabs-mode t)
(setq show-trailing-whitespace t)
(c-set-style "linux-tabs-only")
))
;;;
;; auto-complete setup, sequence is important
(add-to-list 'ac-modes 'latex-mode) ; beware of using 'LaTeX-mode instead
(add-to-list 'ac-modes 'LaTeX-mode) ; beware of using 'LaTeX-mode instead
(require 'ac-math) ; package should be installed first
(defun my-ac-latex-mode () ; add ac-sources for latex
(setq ac-sources
(append '(ac-source-math-unicode
ac-source-math-latex
ac-source-latex-commands)
ac-sources)))
(add-hook 'LaTeX-mode-hook 'my-ac-latex-mode)
(setq ac-math-unicode-in-math-p t)
(ac-flyspell-workaround) ; fixes a known bug of delay due to flyspell (if it is there)
(add-to-list 'ac-modes 'org-mode) ; auto-complete for org-mode (optional)
(add-hook 'LaTeX-mode-hook (lambda ()
(require 'auto-complete-auctex)
(add-to-list 'ac-sources 'ac-source-math-unicode)
(add-to-list 'ac-sources 'ac-source-math-latex)
))
(add-hook 'TeX-mode-hook (lambda ()
(require 'auto-complete-auctex)
(add-to-list 'ac-sources 'ac-source-math-unicode)
(add-to-list 'ac-sources 'ac-source-math-latex)
))
(org-babel-load-file (expand-file-name "tex.org" user-emacs-directory))
;; symbols
(require 'magic-latex-buffer)
(add-hook 'LaTex-mode-hook 'magic-latex-buffer)
(defun my:ac-semantic()
(add-to-list 'ac-sources 'ac-source-semantic)
)
;; start winner mode if valid for current setup
(when (fboundp 'winner-mode)
(winner-mode 1))
;; add semantic with c and haskell -- TODO maybe I should add it in all modes?
(add-hook 'c-mode-common-hook 'my:ac-semantic)
(add-hook 'haskell-mode-hook 'my:ac-semantic)
(require 'hindent)
(add-hook 'haskell-mode-hook #'hindent-mode)
;;
;;(add-hook 'haskell-mode-hook #'my-haskell-brittany-mode-hook)
;;(define-key haskell-mode-map (kbd "M-.") 'haskell-mode-jump-to-def)
(setq haskell-tags-on-save t)
(setq tags-revert-without-query t)
(require 'speedbar)
(speedbar-add-supported-extension ".hs")
;; hooks be here
;; highlighting
;;(add-hook 'font-lock-mode-hook 'hc-highlight-tabs)
;;(add-hook 'font-lock-mode-hook 'hc-trailing-whitespace)
;;(add-hook 'font-lock-mode-hook 'hc-hard-space)
;; N.B. Revisit this
;; haskell - related
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'haskell-indentation-mode)
;; (defun my-intero-check-hook ()
;; (with-eval-after-load 'intero
;; (with-eval-after-load 'flycheck
;; (flycheck-add-next-checker 'intero
;; '(warning . haskell-hlint))
;; )
;; )
;; (local-set-key (kbd "M-TAB") 'intero-company)
;; )
;; (add-hook 'haskell-mode-hook 'my-intero-check-hook)
;; (require 'dante)
;; (add-hook 'haskell-mode-hook 'flycheck-mode)
;; ;; OR for flymake support:
;; (add-hook 'haskell-mode-hook 'flymake-mode)
;; (remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
;; (add-hook 'haskell-mode-hook 'dante-mode)
;; (add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
;; (add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(add-to-list 'completion-ignored-extensions ".hi")
;(speedbar-add-supported-extension ".hs")
;(add-hook 'rust-mode-hook #'racer-mode)
;(load-file "$GOPATH/src/golang.org/x/tools/cmd/oracle/oracle.el")
(defun my-go-mode-hook ()
; Use goimports instead of go-fmt
(setq gofmt-command "goimports")
;; Gofmt before saving
(add-hook 'before-save-hook 'gofmt-before-save)
;compile command to run go build
(if (not (string-match "go" compile-command))
(set (make-local-variable 'compile-command)
"go build -v && go test -v && go vet"))
; Godef p key binding
(local-set-key (kbd "M-.") 'godef-p))
(add-hook 'go-mode-hook 'my-go-mode-hook)
;; context hooks
(add-hook 'c-mode-common-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\|TODO\\|BUG\\)" 1 font-lock-warning-face t)))))
;; context hooks
(add-hook 'go-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\|TODO\\|BUG\\|TASK\\)" 1 font-lock-warning-face t)))))
;; context hooks
(add-hook 'haskell-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\|TODO\\|BUG\\|TASK\\)" 1 font-lock-warning-face t)))))
;; context hooks
(add-hook 'TeX-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\|TODO\\|BUG\\|TASK\\)" 1 font-lock-warning-face t)))))
(setq TeX-parse-self t) ; Enable parse on load.
(setq TeX-auto-save t) ; Enable parse on save.
(setq reftex-save-parse-info t) ; I didn't know I had it either in my config
(show-paren-mode 1) ;; match parentheses always.
;;;; testing below function
(eval-after-load 'reftex-vars; Is this construct really needed?
'(progn
(setq reftex-cite-prompt-optional-args t); Prompt for empty optional arguments in cite macros.
;; Make RefTeX interact with AUCTeX, http://www.gnu.org/s/auctex/manual/reftex/AUCTeX_002dRefTeX-Interface.html
(setq reftex-plug-into-AUCTeX t)
;; So that RefTeX also recognizes \addbibresource. Note that you
;; can't use $HOME in path for \addbibresource but that "~"
;; works.
(setq reftex-bibliography-commands '("bibliography" "nobibliography" "addbibresource"))
(setq reftex-default-bibliography '("bib.bib" "../bib.bib")); So that RefTeX in Org-mode knows bibliography
(setcdr (assoc 'caption reftex-default-context-regexps) "\\\\\\(rot\\|sub\\)?caption\\*?[[{]"); Recognize \subcaptions, e.g. reftex-citation
(setq reftex-cite-format; Get ReTeX with biblatex, see http://tex.stackexchange.com/questions/31966/setting-up-reftex-with-biblatex-citation-commands/31992#31992
'((?t . "\\textcite[]{%l}")
(?a . "\\autocite[]{%l}")
(?c . "\\cite[]{%l}")
(?s . "\\smartcite[]{%l}")
(?f . "\\footcite[]{%l}")
(?n . "\\nocite{%l}")
(?b . "\\blockcquote[]{%l}{}")))))
;; (setq reftex-use-external-file-finders t)
;; (setq reftex-external-file-finders
;; '(("tex" . "/path/to/kpsewhich -format=.tex %f")
;; ("bib" . "/path/to/kpsewhich -format=.bib %f")))
;; Fontification (remove unnecessary entries as you notice them) http://lists.gnu.org/archive/html/emacs-orgmode/2009-05/msg00236.html http://www.gnu.org/software/auctex/manual/auctex/Fontification-of-macros.html
(setq font-latex-match-reference-keywords
'(
;; biblatex
("printbibliography" "[{")
("addbibresource" "[{")
;; Standard commands
;; ("cite" "[{")
("Cite" "[{")
("parencite" "[{")
("Parencite" "[{")
("footcite" "[{")
("footcitetext" "[{")
;; ;; Style-specific commands
("textcite" "[{")
("Textcite" "[{")
("smartcite" "[{")
("Smartcite" "[{")
("cite*" "[{")
("parencite*" "[{")
("supercite" "[{")
; Qualified citation lists
("cites" "[{")
("Cites" "[{")
("parencites" "[{")
("Parencites" "[{")
("footcites" "[{")
("footcitetexts" "[{")
("smartcites" "[{")
("Smartcites" "[{")
("textcites" "[{")
("Textcites" "[{")
("supercites" "[{")
;; Style-independent commands
("autocite" "[{")
("Autocite" "[{")
("autocite*" "[{")
("Autocite*" "[{")
("autocites" "[{")
("Autocites" "[{")
;; Text commands
("citeauthor" "[{")
("Citeauthor" "[{")
("citetitle" "[{")
("citetitle*" "[{")
("citeyear" "[{")
("citedate" "[{")
("citeurl" "[{")
;; Special commands
("fullcite" "[{")))
(setq font-latex-match-textual-keywords
'(
;; biblatex brackets
("parentext" "{")
("brackettext" "{")
("hybridblockquote" "[{")
;; Auxiliary Commands
("textelp" "{")
("textelp*" "{")
("textins" "{")
("textins*" "{")
;; supcaption
("subcaption" "[{")))
(setq font-latex-match-variable-keywords
'(
;; amsmath
("numberwithin" "{")
;; enumitem
("setlist" "[{")
("setlist*" "[{")
("newlist" "{")
("renewlist" "{")
("setlistdepth" "{")
("restartlist" "{")))
;;;; end testing
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(add-hook 'LateX-mode-hook #'(add-to-list 'TeX-style-list "latex2e"))
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(setq reftex-plug-into-AUCTeX t)
(setq reftex-allow-automatic-rescan t)
(add-hook 'TeX-mode-hook 'turn-on-reftex)
(add-hook 'TeX-mode-hook
(lambda () (set (make-variable-buffer-local 'TeX-electric-math)
(cons "\\(" "\\)"))))
(setq TeX-parse-self t)
;; Inline pretty symbols
(require 'latex-pretty-symbols)
;; imenu hook for reftex
(add-hook 'reftex-load-hook 'imenu-add-menubar-index)
(add-hook 'reftex-mode-hook 'imenu-add-menubar-index)
;; [attempt] sync doc with tex source
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-source-correlate-start-server t)
;; enable flyspell in rust mode and tex mode.
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'rust-mode-hook 'flyspell-mode)
;; variables
(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.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(custom-enabled-themes '(monokai))
'(custom-safe-themes
'("c7fd1708e08544d1df2cba59b85bd25263180b19b287489d4f17b9118487e718"
"78e6be576f4a526d212d5f9a8798e5706990216e9be10174e3f3b015b8662e27"
"d9646b131c4aa37f01f909fbdd5a9099389518eb68f25277ed19ba99adeb7279"
"f9aede508e587fe21bcfc0a85e1ec7d27312d9587e686a6f5afdbb0d220eab50"
"a2cde79e4cc8dc9a03e7d9a42fabf8928720d420034b66aecc5b665bbf05d4e9"
"bd7b7c5df1174796deefce5debc2d976b264585d51852c962362be83932873d9"))
'(desktop-path '("~/.emacs.d/desktop" "~"))
'(direnv-mode t nil (direnv))
'(electric-indent-mode nil)
'(latex-preview-pane-multifile-mode 'off)
'(org-agenda-files
'("~/.emacs.d/org-mod.org" "/Users/eftychis/TODO/2Read.org"
"/Users/eftychis/TODO/Saturday.org"
"/Users/eftychis/TODO/_Problems.org" "~/TODO/Friday"))
'(org-modules
'(org-bbdb org-bibtex org-docview org-eww org-gnus org-habit org-info
org-irc org-mhe org-rmail org-w3m org-annotate-file
org-learn org-toc))
'(package-selected-packages
'(ac-c-headers ac-clang ac-emoji ac-etags ac-haskell-process ac-helm
ac-html ac-ispell ac-math ac-python ac-racer
ac-rtags ace-flyspell ace-isearch ace-jump-mode
ace-jump-zap ace-link ace-mc adoc-mode ag alert
async auctex auto-complete auto-complete-auctex avy
avy-flycheck avy-menu benchmark-init biblio
biblio-core bibliothek cdlatex cff circe color-theme
color-theme-monokai color-theme-tango
color-theme-twilight colorsarenice-theme commander
company company-auctex company-c-headers
company-cabal company-cmake company-ghc company-ghci
company-go company-lsp company-math company-racer
company-tabnine concurrent connection cpputils-cmake
crux ctable dante dash deferred dictionary diminish
direnv direx eagle-eye ecb edit-at-point eglot
eldoro elfeed elfeed-autotag elfeed-dashboard
elfeed-goodies elfeed-org elscreen emamux eno epc
epic epl expand-region f f3 fabric flycheck-cask
flycheck-color-mode-line flycheck-ghcmod
flycheck-grammarly flycheck-haskell flycheck-perl6
flycheck-vale flyspell-popup fm forge function-args
fzf ggtags gh ghc git git-blame github-review gitty
gntp go-autocomplete go-complete go-direx go-dlv
go-eldoc go-guru go-mode go-projectile go-rename
god-mode golint google google-this gotest
gscholar-bibtex gtags gtk-pomodoro-indicator
guru-mode ham-mode hayoo header2 helm-ag helm-ag-r
helm-bibtex helm-c-yasnippet helm-dash helm-gtags
helm-hayoo helm-hoogle helm-ispell helm-lsp
helm-make helm-org-rifle helm-projectile helm-rg
helm-swoop hi2 highlight-chars
highlight-indent-guides highlight-indentation
hindent ht html-to-markdown htmlize http-post-simple
ibuffer-git icicles ido-at-point idomenu irony
isearch+ isearch-symbol-at-point jazz-theme
key-chord latex-extra latex-math-preview
latex-pretty-symbols latex-preview-pane
latex-unicode-math-mode let-alist lib-requires link
log4e logito lsp-dart lsp-grammarly lsp-haskell
lsp-javascript-typescript lsp-latex lsp-python-ms
lsp-rust lsp-treemacs lsp-typescript lsp-ui
magic-latex-buffer magit-gh-pulls magit-popup
magit-rockstar magithub marshal math-symbol-lists
matlab-mode mc-jump monokai-theme move-dup
nix-buffer nix-haskell-mode nix-mode nix-sandbox
nix-update nixos-options noflet ob-ipython ob-rust
opener org org-brain org-bullets
org-clock-convenience org-clock-today org-d20
org-lookup-dnd org-mac-link org-magit
org-noter-pdftools org-pdftools org-pomodoro
org-project-capture org-projectile
org-projectile-helm org-readme org-roam
org-roam-server orglue outline-magic pallet parsebib
pcache pdf-tools pkg-info plantuml-mode poetry
pomodoro popup pos-tip projectile
projectile-codesearch projectile-direnv
projectile-ripgrep projectile-speedbar
python-environment racer redtick request rg rpn-calc
rspec-mode ruby-tools rust-auto-use s s-buffer
sage-shell-mode seq shm showkey shut-up
smart-cursor-color smex smooth-scrolling sublimity
swap-buffers swift-mode switch-window sx synonymous
synonyms synosaurus textmate tide tldr toc-org
tomatinho ts-comint use-package vimish-fold
visual-fill-column voca-builder warm-night-theme
websocket wgrep window-layout window-numbering
wolfram wrap-region writegood-mode writeroom-mode
x-dict xkcd yaml yaml-mode yaoddmuse yasnippet
z3-mode zones))
'(rainbow-identifiers-cie-l*a*b*-lightness 30)
'(rainbow-identifiers-cie-l*a*b*-saturation 35)
'(safe-local-variable-values
'((TeX-master . pitch.tex) (TeX-master . \../pitch.tex)
(reftex-default-ibliography "../bib.bib")
(reftex-default-bibliography "bib.bib")))
'(shell-prompt-pattern "^[^#$%>\\n]*~?[#$%>] *"))
;;(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.
;; )
;; irony mode
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
(defun replace-irony-with-irony-completion-hook ()
(define-key irony-mode-map [remap completion-at-point]
'irony-completion-at-point-async)
(define-key irony-mode-map [remap complete-symbol]
'irony-completion-at-point-async))
(add-hook 'irony-mode-hook 'replace-irony-with-irony-completion-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
;; company "complete anything" hooks
(add-hook 'after-init-hook 'global-company-mode)
(require 'company-irony)
(company-irony t)
(setq company-idle-delay nil
company-minimum-prefix-length 2
company-show-numbers t
company-tooltip-limit 20
company-dabbrev-downcase nil
company-backends '((company-irony company-gtags))
)
(setq molokai-theme-kit t)
;;(load-theme 'monokai-theme t)
;;(prelude-require-package 'ace-jump-mode)
;;(require 'ace-jump-mode)
(define-key global-map (kbd "M-j") 'avy-goto-word-or-subword-1)
(put 'upcase-region 'disabled nil)
(window-numbering-mode t)
;; ORG mode configuration
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
;; Setting org-mode's calendar source files.
(setq org-log-done t)
(setq org-agenda-files `("~/TODO/" "~/TODO/Friday"))
;; (setq org-agenda-files (list "~/WriteUps/todo.org"
;; "~/WriteUps/personal/mytodos.org"
;; "~/WriteUps/personal/today.org"))
(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.
)
(ac-flyspell-workaround)
;; latex vars
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
;; no exempt buffers for god mode
;;(setq god-exempt-major-modes nil)
(setq god-exempt-predicates nil)
(add-to-list 'god-exempt-major-modes 'latex-preview-pane-mode)
(add-to-list 'god-exempt-major-modes 'magit-modes)
(add-to-list 'god-exempt-major-modes 'dired-mode)
(add-to-list 'god-exempt-major-modes 'pdf-view-mode)
(setq default-frame-alist '((cursor-color . "white")))
;; (require 'cursor-chg) ; Load the library
;; (toggle-cursor-type-when-idle 1) ; Turn on cursor change when Emacs is idle
;; (change-cursor-mode 1) ; Turn on change for overwrite, read-only, and input mode
(require 'smart-cursor-color)
(setq smart-cursor-color-mode t)
;; (defun my-update-cursor ()
;; (setq cursor-type (if (or god-global-mode buffer-read-only)
;; 'box
;; 'bar)))
;; (setq default-frame-alist '((cursor-color . "white")))
;; (add-hook 'god-mode-enabled-hook 'my-update-cursor)
;; (add-hook 'god-mode-disabled-hook 'my-update-cursor)
;; (defun c/god-mode-update-cursor ()
;; (let ((limited-colors-p (> 257 (length (defined-colors)))))
;; (cond (god-mode (progn
;; (set-face-background 'mode-line (if limited-colors-p "white" "#e9e2cb"))
;; (set-face-background 'mode-line-inactive (if limited-colors-p "white" "#e9e2cb"))))
;; (t (progn
;; (set-face-background 'mode-line (if limited-colors-p "black" "#0a2832"))
;; (set-face-background 'mode-line-inactive (if limited-colors-p "black" "#0a2832")))))))
;; (add-hook 'god-mode-enabled-hook 'c/god-mode-update-cursor)
;; ;; god mode update cursor and line background
(defun hook-update-cursor-orange ()
;; (cond ((or (bound-and-true-p god-mode)
;; (bound-and-true-p god-global-mode))
(set-cursor-color "lime green")
(set-face-attribute 'cursor "red")
(setq cursor-type 'bar)
)
;; (t (set-cursor-color "dark orange"))))
(defun hook-update-cursor-grey ()
(set-cursor-color "dark orange")
(setq cursor-type 'hbar)
)
(add-hook 'god-mode-enabled-hook 'hook-update-cursor-orange)
(add-hook 'god-mode-disabled-hook 'hook-update-cursor-grey)
;; (add-hook 'buffer-list-update-hook 'hook-update-cursor)
;; (defun my-update-cursor ()
;; (setq cursor-type (if (or god-local-mode buffer-read-only)
;; 'box
;; 'bar)))
;; (add-hook 'god-mode-enabled-hook 'my-update-cursor)
;; (add-hook 'god-mode-disabled-hook 'my-update-cursor)
;; (defun set-modeline-color-grey ()
;; (set-face-background 'mode-line "#b5b5b5")
;; (set-face-background 'mode-line-inactive "#b5b5b5"))
;; (defun set-modeline-color-champagne ()
;; (set-face-background 'mode-line "#f6eabe")
;; (set-face-background 'mode-line-inactive "#f6eabe"))
;; (add-hook 'god-mode-enabled-hook 'set-modeline-color-champagne)
;; (add-hook 'god-mode-disabled-hook 'set-modeline-color-grey)
;; disable god mode on overwrite
(defun god-toggle-on-overwrite ()
"Toggle god-mode on overwrite-mode."
(if (bound-and-true-p overwrite-mode)
(god-local-mode-pause)
(god-local-mode-resume)))
(add-hook 'overwrite-mode-hook 'god-toggle-on-overwrite)
(require 'god-mode-isearch)
(define-key isearch-mode-map (kbd "<Meta>") 'god-mode-isearch-activate)
(define-key god-mode-isearch-map (kbd "<Meta>") 'god-mode-isearch-disable)
;; my shortcuts
(global-set-key (kbd "M-[") 'delete-other-windows) ; expand current pane
(global-set-key (kbd "M-]") 'split-window-horizontally) ; split pane top/bottom
(global-set-key (kbd "M-p") 'delete-window) ; close current pane
(global-set-key (kbd "M-s") 'other-window) ; cursorag to other pane
(global-set-key (kbd "M-x") 'smex) ; cursorag to other pane
(global-set-key (kbd "M-g") 'goto-line) ;
;;(global-set-key (kbd "M-M-c") 'calendar)
(global-set-key (kbd "M-RET g g") 'god-mode)
(global-set-key (kbd "C-_") 'god-mode-all)
(global-set-key (kbd "C--") 'god-mode-all)
;; load our custom short keybinds
(load-file (expand-file-name "customshortkeys.el" user-emacs-directory))
;;(global-set-key (kbd "M-n") 'god-mode-all)
;;(global-set-key [(shift right)] 'god-mode-all)
(define-key god-local-mode-map (kbd ".") 'repeat)
;; ', "
;; set winner mode
(global-set-key (kbd "C-c <right>") 'winner-redo)
(global-set-key (kbd "C-c <left>") 'winner-undo)
;; You know, like Readline.
;;(global-set-key (kbd "M-RET m p") 'smartparens-mode)
;;(global-set-key (kbd "M-RET r") 'global-writeroom-mode)
;; Align your code in a pretty way.
(global-set-key (kbd "C-x \\") 'align-regexp)
;; Jump to a definition in the current file. (This is awesome.)
(global-set-key (kbd "C-x C-i") 'ido-imenu)
;; File finding
(global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
(global-set-key (kbd "C-x C-M-f") 'find-file-in-project)
;; Fetch the contents at a URL, display it raw.
(global-set-key (kbd "C-x C-h") 'url-view-url)
;; Help should search more than just commands
(global-set-key (kbd "C-h a") 'apropos)
;; Should be able to eval-and-replace anywhere.
;; (global-set-key (kbd "C-c e") 'eval-and-replace)
;; Magit rules!
(global-set-key (kbd "M-RET g s") 'magit-status)
(global-set-key (kbd "M-RET g m p") 'magit-dispatch-popup)
(global-set-key (kbd "M-RET g m s") 'magit-stage)
;;
;; transpose rules
(define-key input-decode-map "\e\eOA" [(meta up)])
(define-key input-decode-map "\e\eOB" [(meta down)])
(global-set-key [(meta up)] 'transpose-line-up)
(global-set-key [(meta down)] 'transpose-line-down)
;; Borrowed from xah
;; TODO: move them into a separate file if they work fine
(defun xah-forward-block (&optional n)
"Move cursor beginning of next text block.
A text block is separated by blank lines.
This command similar to `forward-paragraph', but this command's behavior is the same regardless of syntax table.
URL `http://ergoemacs.org/emacs/emacs_move_by_paragraph.html'
Version 2016-06-15"
(interactive "p")
(let ((n (if (null n) 1 n)))
(search-forward-regexp "\n[\t\n ]*\n+" nil "NOERROR" n)))
(defun xah-backward-block (&optional n)
"Move cursor to previous text block.
See: `xah-forward-block'
URL `http://ergoemacs.org/emacs/emacs_move_by_paragraph.html'
Version 2016-06-15"
(interactive "p")
(let ((n (if (null n) 1 n))
(-i 1))
(while (<= -i n)
(if (search-backward-regexp "\n[\t\n ]*\n+" nil "NOERROR")
(progn (skip-chars-backward "\n\t "))
(progn (goto-char (point-min))
(setq -i n)))
(setq -i (1+ -i)))))
(defun xah-beginning-of-line-or-block (&optional n)
"Move cursor to beginning of line, or beginning of current or previous text block.
(a text block is separated by blank lines)
URL `http://ergoemacs.org/emacs/emacs_keybinding_design_beginning-of-line-or-block.html'
version 2016-06-15"
(interactive "p")
(let ((n (if (null n) 1 n)))
(if (equal n 1)
(if (or (equal (go-to-char) (line-beginning-position))
(equal last-command this-command )
;; (equal last-command 'xah-end-of-line-or-block )
)
(xah-backward-block n)
(beginning-of-line))
(xah-backward-block n))))
(defun xah-end-of-line-or-block (&optional n)
"Move cursor to end of line, or end of current or next text block.
(a text block is separated by blank lines)
URL `http://ergoemacs.org/emacs/emacs_keybinding_design_beginning-of-line-or-block.html'
version 2016-06-15"
(interactive "p")
(let ((n (if (null n) 1 n)))
(if (equal n 1)
(if (or (equal (go-to-char) (line-end-position))
(equal last-command this-command )
;; (equal last-command 'xah-beginning-of-line-or-block )
)
(xah-forward-block)
(end-of-line))
(progn (xah-forward-block n)))))
;;(global-set-key (kbd "<C-c left>") 'xah-beginning-of-line-or-block) ; page up key
;;(global-set-key (kbd "<C-c right>") 'xah-end-of-line-or-block) ; page down key
(global-set-key (kbd "<C-c m p>") 'xah-forward-block) ; page down key
(global-set-key (kbd "<C-c m n>") 'xah-backward-block) ; page down key
;; (global-set-key (kbd "<home>") 'xah-backward-left-bracket)
;; (global-set-key (kbd "<end>") 'xah-forward-right-bracket)
(setq pending-delete-mode nil)
;;(global-set-key (kbd " '") 'mc/edit-lines)
;; TODO : think this a bit and add a COND.
;; mode specific
(eval-after-load 'go-mode
'(define-key go-mode-map (kbd "C-j") 'godef-jump)) ; navigating to definition in go-mode
(eval-after-load 'c-mode
'(define-key go-mode-map (kbd "C-j") 'semantic-ia-fast-jump)) ; navigating to definition in c-mode
(eval-after-load 'auto-complete
'(define-key ac-mode-map (kbd "M-TAB") 'auto-complete))
(put 'downcase-region 'disabled nil)
;; company mode completion
(eval-after-load 'company-mode
'(define-key company-mode-map (kbd "M-RET c") 'company-complete-common))
;;(eval-after-load 'company-mode
;; '
(define-key company-mode-map (kbd "TAB") 'company-indent-or-complete-common)
;;)
;; SET PATH so LateX works
(getenv "PATH")
(setenv "PATH"
(concat
"/usr/texbin" ":" (getenv "PATH")
)
)
(put 'narrow-to-region 'disabled nil)
(put 'magit-diff-edit-hunk-commit 'disabled nil)
(org-babel-load-file (expand-file-name "tabnine.org" user-emacs-directory))
;; Setup indentation
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
(setq highlight-indent-guides-method 'fill)
(require 'org)
(require 'ob-tangle)
(org-babel-load-file (expand-file-name "org-mod.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "custom-functionality.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "lsp.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "gui.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "misc-modes.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "post-save-hooks.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "org-roam.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "ansi-term.org" user-emacs-directory))
;; Set up elfeed for RSS.
(org-babel-load-file (expand-file-name "rss.org" user-emacs-directory))
;; I know...
(org-babel-load-file (expand-file-name "typescript.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "load-files.org" user-emacs-directory))
;; Setup Vale -- experimentally for now.
(flycheck-define-checker vale
"A checker for prose"
:command ("vale" "--output" "line"
source)
:standard-input nil
:error-patterns
((error line-start (file-name) ":" line ":" column ":" (id (one-or-more (not (any ":")))) ":" (message) line-end))
:modes (markdown-mode org-mode text-mode)
)
(add-to-list 'flycheck-checkers 'vale 'append)
;; save last session
(desktop-save-mode t)
(setq desktop-dirname "~/.emacs.d/desktop/")
;; We turn ac config on after every configuration.
(require 'auto-complete-config) ; should be after add-to-list 'ac-modes and hooks
(ac-config-default)
(setq ac-auto-start t) ; if t starts ac at startup automatically
(setq ac-auto-show-menu t)
(global-auto-complete-mode t)
;;;
;; init ends here