-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
2849 lines (2351 loc) · 82.2 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
;;; init.el --- Emacs configuration -*- lexical-binding: t; byte-compile-docstring-max-column: 1000; eval: (require 'p@ckage) -*-
;; Author: Will Dey
;; Maintainer: Will Dey
;; Version: 1.0.0
;; Homepage:
;; This file is not part of GNU Emacs
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; See README.org.
;;; Code:
;; Documentation is an ongoing effort.
;; `heading-1' is All Capitalized.
;; All headings below are Sentence case.
;; TODO Test all possibilities of compilation orders and init orders (including daemonized vs not) for maximum reliability
;; TODO make first installation idempotent, reliable, and reproducible
;; TODO Outline-minor-mode C-ret and M-ret keybindings
;; TODO Outline minor mode heading indentation
;; TODO Use $ whenever possible
;; TODO Search for (require) and try to make a nested p@ckage
;; TODO defvar+setq -> defconst where possible
;; TODO Go through and reorganize
;; TODO Break up "Keybindings" headings
;; TODO remove bind-key and replace all with keymap-set
;; TODO make everything after independent of order in file
;; TODO make all regexes use rx
;; TODO move all advice-add to define-advice
(defgroup my nil
"Customizations for personal Emacs modifications."
:group 'emacs)
;;; GC
(setq gc-cons-threshold 16777216
gc-cons-percentage 0.1)
;;; Load
(setq load-prefer-newer t)
;;; Native compilation cache
(eval-when-compile
(when (and (fboundp 'startup-redirect-eln-cache)
;; Sometimes `startup-redirect-eln-cache' is defined but fails with "Symbol's value as variable is void: native-comp-eln-load-path":
(boundp 'native-comp-eln-load-path))
(startup-redirect-eln-cache
(convert-standard-filename
(expand-file-name "var/eln-cache/" user-emacs-directory)))))
;;; Autoloads
(eval-when-compile
(defun my/package-autoloads--clean-p (func
file
&optional
docstring
interactive
type)
(pcase nil
((and (let `(quote ,(pred symbolp)) func)
(let (pred stringp) file)
(let (or (pred stringp)
(pred null))
docstring)
(let (pred symbolp) interactive)
(let (pred symbolp) type))
t)))
(defmacro my/package-autoloads (package &optional file-override)
"Generate autoloads for PACKAGE, but return a form of only `autoload' calls. This removes any code that may automatically execute when activating a package, and only makes the functions available so that they may be explicitly called by the user.
PACKAGE is a folder name under \"~/.emacs.d/straight/build/\" to generate autoloads for by means of `make-directory-autoloads'. However, as noted above, nothing other than a `progn' consisting of `autoload' calls will ever be evaluated by this macro for security and user-choice-only reasons.
Optional argument FILE-OVERRIDE is a string to be passed as the FILE parameter to all `autoload' calls in place of the generated parameter. This is useful when loading one file will make all the functions in the package available, like in the case of straight.el's \"bootstrap.el\" file."
(defvar autoload-timestamps)
(defvar version-control)
(defvar my/straight-build-dir)
(when file-override
(setq file-override (eval file-override lexical-binding)))
(let* ((package-name (symbol-name package))
(directory (concat my/straight-build-dir package-name))
(autoload-file (expand-file-name (concat package-name "-autoloads.el")
directory))
(noninteractive t)
(backup-inhibited t)
(version-control 'never)
(inhibit-message t)
sexp
autoloads)
(make-directory-autoloads directory autoload-file)
(with-current-buffer (find-file-noselect autoload-file)
(goto-char (point-min))
(prog1
(condition-case nil
(while t
(setq sexp (read (current-buffer)))
(pcase sexp
(`(autoload . ,(pred (apply #'my/package-autoloads--clean-p)))
(when file-override
(setf (nth 2 sexp) file-override))
(push sexp autoloads))))
(end-of-file (cons 'progn autoloads)))
(kill-buffer))))))
;;; Straight.el
;; TODO disable straight build and manually rebuild based on timestamps
(eval-and-compile
;;;; Constants
;;;;; Paths
(defconst my/straight-dir (expand-file-name (file-name-as-directory "straight")
user-emacs-directory))
(defconst my/straight-build-dir (concat my/straight-dir (file-name-as-directory "build")))
;;;; Build
;;;;; Autoloads
;;;;;; Disable
(setq straight-disable-autoloads t)
;;;;; Shallow clones
(setq straight-vc-git-default-clone-depth 1))
(eval-when-compile
;;;; Develop
(defvar straight-repository-branch)
(setq straight-repository-branch "develop")
;;;; Checking
(defvar straight-check-for-modifications)
(setq straight-check-for-modifications '(find-when-checking check-on-save))
;;;; Mirrors
;;;;; GNU ELPA
(defvar straight-recipes-gnu-elpa-use-mirror)
(setq straight-recipes-gnu-elpa-use-mirror t)
;;;;; Emacsmirror
;; TODO
;;;; Bootstrap
(defvar bootstrap-version)
(let ((bootstrap-file (concat my/straight-dir "repos/straight.el/bootstrap.el"))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage)))
;;;; Autoloads
(my/package-autoloads straight (expand-file-name "straight-init" user-emacs-directory))
;;; Paths
(eval-and-compile
;;;; Site lisp
(defvar my/site-lisp (eval-when-compile
(let (site-lisp)
(dolist (path load-path)
(when (string-match-p "site-lisp" path)
(push path site-lisp)))
(nreverse site-lisp))))
(let ((straight-built (directory-files my/straight-build-dir
:full-name
"\\`[^.]")))
;;;; Load path
;; Pull site-lisp directories to the front of the load path:
(setq load-path (append my/site-lisp
straight-built
load-path))
;;;; Info
(setq Info-additional-directory-list straight-built)))
;;; p@ckage
(eval-when-compile
(straight-use-package '(p@ckage :type git :host github :repo "wi11dey/p-ckage"))
(require 'p@ckage))
(p@ckage p@ckage
@$
;;;; Safe local eval
;; Allow requiring p@ckage from local eval:
(push '(require 'p@ckage) safe-local-eval-forms))
;;; Exec Path From Shell
(p@ckage exec-path-from-shell
;;;; Build
~(straight-use-package '$)
;;;; Enable
(when (memq window-system '(mac ns x))
(@$-initialize)))
;;; Bytecomp Simplify
(p@ckage bytecomp-simplify
;;;; Build
~(straight-use-package '$)
~^
@$-warn)
;;; Compat
(p@ckage compat
;;;; Build
~(straight-use-package '$)
~^)
;;; No Littering
(p@ckage no-littering
;;;; Build
~(straight-use-package '$)
!^
;;;; Backups
($-theme-backups))
;; Bootstrapped.
;;; Xtended Faces
(p@ckage xtended-faces
;;;; Build
~(straight-use-package '($ :type git :host github :repo "wi11dey/xtended-faces"))
!^
;;;; Prose mode
;;;;; Help
(add-hook 'help-mode-hook #'prose-mode)
;;;;; Info
(add-hook 'Info-mode-hook #'prose-mode)
;;;;; Text modes
(add-hook 'text-mode-hook #'prose-mode)
;;;;; WoMan
(add-hook 'woman-mode-hook #'prose-mode)
;;;; Fixed pitch mode
;;;;; Dired
(add-hook 'dired-mode-hook #'fixed-pitch-mode)
;;;;; Undo tree visualizer
(add-hook 'undo-tree-visualizer-mode-hook #'fixed-pitch-mode))
;;; Modus Themes
(p@ckage modus-themes
;;;; Build
~(straight-use-package '$)
;;;; Bold
(setq $-bold-constructs t)
;;;; Load
^
(load-theme 'modus-operandi-tinted :no-confirm))
;;; emaχ
(p@ckage emaχ
;;;; Build
~(straight-use-package '($ :type git :host github :repo "wi11dey/emaX"))
;;;; Load
(require '$-theme)
(enable-theme '$))
;;; Solarized
(p@ckage solarized
;;;; Build
~(straight-use-package 'color-theme-$)
;;;; macOS
;;;;; Color space
(when (boundp 'ns-use-srgb-colorspace)
;; Consistenly use Apple RGB across faces and XPM images, so use altered Solarized values intended for Apple RGB:
(setq ns-use-srgb-colorspace nil
solarized-broken-srgb t))
;;;; Load
(require '$-theme)
;; (load-theme '$ :no-confirm)
;; (load-theme 'custom-$ :no-confirm)
)
;;; Bind Key
(p@ckage bind-key
;;;; Build
~(straight-use-package '$)
!^)
;;; Xah Fly Keys
;; FIXME properly respect `delete-selection-temporary-region'
(p@ckage xah-fly-keys
;;;; Modifier keys
;; Disable overriding built-in Emacs control/meta key sequences so they are always available:
!(setq xah-fly-use-control-key nil)
!(setq xah-fly-use-meta-key nil)
;;;; Build
~(straight-use-package '$)
;;;; Recently closed
(setq xah-recently-closed-buffers-max 0)
;;;; Load
!^
;;;; Emacsclient
(add-hook 'server-after-make-frame-hook #'xah-fly-command-mode-activate)
;;;; Cursor
!(defun my/$-bar-cursor ()
(modify-all-frames-parameters (list (cons 'cursor-type '(bar . 1))))
(when (featurep 'ivy-overlay)
(set-face-attribute 'ivy-cursor nil :height 1)))
(add-hook 'xah-fly-insert-mode-activate-hook #'my/$-bar-cursor)
!(defun my/$-default-cursor ()
(modify-all-frames-parameters (list (cons 'cursor-type '(hbar . 3))))
(when (featurep 'ivy-overlay)
(set-face-attribute 'ivy-cursor nil :height 'unspecified)
(set-face-attribute 'ivy-cursor t :height 'unspecified)))
(add-hook 'xah-fly-command-mode-activate-hook #'my/$-default-cursor)
;;;; Keybindings
;; Still use the binding M-SPC to enable command mode:
(global-set-key (kbd "M-SPC") #'xah-fly-command-mode-activate)
;; Allow menu key to be sent through to other keymaps:
(define-key xah-fly-command-map [menu] nil)
;; Always use normal `kill-current-buffer':
(keymap-global-set "<remap> <xah-save-close-current-buffer>" #'kill-current-buffer)
(keymap-global-set "<remap> <xah-close-current-buffer>" #'kill-current-buffer)
;; TODO modify xfk to accept a list to try for movement with "h" and ";"
($))
;;; Symb0l
(p@ckage symb0l
;;;; Build
~(straight-use-package '($ :type git :host github :repo "wi11dey/symb0l"))
;;;; Load
!^
;;;; Enable
($-mode))
;;; Repeat
(p@ckage repeat
;;;; Keybindings
(bind-key "C-z" @'$))
;;; Novice
(p@ckage novice
;;;; Disable
;; Enable all commands:
(setq disabled-command-function nil))
;;; Emacs
(p@ckage emacs
;;;; Graphical display
;; xdisp
(setq x-underline-at-descent-line t ; Lines up underline with `telephone-line' separators.
x-stretch-cursor t)
;;;; Command error function
!(defun my/command-error-function (data context function)
(message (when (not (eq (car data) 'quit))
(concat (propertize (concat context
(when (and context
(stringp context)
(not (string-empty-p context)))
" ")
(error-message-string data))
'face 'variable-pitch)
(when function
(concat (propertize " ("
'face 'variable-pitch)
(propertize (symbol-name function)
'face 'font-lock-function-name-face)
(propertize ")"
'face 'variable-pitch)))))))
(setq command-error-function #'my/command-error-function)
;;;; No bell
(setq ring-bell-function #'ignore)
;;;; Fill column
(setq-default fill-column 80))
;;; Minibuffer
(p@ckage minibuffer
;;;; Variable Pitch
(add-hook '$-inactive-mode-hook #'variable-pitch-mode))
;;; Blink Cursor
(p@ckage blink-cursor
;;;; Disable
($-mode -1))
;;; Faces
(p@ckage faces
;; TODO fontsets
;; (set-face-attribute FACE nil :fontset "x") works on everything but default face
)
;;; Save
(p@ckage save
;;;; Final newline
(p@ckage require-final-newline
(setq $ nil)
(setq mode-$ :ask))
;;;; Kill buffer
;; Prompt before killing a modified buffer:
!(defun my/prompt-before-killing-buffer ()
""
(when (and buffer-file-name
(buffer-modified-p)
(yes-or-no-p (format "Save %s before killing buffer? " buffer-file-name)))
(save-buffer))
t)
(add-hook 'kill-buffer-query-functions #'my/prompt-before-killing-buffer))
;;; Keyboard
(p@ckage keyboard
;;;; Print screen key
;; Sometimes, the print screen key is put where the right alt key usually is (next to right control key), so make print screen act as a alt key as well:
(keymap-set function-key-map "<print>" #'event-apply-meta-modifier)
;;;; macOS
;;;;; Command key
;; Command key is control:
(when (boundp 'ns-command-modifier)
;; GNUStep:
(setq ns-command-modifier 'control))
(when (and (boundp 'mac-command-modifier)
(boundp 'mac-pass-command-to-system))
;; Mitsuharu Yamamoto’s macOS port:
(setq mac-command-modifier 'control
mac-pass-command-to-system nil))
;;;;; Option key
(when (boundp 'mac-option-modifier)
(setq mac-option-modifier 'meta)))
;;; Paragraphs
(p@ckage paragraphs
(setq sentence-end-double-space nil))
;;; Files
(p@ckage files
;;;; Windows
;;;;; File attributes
;; Don't make extra system calls to get accurate attribute information every time, which causes a very noticeable slowdown on some machines:
(when (boundp 'w32-get-true-file-attributes)
(setq w32-get-true-file-attributes nil))
;;;; Backup
(p@ckage backup
;;;;; Copying
(setq $-by-copying t)
;;;;; Versions
(setq version-control t
kept-old-versions 1
kept-new-versions 3
delete-old-versions t)))
;;; Mouse
(p@ckage mouse
;;;; Yank
;; Don't paste on middle-click:
(keymap-global-unset "<mouse-2>"))
;;; Menu Bar
(p@ckage menu-bar
;;;; Disable
($-mode -1))
;;;; Fringe
;; Left side only:
(fringe-mode '(8 . 0))
;;;;; Buffer boundaries
(setq-default indicate-buffer-boundaries '(;; Don't show top boundary.
(top . nil)
;; Don't show bottom boundary.
(bottom . nil)
;; Do show both arrows in the left fringe.
(t . left)))
;;;;; Paragraph
;; TODO
;; (define-fringe-bitmap 'paragraph
;; [#b00111111
;; #b01111101
;; #b01111101
;; #b01111101
;; #b01111101
;; #b00111101
;; #b00000101
;; #b00000101
;; #b00000101
;; #b00000101])
;;; Custom
(p@ckage custom
~(require 'cus-edit)
(setq $-file (concat user-emacs-directory "custom.el")
$-raised-buttons t))
;;; Tool Bar
(p@ckage tool-bar
;;;; Disable
($-mode -1))
;;;; Kill current buffer
(bind-key [remap kill-buffer] #'kill-current-buffer)
;; Keep the suggested keybinding visible for 5 seconds:
;; (The default 2 seconds is too short for me to read through some of the suggestions).
(setq suggest-key-bindings 5
echo-keystrokes 0.5)
;;; Visual Line
(p@ckage visual-line
;;;; Ignore modes
(defvar my/$-ignore-modes nil
"List of major modes for which Visual Line mode should never be enabled.")
(setq $-fringe-indicators '(left-curly-arrow right-curly-arrow))
!(defun my/$-ignore-modes-check ()
"Disable Visual Line mode if the current major mode or any of its parents is blacklisted in `my/visual-line-ignore-modes'."
(when $-mode
(let ((mode major-mode))
;; Traverse up parent modes through the `derived-mode-parent' property.
(while (and (not (when (memq mode my/$-ignore-modes)
($-mode -1)
t))
(setq mode (get mode 'derived-mode-parent)))))))
(add-hook '$-mode-hook #'my/$-ignore-modes-check)
;;;; Enable
(global-$-mode))
;;; Scroll Bar
(p@ckage scroll-bar
;;;; Width
(set-frame-parameter nil '$-width 12)
;;;; Disable
($-mode -1))
;;; Adaptive Wrap
;; TODO make adaptive wrap better by replacing tabs with a space with an :align-to property that aligns to wherever the last tab ended
(p@ckage adaptive-wrap
;;;; Build
~(straight-use-package '$)
;;;; Enable
;;;;; Visual Line
!(defun my/$-on-visual-line-mode ()
(@$-prefix-mode (if (and visual-line-mode
(not (bound-and-true-p org-indent-mode)))
1
-1)))
(add-hook 'visual-line-mode-hook #'my/$-on-visual-line-mode))
;;; Subword
(p@ckage subword
!^
(global-$-mode))
;;; Aggressive Indent
(p@ckage aggressive-indent
;;;; Build
~(straight-use-package '$)
!^
;;;; Bugfixes
;; FIXME: Bug in aggressive-indent-mode. Change defvar-local to defvar aggressive-indent--idle-timer in aggressive-indent.el upstream
(add-hook 'org-babel-post-tangle-hook (lambda ()
(cancel-function-timers 'aggressive-indent--indent-if-changed)))
;;;; Disable message
!(defun my/$-region-function (start end &optional column)
(let ((inhibit-message t))
(indent-region start end column)))
(setq $-region-function #'my/$-region-function)
;;;; Enable
(global-$-mode))
;;; AUCTeX
(p@ckage auctex
;;;; Build
~(straight-use-package '$)
~(my/package-autoloads $)
(p@ckage tex
~^
;;;; Enable
(require '$-site)
;;;; Font lock
(p@ckage $-font
;; Use built-in `tex-mode' syntax highlighting, which highlights all control sequences.
(setq TeX-install-font-lock @'$-setup))
;;;; Engines
;;;;; OpTeX
(setq TeX-engine-alist '((optex "OpTeX" "luatex -fmt optex" "" "")))
;;;; Viewer
(setq TeX-view-program-selection '((output-pdf "PDF Tools")))
;;;; Revert buffer
(add-hook 'TeX-after-compilation-finished-functions @'TeX-revert-document-buffer)
;; FIXME upstream this in function itself, it is a bug to not run `TeX-after-compilation-finished-functions' for TeX
!(defun my/TeX-run-after-compilation-finished-functions (_process _name)
(unless (TeX-error-report-has-errors-p)
(run-hook-with-args 'TeX-after-compilation-finished-functions
(with-current-buffer TeX-command-buffer
(expand-file-name
(TeX-active-master (TeX-output-extension)))))))
(advice-add @'TeX-TeX-sentinel :after #'my/TeX-run-after-compilation-finished-functions)))
;;; Text Scale
(p@ckage text-scale
!((autoload '$-mode "face-remap" nil t)
(defun my/$-reset ()
(interactive)
($-mode -1)))
(bind-key "C-x C-+" #'$-increase)
(bind-key "C-x C-=" #'$-increase)
(bind-key "C-x C--" #'$-decrease)
(bind-key "C-x C-0" #'my/$-reset))
;;; Calculator
(p@ckage calculator
(bind-key "<XF86Calculator>" #'calculator))
;;; Rainbow
(p@ckage rainbow-mode
;;;; Build
~(straight-use-package '$)
~^
;;;; X colors
(setq rainbow-x-colors nil)
;;;; Enable
;;;;; Programming modes
(add-hook 'prog-mode-hook @'$))
;;; Company
;; TODO enable wherever `completion-in-region' can work
(p@ckage company
;;;; Build
~(straight-use-package '$)
~^
;;;; Lighter
(setq $-lighter nil)
;;;; Delay
(setq $-idle-delay 0.25)
;;;; Prefix length
(setq $-minimum-prefix-length 2)
;;;; Wrap around
(setq $-selection-wrap-around t)
;;;; Quickhelp
;; TODO
(p@ckage $-quickhelp
;;;;; Build
~(straight-use-package '$))
;;;; Frontend
(setq $-frontends (list @'$-preview-frontend))
;;;; Enable
;;;;; Programming modes
(add-hook 'prog-mode-hook @'$-mode)
;;;; Keybindings
(keymap-unset $-active-map "RET")
;;;;; Tab completion
(keymap-set $-active-map "TAB" @'$-complete)
(keymap-set $-active-map "<tab>" @'$-complete))
;;; Goto Last Change
(p@ckage goto-last-change
;;;; Build
~(straight-use-package '$)
;; TODO keybindings
)
;;; Highlight Indent Guides
;; TODO Use font-lock "stealth" to add guides to buffers
(p@ckage highlight-indent-guides
;;;; Build
~(straight-use-package '$)
~^
;;;; Delay
(setq $-delay 0.05)
;;;; Character
(setq $-method 'character
$-character ?|)
;;;; Responsive
(setq $-responsive 'top)
;;;; Enable
;;;;; Programming modes
;; (add-hook 'prog-mode-hook @'$-mode)
;;;; Faces
;; Don't automatically calculate face colors:
(setq $-auto-enabled nil))
;;; REST Client
(p@ckage restclient
;;;; Build
~(straight-use-package '$)
~^
;;;; Auto mode
(add-to-list 'auto-mode-alist (cons "\\.http\\'" @'$))
@$-mode)
;;; Text
(p@ckage text
;;;; Auto mode
;; Try Text mode for files with all-uppercase filenames:
(add-to-list 'auto-mode-alist (cons "\\(/\\|\\`\\)[A-Z]+\\'" #'$-mode) :append))
;;; LS Lisp
(p@ckage ls-lisp
!^
;;;; Lisp only
(setq $-use-insert-directory-program nil)
;;;; Directories first
(setq $-dirs-first t)
;;;; Verbosity
(setq $-verbosity '(uid))
;;;; Time format
!(defconst my/$-time-regexp "[\s[:digit:]]\\{4\\} [[:alpha:]]\\{3\\} [\s[:digit:]]\\{2\\} [\s[:digit:]]\\{2\\}:[[:digit:]]\\{2\\}")
(setq $-format-time-list '(" %b %_d %k:%M"
"%Y %b %_d %k:%M")
$-use-localized-time-format t
directory-listing-before-filename-regexp (format "\\(?7:%s\\) " my/$-time-regexp))
(defvar dired-hacks-datetime-regexp)
!(setq dired-hacks-datetime-regexp my/ls-lisp-time-regexp))
;;; Dired
(p@ckage dired
~^
;;;; Auto revert
(setq $-auto-revert-buffer t)
;;;; Do what I mean
;; Suggest the directory of adjacent Dired windows as default target.
(setq $-dwim-target t)
;;;; Launch
(bind-key "<XF86Explorer>" #'$)
;;;; Switches
(setq $-listing-switches "-AlhX")
;;;; Subtree
(p@ckage $-subtree
;;;;; Build
~(straight-use-package '$)
~^
@$-toggle)
_(bind-key "i" #'$-subtree-toggle $-mode-map)
;;;; Rainbow
(p@ckage $-rainbow
;;;;; Build
~(straight-use-package '$)
~^
(setq $-ext-to-face nil)
;;;;; Rules
;;;;;; Generated
($-define generated nil ("elc"
"aux"
"o"
"class")
:append)
;;;;;; Prose
~(defconst my/$-prose-files (concat "?:\\(?1:[\sA-Z]+\\)\\|\\(?1:.*\\)\\."
(regexp-opt '("txt"
"text"
"tex"
"latex"
"org"
"md"))))
($-define prose nil my/$-prose-files
:append)
;;;;;; Cache
($-define cache nil "#.*#\\|\\.DS_Store\\|Thumbs\\.db\\|.*\\(?:~\\|\\.bak\\)"
:append)
;;;;;; Dotfile
($-define dotfile nil "\\..*" :append)
;;;;;; Executable
($-define-chmod executable nil "-[-rwx]+x[-rwx]*"
:append))
;;;; Collapse
(p@ckage $-collapse
;;;;; Build
~(straight-use-package '$)
;;;;; Face
!(defun my/$-face ()
(face-remap-add-relative 'shadow 'diredfl-dir-name))
(add-hook '$-mode-hook #'my/$-face))
;;;; Peep
;; TODO Don't delete peeped buffers that already existed before peeping
(p@ckage peep-$
;;;;; Build
~(straight-use-package '$)
~^
;;;;; Ignored extensions
(setq $-ignored-extensions '("mkv"
"iso"
"mp4"
"elc"))
;;;;; Keybindings
(keymap-set $-mode-map "p" @'$-prev-file)
(keymap-set $-mode-map "n" @'$-next-file)
@$)
_(bind-key ";" #'peep-$ $-mode-map)
;;;; Truncate lines
!(defun my/$-truncate-lines ()
(setq truncate-lines t))
(add-hook '$-mode-hook #'my/$-truncate-lines)
(add-hook 'my/visual-line-ignore-modes #'$-mode)
;;;; Font Lock
(p@ckage diredfl
;;;;; Build
~(straight-use-package '$)
;;;;; Enable
;;;;;; Dired
(add-hook 'dired-mode-hook @'$-mode)
;;;;; Ignored
;; Don't ignore any files:
(defvar dired-omit-extensions)
(setq dired-omit-extensions nil)
(setq completion-ignored-extensions nil)
(defvar $-ignore-compressed-flag)
(setq $-ignore-compressed-flag nil)))
;;; Eshell
(p@ckage eshell
;;;; Terminal
(p@ckage em-term
~^
;;;;; Visual commands
;; Commands that need to be run in a ANSI terminal emulator:
(setq eshell-visual-commands '("aptitude"
"htop"
"less"
"more"
"top")))
;;;; History
(p@ckage em-hist
~^
;;;;; Disable
(setq eshell-history-file-name "") ;`nil' would tell Eshell to use the HISTFILE environment variable.
)
;;;; Directories
(p@ckage em-dirs
~^
;; Do not save the last-dir-ring to disk:
(setq eshell-last-dir-ring-file-name nil))
;;;; Mode
(p@ckage esh-mode
(setq eshell-buffer-maximum-lines 10000)
_(add-to-list 'eshell-output-filter-functions @'eshell-truncate-buffer :append)))
;;; EXWM
;; TODO disable symb0l for window class "IceCat"/"Firefox", window type (397)
(p@ckage exwm
;;;; Build
~(straight-use-package '$)
;;;; No suspend frame
(unbind-key [remap suspend-frame])
;;;; Load
!^
;;;; Input
(p@ckage $-input
;;;;; Passthrough
(setq $-line-mode-passthrough t)
;;;;;; Button press
;; Make sure no mouse events get passed through to Emacs by treating ButtonPress as it's treated in char mode:
!(defun my/$--on-ButtonPress-line-mode (_buffer _button-event)
($--on-ButtonPress-char-mode))
(advice-add '$--on-ButtonPress-line-mode :override #'my/$--on-ButtonPress-line-mode)
;;;;; Simulation keys
;; TODO split out into separate library and use for symb0l, EXWM, and ansi-term
(define-key exwm-mode-map [remap quoted-insert] #'$-send-next-key)
!(defun my/$-fake-last-key ()
(interactive)
($--fake-key last-command-event))
(define-key exwm-mode-map [remap self-insert-command] #'my/$-fake-last-key)
!(defmacro my/$-fake-key (&rest events)
`(lambda ()
,(format-message "Equivalent to pressing `%s'." (key-description events))
(interactive)
,@(mapcar (lambda (event)
`($--fake-key ',event))
events)))
(define-key exwm-mode-map [remap delete-backward-char] (my/$-fake-key backspace))
(define-key exwm-mode-map [remap xah-delete-backward-char-or-bracket-text] (my/$-fake-key backspace))
(define-key exwm-mode-map [remap delete-char] (my/$-fake-key delete))
(define-key exwm-mode-map [remap delete-forward-char] (my/$-fake-key delete))
(define-key exwm-mode-map [remap backward-kill-word] (my/$-fake-key C-backspace))
(define-key exwm-mode-map [remap xah-backward-kill-word] (my/$-fake-key C-backspace))
(define-key exwm-mode-map [remap kill-word] (my/$-fake-key C-delete))
(define-key exwm-mode-map [remap xah-kill-word] (my/$-fake-key C-delete))
(define-key exwm-mode-map [remap kill-line] (my/$-fake-key S-end ?\C-x))
(define-key exwm-mode-map [remap kill-ring-save] (my/$-fake-key ?\C-c))
(define-key exwm-mode-map [remap xah-copy-line-or-region] (my/$-fake-key ?\C-c))
(define-key exwm-mode-map [remap kill-region] (my/$-fake-key ?\C-x))
(define-key exwm-mode-map [remap xah-cut-line-or-region] (my/$-fake-key ?\C-x))
(define-key exwm-mode-map [remap yank] (my/$-fake-key ?\C-v))
(define-key exwm-mode-map [remap xah-paste-or-paste-previous] (my/$-fake-key ?\C-v))
(define-key exwm-mode-map [remap newline] (my/$-fake-key return))
(define-key exwm-mode-map [S-return] (my/$-fake-key S-return))
(define-key exwm-mode-map [remap open-line] (my/$-fake-key return left))
(define-key exwm-mode-map [remap keyboard-quit] (my/$-fake-key escape))
(define-key exwm-mode-map [escape] (my/$-fake-key escape))
(define-key exwm-mode-map [remap next-line] (my/$-fake-key down))
(define-key exwm-mode-map [remap previous-line] (my/$-fake-key up))
(define-key exwm-mode-map [remap move-beginning-of-line] (my/$-fake-key home))
(define-key exwm-mode-map [remap xah-beginning-of-line-or-block] (my/$-fake-key home))
(define-key exwm-mode-map [remap move-end-of-line] (my/$-fake-key end))
(define-key exwm-mode-map [remap xah-end-of-line-or-block] (my/$-fake-key end))
(define-key exwm-mode-map [remap backward-char] (my/$-fake-key left))
(define-key exwm-mode-map [remap left-char] (my/$-fake-key left))
(define-key exwm-mode-map [remap forward-char] (my/$-fake-key right))