-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-core.el
More file actions
executable file
·1591 lines (1380 loc) · 50.8 KB
/
init-core.el
File metadata and controls
executable file
·1591 lines (1380 loc) · 50.8 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
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-core.el --- Personal Emacs configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2017 Aaron Harris
;; Author: Aaron Harris <meerwolf@gmail.com>
;;; Code:
;;;; Bootstrapping Variables
;;==========================
;; These variables should have been set by the bootstrapper.
(defvar aph/sync-directory "~/sync"
"The path to my Dropbox folder on the current machine.")
(defvar aph/machine 'default
"A symbol denoting the specific PC being used.")
;;;; Disable Customization
;;========================
;; Save customized settings to a file which is never loaded.
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
;;;; Display Settings
;;===================
;; Placing this close to the beginning of initialization should
;; prevent chrome from being drawn at all, rather than drawing it then
;; removing it.
(menu-bar-mode -1)
(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
;;;; Package Loading
;;==================
(add-to-list 'load-path
(expand-file-name (concat aph/sync-directory "/emacs/init")))
(require 'package)
(setq package-user-dir
(expand-file-name (concat aph/sync-directory "/emacs/elpa")))
(setq package-archives
(and (not (eq aph/machine 'mpc))
(not (eq aph/machine 'portable))
'(("elpa" . "http://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/"))))
(package-initialize)
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
(use-package aph-autoloads)
;;;; Library Packages
;;===================
(use-package advice
:defer t
:config (validate-setq ad-redefinition-action 'accept))
(use-package dash
:ensure t
:defer t
:config
(dash-enable-font-lock))
(use-package s
:ensure t
:defer t)
(use-package validate
:ensure t)
;;;; Metaconfiguration Packages
;;=============================
(use-package chimera)
(use-package fix)
(use-package hydra
:ensure t
:defer t
:config
(validate-setq lv-use-separator t))
(use-package mode-local
:config
(put 'setq-mode-local 'lisp-indent-function 1))
(use-package umbra
:bind (("C-x C-#" . umbra-mode))
:bind (:map umbra-mode-map
("<return>" . umbra-default-return-command)
("<kp-enter>" . umbra-default-kp-enter-command)
("<tab>" . umbra-default-tab-command))
:init (umbra-mode))
;;;; Configuration: Source-Level
;;==============================
(prefer-coding-system 'utf-8-unix)
(validate-setq enable-recursive-minibuffers t)
;; Personal Information
(validate-setq user-full-name "Aaron Harris"
user-mail-address "meerwolf@gmail.com")
;; UI Configuration
(validate-setq cursor-type 'box
frame-resize-pixelwise t
indicate-buffer-boundaries 'right
inhibit-startup-screen t
ring-bell-function #'ignore
scroll-conservatively 1000
scroll-margin 1
scroll-preserve-screen-position :always)
(setq resize-mini-windows t) ;; Won't validate on Emacs 25
(setq-default indent-tabs-mode nil)
;; Use Windows keys for super modifier.
(validate-setq w32-lwindow-modifier 'super
w32-rwindow-modifier 'super
w32-pass-lwindow-to-system nil
w32-pass-rwindow-to-system nil)
;; Enable some disabled commands
(dolist (command '(downcase-region
narrow-to-region
upcase-region))
(put command 'disabled nil))
;; Keybindings for source-defined commands
(bind-keys :map umbra-mode-map
("<up>" . scroll-down-line)
("<down>" . scroll-up-line)
("C-]" . other-window)
("M-i" . indent-relative)
("C-M-g" . abort-recursive-edit)
("C-M-\\" . toggle-input-method)
("C-S-t" . transpose-paragraphs)
("s-<apps> c c" . capitalize-region)
("s-<apps> c l" . downcase-region)
("s-<apps> c r" . upcase-region)
("s-<apps> k" . flush-lines)
("s-<apps> M-k" . keep-lines)
("s-<apps> <tab>" . indent-region))
;;;; Basic Packages
;;=================
(use-package align
:bind (:umbra text-mode
("C-M-i" . align-regexp))
:bind (:umbra prog-mode
("C-M-i" . align-regexp)))
(use-package aph-align
:bind (:umbra text-mode
("C-i" . aph/align))
:bind (:umbra prog-mode
("C-i" . aph/align)))
(use-package autoinsert
:init
(auto-insert-mode)
:config
;; Disable `helm' because it can't handle elisp keyword selection.
(with-eval-after-load 'helm-mode
(add-to-list 'helm-completing-read-handlers-alist
'(auto-insert . nil))
(validate-variable 'helm-completing-read-handlers-alist)))
(use-package avoid
:init
(mouse-avoidance-mode 'banish)
:config
(validate-setq mouse-avoidance-banish-position
'((frame-or-window . frame)
(side . right)
(side-pos . -50)
(top-or-bottom . bottom)
(top-or-bottom-pos . -50))))
(use-package avy
:ensure t
:bind (:map umbra-mode-map
("M-g M-q" . avy-goto-char-2)
("M-g q" . avy-goto-char)
("M-g M-g" . avy-goto-line)
("M-g M-w" . avy-goto-word-or-subword-1))
:bind (:umbra isearch-mode
("M-g" . avy-isearch))
:config
(validate-setq avy-all-windows nil
avy-background t
avy-highlight-first t
avy-style 'pre))
(use-package bind-key
:bind (:map umbra-mode-map
("C-h C-b" . describe-personal-keybindings)))
(use-package bookmark
;; Move from "C-x r" prefix to "C-c b"
:bind (:map umbra-mode-map
("C-x r b" . undefined)
("C-x r l" . undefined)
("C-x r m" . undefined)
("C-c b b" . bookmark-jump)
("C-c b l" . bookmark-bmenu-list)
("C-c b m" . bookmark-set)))
(use-package calc
:bind (:map umbra-mode-map
("C-z C-c" . calc)))
(use-package cde
:if (eq aph/machine 'mpc)
:bind (:map umbra-mode-map
("C-c C-=" . cde-format)))
(use-package color-identifiers-mode
:ensure t
:defer t
:diminish color-identifiers-mode
:init
(add-hook 'lisp-family-hook #'color-identifiers-mode)
:config
(validate-setq color-identifiers:num-colors 12
color-identifiers:color-luminance 0.65)
;; In the function `color-identifiers:clojure-declarations-in-sexp',
;; there is a call to `evenp', which is not defined; presumably, the
;; package maintainers are using `cl' in their local setup. As a
;; stopgap, I'm aliasing just `evenp' globally.
(defalias #'evenp #'cl-evenp))
(use-package company
:ensure t
:bind (:umbra company-mode
("<tab>" . company-indent-or-complete-common)
("C-<tab>" . company-complete-common))
:diminish company-mode
:init
(add-hook 'lisp-family-hook #'company-mode)
:config
(bind-keys :map company-active-map
("<tab>" . company-complete-common-or-cycle))
(validate-setq company-idle-delay nil))
(use-package crux
:ensure t
:bind
(:map umbra-mode-map
;; Local editing
("M-O" . crux-smart-open-line-above)
("C-c d" . crux-duplicate-current-line-or-region)
("C-c M-d" . crux-duplicate-and-comment-current-line-or-region)
;; Global editing
("s-<apps> w" . crux-cleanup-buffer-or-region)
;; Kill and yank
("C-<backspace>" . crux-kill-line-backwards)
("C-S-k" . crux-kill-whole-line)
("M-W" . crux-indent-rigidly-and-copy-to-clipboard)
;; Buffer and file management
("C-x <delete>" . crux-delete-file-and-buffer)
("C-x M-s" . crux-rename-file-and-buffer)
("C-;" . crux-switch-to-previous-buffer)
;; File and buffer hotkeys
("C-x <tab>" . indent-rigidly)
("C-x C-i" . crux-find-user-init-file)
("C-x C-S-i" . crux-find-shell-init-file))
:bind (:umbra emacs-lisp-mode
("C-c C-w" . crux-eval-and-replace)
("C-c C-S-z" . crux-create-scratch-buffer)))
(use-package deck
:bind (:map umbra-mode-map
("M-[" . deck-surf-swap-buffer-backward)
("M-]" . deck-surf-swap-buffer-forward)
("C-\\" . deck-push-buffer-forward)
("M-\\" . deck-pull-buffer-backward)))
(use-package delsel
:config
(delete-selection-mode))
(use-package doc-view
:bind (:umbra doc-view-mode
("C-v" . doc-view-scroll-up-or-next-page)
("M-v" . doc-view-scroll-down-or-previous-page))
:config
(setq doc-view-resolution 200)
;; On mpc, Ghostview has a different name.
(when (eq aph/machine 'mpc)
(validate-setq doc-view-ghostscript-program "mgs.exe")))
(use-package enumerate
:bind (:map umbra-mode-map
("s-<apps> n" . enumerate-lines)
("s-<apps> C-n" . enumerate-alpha)))
(use-package expand-region
:bind (:map umbra-mode-map ("C-;" . er/expand-region))
:config
(validate-setq expand-region-contract-fast-key "'"
expand-region-reset-fast-key " "))
(use-package files
:defer t
:config
(validate-setq
backup-directory-alist `(("." . ,(concat user-emacs-directory "backups")))
confirm-kill-emacs #'y-or-n-p))
(use-package aph-files
:after files
:bind (:map umbra-mode-map
("C-x k" . aph/kill-active-buffer)
("C-x C-c" . aph/delete-frame-or-exit)))
(use-package hippie-exp
:bind (:map umbra-mode-map
([remap dabbrev-expand] . hippie-expand))
:init
(setq-family-local lisp
hippie-expand-try-functions-list
'(try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-complete-lisp-symbol-partially
try-complete-lisp-symbol
try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-list
try-expand-line
try-expand-line-all-buffers)))
(use-package hl-line
:bind (:map umbra-mode-map
("C-c h l" . hl-line-mode)))
(use-package ibuffer
:bind (:map umbra-mode-map
([remap list-buffers] . ibuffer)))
(use-package aph-iimage
:bind (:umbra iimage-mode
("C-c i" . aph/iimage-refresh)))
(use-package jerk
:if (eq aph/machine 'mpc)
:bind (:map umbra-mode-map
("C-x C-y" . jerk-access-inline)))
(use-package kp-motion
:bind (:map umbra-mode-map
("C-<kp-enter>" . kp-motion-mode)))
(use-package liberate-key
:bind (:map umbra-mode-map
;; Liberating C-M-[ from legacy of escape
("<escape> <escape> <escape>" . keyboard-escape-quit)
("ESC ESC ESC" . undefined)
("M-ESC :" . undefined))
:demand t
:config
;; Key liberation
(liberate-key-escape)
(add-hook 'after-make-frame-functions #'liberate-key-escape)
;; Map <kp-enter> to <return> rather than to RET (C-m)
(define-key function-key-map (kbd "<kp-enter>") (kbd "<return>")))
(use-package minibuffer
:bind (:map umbra-mode-map
("C-<tab>" . completion-at-point))
:config
(validate-setq completion-auto-help 'lazy))
(use-package page
:config
(put 'narrow-to-page 'disabled nil))
(use-package aph-page
:commands (aph/hydra-page/forward-page
aph/hydra-page/backward-page)
:init
(bind-keys :map umbra-mode-map
([remap forward-page] . aph/hydra-page/forward-page)
([remap backward-page] . aph/hydra-page/backward-page)))
(use-package paren
:config
(show-paren-mode))
(use-package populate
:bind (:map umbra-mode-map
("s-<apps> p" . populate-downwards-in-region)))
(use-package prog-mode
:bind (:umbra prog-mode
("M-p" . backward-paragraph)
("M-n" . forward-paragraph)))
(use-package rainbow-delimiters
:ensure t
:defer t
:init
(add-hook 'lisp-family-hook #'rainbow-delimiters-mode))
(use-package rect
;; Move from "C-x r" prefix to "C-c r"
:bind (:map umbra-mode-map
("C-x r N" . undefined)
("C-x r c" . undefined)
("C-x r d" . undefined)
("C-x r k" . undefined)
("C-x r o" . undefined)
("C-x r r" . undefined)
("C-x r t" . undefined)
("C-x r y" . undefined)
("C-c r n" . rectangle-number-lines)
("C-c r c" . clear-rectangle)
("C-c r d" . delete-rectangle)
("C-c r k" . kill-rectangle)
("C-c r o" . open-rectangle)
("C-c r r" . copy-rectangle-to-register)
("C-c r t" . string-rectangle)
("C-c r y" . yank-rectangle)))
(use-package aph-rect
:after rect
:bind (:map umbra-mode-map
("C-M-y" . aph/yank-rectangle-from-kill-ring)))
(use-package register
:bind (:map umbra-mode-map
("C-m" . copy-to-register)
("C-M-m" . increment-register)))
(use-package saveplace
:config
(setq-default save-place t)
(validate-setq save-place-file (concat user-emacs-directory "places")))
(use-package simple
:demand t
:bind (:map umbra-mode-map
("C-M-/" . undo-only)
("C-`" . next-error)
("C-x M-k" . append-next-kill)
("M-= l" . what-line)
("M-= w" . count-words)
("M-SPC" . mark-word)
("M-`" . previous-error)
("M-o" . join-line)
("S-<return>" . delete-blank-lines)
("S-SPC" . cycle-spacing))
:config
;; Global minor modes
(column-number-mode 1)
;; Misc. settings
(validate-setq save-interprogram-paste-before-kill t
shift-select-mode nil)
;; Tweaking `eval-expression'
(validate-setq eval-expression-print-length nil
eval-expression-print-level nil))
(use-package aph-simple
:after simple
:bind (:map umbra-mode-map
("C-a" . aph/move-beginning-of-line)
([remap open-line] . aph/open-line)))
(use-package smart-tab
:ensure t
:diminish smart-tab-mode
:config
(global-smart-tab-mode 1)
(validate-setq smart-tab-disabled-major-modes
(remove 'org-mode smart-tab-disabled-major-modes))
(validate-setq smart-tab-using-hippie-expand t
smart-tab-completion-functions-alist nil)
;; Use `hippie-expand' in elisp buffers.
(validate-setq smart-tab-completion-functions-alist
(assq-delete-all 'emacs-lisp-mode
smart-tab-completion-functions-alist)))
(use-package smartparens
:ensure t
:bind (:umbra smartparens-mode
;; Movement
([remap backward-sexp] . sp-backward-sexp)
([remap forward-sexp] . sp-forward-sexp)
([remap backward-up-list] . sp-backward-up-sexp)
([remap down-list] . sp-down-sexp)
([remap forward-list] . sp-next-sexp)
([remap backward-list] . sp-previous-sexp)
("M-B" . sp-backward-symbol)
("M-F" . sp-forward-symbol)
;; Selection
([remap mark-sexp] . sp-select-next-thing-exchange)
;; Barf and Slurp
("C-M-[" . sp-forward-barf-sexp)
("C-M-]" . sp-forward-slurp-sexp)
("M-{" . sp-backward-slurp-sexp)
("M-}" . sp-backward-barf-sexp)
("C-{" . sp-absorb-sexp)
("C-}" . sp-emit-sexp)
("M-A" . sp-extract-before-sexp)
("M-E" . sp-extract-after-sexp)
;; Kill and Copy
([remap kill-sexp] . sp-kill-sexp)
("C-M-<backspace>" . sp-backward-kill-sexp)
("C-M-w" . sp-copy-sexp)
("M-K" . sp-splice-sexp-killing-around)
;; Editing
([remap transpose-sexps] . sp-transpose-sexp)
("M-T" . sp-convolute-sexp)
;; Unwrap and Splice
("M-D" . sp-unwrap-sexp)
("M-S-<delete>" . sp-unwrap-sexp)
("M-S-<backspace>" . sp-backward-unwrap-sexp)
("M-U" . sp-splice-sexp)
("M-R" . sp-rewrap-sexp)
("M-S" . sp-split-sexp)
("M-J" . sp-join-sexp)
;; Indentation
("C-M-q" . sp-indent-defun)
;; Narrowing
("C-x n (" . sp-narrow-to-sexp)
;; Prefix Arguments
("C-S-u SPC" . sp-prefix-save-excursion)
("C-S-u '" . sp-prefix-symbol-object)
("C-S-u (" . sp-prefix-pair-object)
("C-S-u [" . sp-prefix-pair-object)
("C-S-u ," . sp-prefix-tag-object))
:bind (:umbra smartparens-strict-mode
(")" . sp-up-sexp)
("]" . sp-up-sexp)
("}" . sp-up-sexp))
:init
(require 'smartparens-config)
(smartparens-global-mode)
(add-hook 'lisp-family-hook #'smartparens-strict-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'smartparens-strict-mode)
:config
;; String handling
(add-to-list 'sp-navigate-consider-stringlike-sexp 'org-mode)
(add-to-list 'sp-navigate-consider-stringlike-sexp 'lisp-mode)
(add-to-list 'sp-navigate-consider-stringlike-sexp 'clojure-mode)
(setq sp-cancel-autoskip-on-backward-movement nil)
;; Disable '' pair in minibuffer for `eval-expression'
(sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
;; Use `` instead of `' in Clojure mode
(sp-local-pair 'clojure-mode "`" "`"
:when '(sp-in-string-p sp-in-comment-p)))
(use-package aph-smartparens
:bind (:umbra smartparens-mode
("M-k" . aph/sp-kill-sentence)))
(use-package smartscan
:ensure t
:bind (:umbra smartscan-mode
("C-M-r" . smartscan-symbol-go-backward)
("C-M-s" . smartscan-symbol-go-forward)
("C-M-'" . smartscan-symbol-replace))
:init
(add-hook 'text-mode-hook #'smartscan-mode)
(add-hook 'prog-mode-hook #'smartscan-mode))
(use-package solar
:defer t
:config
(validate-setq calendar-longitude -93.2
calendar-latitude 45.0))
(use-package sort
:bind (:map umbra-mode-map
("s-<apps> d" . delete-duplicate-lines)
("s-<apps> s" . sort-lines)))
(use-package source-lock
:config
(when (eq aph/machine 'mpc)
(validate-setq source-lock-directories
'("C:/Program Files (Portable)/Emacs/share/emacs")))
(source-lock-mode t))
(use-package text-mode
:bind (:umbra text-mode
("M-p" . backward-paragraph)
("M-n" . forward-paragraph)))
(use-package tidy
:bind (:map umbra-mode-map
("C-c q" . tidy-buffers)))
(use-package tooltip
:config
(tooltip-mode -1))
(use-package unicode-fonts
:ensure t
:config
(unicode-fonts-setup))
(use-package uniquify
:config
;; Snippet from http://pragmaticemacs.com/emacs/uniquify-your-buffer-names/
(validate-setq uniquify-buffer-name-style 'forward
uniquify-separator "/"
uniquify-after-kill-buffer-p t
uniquify-ignore-buffers-re "^\\*"))
(use-package vc
:config
(add-to-list 'vc-directory-exclusion-list ".stack-work")
(validate-variable 'vc-directory-exclusion-list))
(use-package aph-vc
:bind (:map umbra-mode-map
("C-x v <delete>" . aph/vc-delete-file))
:bind (:umbra vc-dir-mode
("<delete>" . aph/vc-dir-delete-file)))
(use-package view
:bind (:map umbra-mode-map
([remap scroll-up-command] . View-scroll-half-page-forward)
([remap scroll-down-command] . View-scroll-half-page-backward)))
(use-package visible-mark
:ensure t
:init
(defface visible-mark-active
'((t (:underline "magenta")))
"Face for the active mark. Preempts default definition."
:group 'visible-mark)
:config
(global-visible-mark-mode 1)
(defface aph/visible-mark-top
'((t (:underline "light salmon")))
"Face for the most recent inactive mark."
:group 'visible-mark)
(defface aph/visible-mark-other
'((t (:underline "light goldenrod")))
"Face for marks other than the most recent."
:group 'visible-mark)
(validate-setq visible-mark-max 2
visible-mark-faces '(aph/visible-mark-top
aph/visible-mark-other)))
(use-package visual-regexp
:ensure t
:bind (:map umbra-mode-map
("C-'" . vr/query-replace)
("M-'" . vr/replace))
:config
(validate-setq vr/auto-show-help nil))
(use-package volatile-highlights
:ensure t
:diminish volatile-highlights-mode
:init
(volatile-highlights-mode 1))
(use-package which-func
:init
(which-function-mode 1))
(use-package which-func-header
:after which-func
:config
(add-hook 'prog-mode-hook #'which-func-header-mode)
(add-hook 'org-mode-hook #'which-func-header-mode))
(use-package aph-which-func
:after which-func
:config
(add-to-list 'which-func-functions #'aph/which-function-org))
(use-package window
:bind (:map umbra-mode-map
("C-S-l" . move-to-window-line-top-bottom)))
(use-package aph-window
:bind (:map umbra-mode-map
("C-x \\" . aph/toggle-dedicated-window)
("<C-[>" . aph/other-window-backward)
("C-M-v" . aph/hydra-scroll-other/body)))
(use-package winner
:config
(winner-mode))
(use-package xahk-mode
:mode "\\.ahk\\'")
;;;; Emacs Lisp
;;=============
(use-package canary
:bind (:map umbra-mode-map
("C-h h" . canary-hooks)))
(use-package clean-eval
:bind (:umbra inferior-emacs-lisp-mode
("C-'" . clean-eval-mode))
:init
(when (eq aph/machine 'mpc)
(clean-eval-mode t)))
(use-package eldoc
:defer t
:diminish eldoc-mode
:init
(add-hook 'lisp-family-hook #'eldoc-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode))
(use-package ert
:bind (:umbra emacs-lisp-mode
("C-c C-t" . ert))
:init
(add-to-list 'load-path (expand-file-name (concat aph/sync-directory
"/emacs/init/test")))
(validate-variable 'load-path))
(use-package ielm
:config
(mode-family-add 'ielm-mode 'lisp))
(use-package aph-ielm
:bind (:umbra inferior-emacs-lisp-mode
("C-c C-w" . aph/ielm-copy-last-output)))
(use-package ielm-repl
:bind (:umbra emacs-lisp-mode
("C-c C-z" . ielm-repl))
:bind (:umbra inferior-emacs-lisp-mode
("C-c C-z" . ielm-repl-switch-back)))
(use-package lisp-mode
:bind (:umbra emacs-lisp-mode
("C-c p C-u" . update-directory-autoloads))
:config
;; Mode tags
(mode-family-add 'lisp-mode 'lisp)
(mode-family-add 'emacs-lisp-mode 'lisp)
(mode-family-add 'lisp-interaction-mode 'lisp)
;; Add `use-package' blocks to Imenu
(add-to-list 'lisp-imenu-generic-expression
'("Package"
"^(use-package\\s-+\\(\\_<.+?\\_>\\)"
1))
;; Add `defhydra's to Imenu
(add-to-list 'lisp-imenu-generic-expression
'("Hydra"
"^(defhydra\\s-+\\(\\_<.+?\\_>\\)"
1))
;; Add `ert' tests to Imenu
(add-to-list 'lisp-imenu-generic-expression
'("Test"
"^(ert-deftest\\s-+\\(\\_<.+?\\_>\\)"
1))
(validate-variable 'lisp-imenu-generic-expression))
(use-package aph-lisp-mode
:after lisp-mode
:bind (:umbra emacs-lisp-mode
("C-c C-l" . aph/eval-region-or-buffer))
:config
(validate-setq lisp-indent-function #'aph/lisp-indent-function)
(add-hook 'emacs-lisp-mode-hook #'aph/emacs-lisp-add-font-lock-keywords))
(use-package pp
:bind (:umbra emacs-lisp-mode
("C-c C-m" . pp-macroexpand-last-sexp))
:bind (:map umbra-mode-map
("C-:" . pp-eval-expression)
("C-M-:" . pp-macroexpand-expression)))
;;;; Helm and Projectile
;;======================
;; Helm core modules
(use-package helm
:ensure t
:demand t
:bind (:map umbra-mode-map
("M-x" . helm-M-x)
("M-y" . helm-show-kill-ring)
("M-m" . helm-register)
("C-c b b" . helm-filtered-bookmarks)
("M-." . helm-semantic-or-imenu)
("M-s o" . helm-occur)
("M-," . helm-all-mark-rings)
([remap switch-to-buffer] . helm-mini)
([remap find-file] . helm-find-files)
("M-s g" . helm-do-grep)
("C-h C-f" . helm-colors)
([remap manual-entry] . helm-man-woman)
("C-h C-i" . helm-info-at-point)
([remap apropos-command] . helm-apropos)
("C-z C-s" . helm-google-suggest)
("C-z M-c" . helm-calcul-expression)
("C-z C-p" . helm-list-elisp-packages)
("C-x ," . helm-resume))
:bind (:map umbra-mode-helm-map
("<tab>" . helm-execute-persistent-action)
("C-j" . undefined)
("C-z" . undefined)
("s-<apps>" . helm-select-action)))
(use-package helm-buffers
:config
(setq helm-mini-default-sources
'(helm-source-buffers-list
helm-source-recentf
helm-source-files-in-current-dir
helm-source-bookmarks
helm-source-buffer-not-found)))
(use-package helm-config
:after helm
:diminish helm-mode
:bind (:map umbra-mode-map
("C-x c" . undefined)
("C-x x" . helm-command-prefix))
:config
(helm-mode 1)
(helm-autoresize-mode t)
(validate-setq helm-scroll-amount 8
helm-split-window-in-side-p t
helm-ff-file-name-history-use-recentf t
helm-ff-search-library-in-sexp t)
;; Info pages to use for `helm-info-at-point'.
(put 'helm-info-default-sources 'custom-type '(repeat symbol))
(validate-setq helm-info-default-sources
'(helm-source-info-emacs
helm-source-info-elisp
helm-source-info-cl
helm-source-info-eieio
helm-source-info-org
helm-source-info-pages))
;; Turn Helm off for Org-mode refiling, since Helm can't handle
;; multiple levels of refile targets. We also need to turn off
;; capture to use `aph/org-capture-choose-targets'.
(add-to-list 'helm-completing-read-handlers-alist '(org-capture . nil))
(add-to-list 'helm-completing-read-handlers-alist '(org-refile . nil))
(validate-variable 'helm-completing-read-handlers-alist))
(use-package vizier-helm
:bind (:map umbra-mode-helm-map
("<return>" . vizier-helm-resume-update-or-exit-minibuffer)))
;; Projectile
(use-package projectile
:after helm
:ensure t
:bind (:map umbra-mode-map
("C-x M-p" . projectile-switch-project))
:config
(projectile-global-mode)
(validate-setq projectile-completion-system 'helm
projectile-switch-project-action #'helm-projectile
projectile-enable-caching t)
(helm-projectile-on))
(use-package aph-projectile
:after projectile
:config
(bind-keys
:penumbra prog-mode
("C-c C-t" .
(chimera "chimera/projectile-test-project"
(when (aph/projectile-call-with-project #'projectile-test-command)
#'projectile-test-project)))
("C-c f t" .
(chimera "chimera/projectile-find-implementation-or-test-other-window"
(when (projectile-project-p)
#'projectile-find-implementation-or-test-other-window))))
(validate-setq projectile-test-prefix-function #'aph/projectile-test-prefix
projectile-test-suffix-function #'aph/projectile-test-suffix)
;; Register a project type for this project
(projectile-register-project-type
'emacs-init '("init-core.el") nil (lambda () (ert t)))
(push '(emacs-init . (nil . "-test")) aph/projectile-test-alist))
(use-package helm-projectile
:ensure t
:defer t)
(use-package aph-helm
:bind (:map umbra-mode-map
("M-." . aph/helm-semantic-or-imenu)
("C-x p" . aph/helm-projectile)
("M-s M-g" . aph/helm-projectile-grep)))
;; Helm add-ons
(use-package helm-descbinds
:ensure t
:after helm
:config (helm-descbinds-mode))
;;;; Help and Info
;;================
(use-package find-func
:bind (:map umbra-mode-map
("C-h C-M-f" . find-function)
("C-h C-M-k" . find-function-on-key)
("C-h C-M-v" . find-variable)
("C-h M-F" . find-face-definition)
("C-h C-M-l" . find-library)))
(use-package aph-help
:after help
:bind (:map umbra-mode-map
("C-h C-h" . aph/help-describe-bindings))
:config
(add-hook 'help-mode-hook #'activate-mode-local-bindings)
(setq-mode-local help-mode
revert-buffer-function
#'aph/help-mode-revert-buffer))
(use-package help+
:ensure t
:after help)
(use-package help-mode+
:ensure t
:after help-mode)
(use-package help-fns+
:after help-fns
:bind (:map umbra-mode-map
("C-h c" . describe-key-briefly)
("C-h M-b" . describe-buffer)
("M-= b" . describe-buffer))
:config
;; Add Org manual to list of manuals to include links for in help.
;; This is a stopgap measure. In the long run, keying in to
;; `Info-file-list-for-emacs' is probably the way to go.
(validate-setq help-cross-reference-manuals '(("emacs" "elisp" "org"))))
(use-package info
:defer t
:config
;; Improves functionality of `C-h F' for Org commands.
(add-to-list 'Info-file-list-for-emacs "org")
(validate-variable 'Info-file-list-for-emacs))
(use-package aph-info
:bind (:map umbra-mode-map
("C-h i" . aph/info-mode-or-clone-buffer))
:bind (:umbra Info-mode
("0" . aph/Info-final-menu-item)))
;;;; Org and Outline
;;==================
;; Core modules
(use-package outline
:bind (:penumbra outline-mode
("C-M-b" . outline-backward-same-level)
("C-M-f" . outline-forward-same-level)
("C-M-n" . outline-next-visible-heading)
("C-M-p" . outline-previous-visible-heading)
("C-M-u" . outline-up-heading)))
(use-package aph-outline
:bind (:penumbra outline-mode
("C-M-d" . aph/outline-down-heading-from-end)
("C-M-a" . aph/outline-get-first-sibling)
("C-M-e" . aph/outline-get-final-sibling)))
(use-package org
:ensure t
:bind (:map umbra-mode-map
("C-c l" . org-store-link))
:bind (:umbra org-mode
("C-c [" . undefined)
("C-c ]" . org-cycle-agenda-files)
("M-." . helm-org-in-buffer-headings)
;; Following bindings restore `org-mode' keys
;; unintentionally shadowed by `umbra-mode'
("C-o" . org-open-line))
:bind (:penumbra org-mode
("C-M-[" . org-metaleft)
("C-M-]" . org-metaright)
("C-M-t" . org-metaup))