summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-03-01 12:13:28 -0600
committerCase Duckworth2021-03-01 12:13:28 -0600
commitcb2982c3cbc9360929845801724befe5302be37d (patch)
tree3e308f518ceeefbc324109e80ec91b84653a989d
parentDon't be smart about bootstrapping straight.el (diff)
downloademacs-cb2982c3cbc9360929845801724befe5302be37d.tar.gz
emacs-cb2982c3cbc9360929845801724befe5302be37d.zip
Re-indent
-rw-r--r--init.el361
1 files changed, 188 insertions, 173 deletions
diff --git a/init.el b/init.el index 9808ae2..2eef38e 100644 --- a/init.el +++ b/init.el
@@ -67,23 +67,23 @@
67;; Minibuffer 67;; Minibuffer
68(setq-default 68(setq-default
69 minibuffer-prompt-properties '(read-only t 69 minibuffer-prompt-properties '(read-only t
70 cursor-intangible t 70 cursor-intangible t
71 face minibuffer-prompt) 71 face minibuffer-prompt)
72 enable-recursive-minibuffers t 72 enable-recursive-minibuffers t
73 file-name-shadow-properties '(invisible t)) 73 file-name-shadow-properties '(invisible t))
74(file-name-shadow-mode +1) 74(file-name-shadow-mode +1)
75(minibuffer-depth-indicate-mode +1) 75(minibuffer-depth-indicate-mode +1)
76 76
77(use-package savehist 77(use-package savehist
78 :straight nil 78 :straight nil
79 :init 79 :init
80 (setq-default 80 (setq-default
81 savehist-file (expand-file-name "history" acdw/var-dir) 81 savehist-file (expand-file-name "history" acdw/var-dir)
82 savehist-additional-variables '(kill-ring search-ring regexp-search-ring) 82 savehist-additional-variables '(kill-ring search-ring regexp-search-ring)
83 history-length t 83 history-length t
84 history-delete-duplicates t 84 history-delete-duplicates t
85 savehist-autosave-interval 60) 85 savehist-autosave-interval 60)
86 :config (savehist-mode +1)) 86 :config (savehist-mode +1))
87 87
88;; Backups 88;; Backups
89(setq-default backup-by-copying t 89(setq-default backup-by-copying t
@@ -101,63 +101,64 @@
101(setq-default create-lockfiles nil) ; Are these necessary? 101(setq-default create-lockfiles nil) ; Are these necessary?
102 102
103;; Autosaves 103;; Autosaves
104(setq auto-save-default nil ; Don't use `auto-save' system
105 )
104(use-package super-save 106(use-package super-save
105 :defer 5 ; This package can wait 107 :defer 5 ; This package can wait
106 :init 108 :init
107 (setq-default 109 (setq-default
108 auto-save-default nil ; Don't use `auto-save' system 110 super-save-remote-files nil ; Don't save remote files
109 super-save-remote-files nil ; Don't save remote files 111 super-save-exclude '(".gpg") ; Wouldn't work anyway
110 super-save-exclude '(".gpg") ; Wouldn't work anyway 112 super-save-auto-save-when-idle t)
111 super-save-auto-save-when-idle t) 113 :config
112 :config 114 (super-save-mode +1))
113 (super-save-mode +1))
114 115
115;; Auto-revert 116;; Auto-revert
116(global-auto-revert-mode +1) ; Automatically revert a file 117(global-auto-revert-mode +1) ; Automatically revert a file
117 ; to its on-disk contents 118 ; to its on-disk contents
118 119
119(use-package saveplace 120(use-package saveplace
120 :straight nil 121 :straight nil
121 :init 122 :init
122 (setq-default 123 (setq-default
123 save-place-file (expand-file-name "places" acdw/var-dir) 124 save-place-file (expand-file-name "places" acdw/var-dir)
124 save-place-forget-unreadable-files (eq acdw/system :home)) 125 save-place-forget-unreadable-files (eq acdw/system :home))
125 :config (save-place-mode +1)) 126 :config (save-place-mode +1))
126 127
127(use-package recentf 128(use-package recentf
128 :straight nil 129 :straight nil
129 :init 130 :init
130 (setq recentf-save-file (expand-file-name "recentf" acdw/var-dir) 131 (setq recentf-save-file (expand-file-name "recentf" acdw/var-dir)
131 recentf-max-menu-items 100 132 recentf-max-menu-items 100
132 recentf-max-saved-items nil 133 recentf-max-saved-items nil
133 recentf-auto-cleanup 'never) 134 recentf-auto-cleanup 'never)
134 (defun maybe-save-recentf () 135 (defun maybe-save-recentf ()
135 "Save `recentf-file' every five minutes, but only when out of focus." 136 "Save `recentf-file' every five minutes, but only when out of focus."
136 (defvar recentf--last-save (time-convert nil 'integer) 137 (defvar recentf--last-save (time-convert nil 'integer)
137 "When we last saved the `recentf-save-list'.") 138 "When we last saved the `recentf-save-list'.")
138 139
139 (when (> (time-convert (time-since recentf--last-save) 'integer) 140 (when (> (time-convert (time-since recentf--last-save) 'integer)
140 (* 60 5)) 141 (* 60 5))
141 (setq-default recentf--last-save (time-convert nil 'integer)) 142 (setq-default recentf--last-save (time-convert nil 'integer))
142 (when-unfocused #'recentf-save-list))) 143 (when-unfocused #'recentf-save-list)))
143 :config 144 :config
144 (recentf-mode +1) 145 (recentf-mode +1)
145 (add-to-list 'recentf-exclude acdw/var-dir) 146 (add-to-list 'recentf-exclude acdw/var-dir)
146 (add-to-list 'recentf-exclude acdw/etc-dir) 147 (add-to-list 'recentf-exclude acdw/etc-dir)
147 (add-function :after after-focus-change-function 148 (add-function :after after-focus-change-function
148 #'maybe-save-recentf)) 149 #'maybe-save-recentf))
149 150
150 151
151;; Uniquify 152;; Uniquify
152(use-package uniquify 153(use-package uniquify
153 :straight nil 154 :straight nil
154 :init 155 :init
155 (setq-default 156 (setq-default
156 uniquify-buffer-name-style 'forward ; bubble 'up' the directory tree 157 uniquify-buffer-name-style 'forward ; bubble 'up' the directory tree
157 uniquify-separator "/" ; separate path elements 158 uniquify-separator "/" ; separate path elements
158 uniquify-after-kill-buffer-p t ; hook into buffer kills 159 uniquify-after-kill-buffer-p t ; hook into buffer kills
159 uniquify-ignore-buffers-re "^\\*" ; don't worry about special buffers 160 uniquify-ignore-buffers-re "^\\*" ; don't worry about special buffers
160 )) 161 ))
161 162
162;; Scratch 163;; Scratch
163(setq-default 164(setq-default
@@ -253,10 +254,10 @@
253(add-hook 'visual-line-mode-hook #'hook--visual-line-fix-org-keys) 254(add-hook 'visual-line-mode-hook #'hook--visual-line-fix-org-keys)
254 255
255(use-package visual-fill-column 256(use-package visual-fill-column
256 :init (setq-default visual-fill-column-center-text t) 257 :init (setq-default visual-fill-column-center-text t)
257 :hook visual-fill-column-mode 258 :hook visual-fill-column-mode
258 :config 259 :config
259 (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust)) 260 (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust))
260 261
261(when (fboundp 'global-so-long-mode) 262(when (fboundp 'global-so-long-mode)
262 (global-so-long-mode +1)) 263 (global-so-long-mode +1))
@@ -273,7 +274,7 @@
273 tab-width 8) 274 tab-width 8)
274 275
275(use-package smart-tabs-mode 276(use-package smart-tabs-mode
276 :config 277 :config
277 (smart-tabs-insinuate 'c 'c++ 'java 'javascript 'cperl 'python 'ruby 'nxml)) 278 (smart-tabs-insinuate 'c 'c++ 'java 'javascript 'cperl 'python 'ruby 'nxml))
278 279
279;; Window layouts 280;; Window layouts
@@ -305,37 +306,37 @@
305;; Theming 306;; Theming
306 307
307(use-package form-feed 308(use-package form-feed
308 :config (global-form-feed-mode +1)) 309 :config (global-form-feed-mode +1))
309 310
310(use-package modus-themes 311(use-package modus-themes
311 :straight (:host gitlab :repo "protesilaos/modus-themes") 312 :straight (:host gitlab :repo "protesilaos/modus-themes")
312 :demand 313 :demand
313 :init 314 :init
314 (setq-default modus-themes-slanted-constructs t 315 (setq-default modus-themes-slanted-constructs t
315 modus-themes-bold-constructs t 316 modus-themes-bold-constructs t
316 modus-themes-region 'bg-only 317 modus-themes-region 'bg-only
317 modus-themes-org-blocks 'grayscale 318 modus-themes-org-blocks 'grayscale
318 modus-themes-headings '((1 . section) 319 modus-themes-headings '((1 . section)
319 (t . no-color)) 320 (t . no-color))
320 modus-themes-scale-headings nil 321 modus-themes-scale-headings nil
321 modus-themes-mode-line nil) 322 modus-themes-mode-line nil)
322 :custom-face 323 :custom-face
323 (modus-theme-heading-1 324 (modus-theme-heading-1
324 ((t (:inherit (modus-theme-heading-1 fixed-pitch bold))))) 325 ((t (:inherit (modus-theme-heading-1 fixed-pitch bold)))))
325 (modus-theme-heading-2 326 (modus-theme-heading-2
326 ((t (:inherit (modus-theme-heading-2 fixed-pitch bold))))) 327 ((t (:inherit (modus-theme-heading-2 fixed-pitch bold)))))
327 (modus-theme-heading-3 328 (modus-theme-heading-3
328 ((t (:inherit (modus-theme-heading-3 fixed-pitch bold))))) 329 ((t (:inherit (modus-theme-heading-3 fixed-pitch bold)))))
329 (modus-theme-heading-4 330 (modus-theme-heading-4
330 ((t (:inherit (modus-theme-heading-4 fixed-pitch bold))))) 331 ((t (:inherit (modus-theme-heading-4 fixed-pitch bold)))))
331 (modus-theme-heading-5 332 (modus-theme-heading-5
332 ((t (:inherit (modus-theme-heading-5 fixed-pitch bold))))) 333 ((t (:inherit (modus-theme-heading-5 fixed-pitch bold)))))
333 (modus-theme-heading-6 334 (modus-theme-heading-6
334 ((t (:inherit (modus-theme-heading-6 fixed-pitch bold))))) 335 ((t (:inherit (modus-theme-heading-6 fixed-pitch bold)))))
335 (modus-theme-heading-7 336 (modus-theme-heading-7
336 ((t (:inherit (modus-theme-heading-7 fixed-pitch bold))))) 337 ((t (:inherit (modus-theme-heading-7 fixed-pitch bold)))))
337 (modus-theme-heading-8 338 (modus-theme-heading-8
338 ((t (:inherit (modus-theme-heading-8 fixed-pitch bold)))))) 339 ((t (:inherit (modus-theme-heading-8 fixed-pitch bold))))))
339 340
340;; Change themes based on time of day 341;; Change themes based on time of day
341 342
@@ -364,12 +365,12 @@
364 #'modus-themes-load-vivendi) 365 #'modus-themes-load-vivendi)
365 366
366(use-package minions 367(use-package minions
367 :config (minions-mode +1)) 368 :config (minions-mode +1))
368 369
369(which-function-mode +1) 370(which-function-mode +1)
370 371
371(use-package which-key 372(use-package which-key
372 :config (which-key-mode +1)) 373 :config (which-key-mode +1))
373 374
374(delete-selection-mode +1) 375(delete-selection-mode +1)
375 376
@@ -383,14 +384,13 @@
383 ) 384 )
384 385
385(use-package smartscan 386(use-package smartscan
386 :config 387 :config (global-smartscan-mode +1))
387 (global-smartscan-mode +1))
388 388
389(when (fboundp 'global-goto-address-mode) 389(when (fboundp 'global-goto-address-mode)
390 (global-goto-address-mode +1)) 390 (global-goto-address-mode +1))
391 391
392(use-package flyspell 392(use-package flyspell
393 :init 393 :init
394 (setenv "LANG" "en_US") 394 (setenv "LANG" "en_US")
395 (setq-default ispell-program-name "hunspell" 395 (setq-default ispell-program-name "hunspell"
396 ispell-dictionary "en_US" 396 ispell-dictionary "en_US"
@@ -404,7 +404,7 @@
404 (write-region "" nil ispell-personal-dictionary nil 0))) 404 (write-region "" nil ispell-personal-dictionary nil 0)))
405 405
406(use-package flyspell-correct 406(use-package flyspell-correct
407 :bind ("C-;" . flyspell-correct-wrapper)) 407 :bind ("C-;" . flyspell-correct-wrapper))
408 408
409(setq-default show-paren-delay 0 409(setq-default show-paren-delay 0
410 show-paren-style 'mixed 410 show-paren-style 'mixed
@@ -425,20 +425,20 @@
425 compilation-scroll-output 'first-error) 425 compilation-scroll-output 'first-error)
426 426
427(use-package reformatter 427(use-package reformatter
428 :demand) 428 :demand)
429 429
430;; Shell scripts 430;; Shell scripts
431(setq-default sh-basic-offset 8 431(setq-default sh-basic-offset 8
432 smie-indent-basic 8) 432 smie-indent-basic 8)
433 433
434(use-package flymake-shellcheck 434(use-package flymake-shellcheck
435 :when (executable-find "shellcheck") 435 :when (executable-find "shellcheck")
436 :hook sh-mode) 436 :hook sh-mode)
437 437
438(when (executable-find "shfmt") 438(when (executable-find "shfmt")
439 (reformatter-define sh-format 439 (reformatter-define sh-format
440 :program "shfmt" 440 :program "shfmt"
441 :lighter "Shfmt") 441 :lighter "Shfmt")
442 (add-hook 'sh-mode-hook #'sh-format-on-save-mode)) 442 (add-hook 'sh-mode-hook #'sh-format-on-save-mode))
443 443
444(bind-key "M-/" #'hippie-expand) 444(bind-key "M-/" #'hippie-expand)
@@ -456,27 +456,27 @@
456 456
457;; Smart hungry delete 457;; Smart hungry delete
458(use-package smart-hungry-delete 458(use-package smart-hungry-delete
459 :defer nil 459 :defer nil
460 :bind (("<backspace>" . smart-hungry-delete-backward-char) 460 :bind (("<backspace>" . smart-hungry-delete-backward-char)
461 ("C-d" . smart-hungry-delete-forward-char)) 461 ("C-d" . smart-hungry-delete-forward-char))
462 :config (smart-hungry-delete-add-default-hooks)) 462 :config (smart-hungry-delete-add-default-hooks))
463 463
464;; Enable all commands 464;; Enable all commands
465(setq-default disabled-command-function nil) 465(setq-default disabled-command-function nil)
466 466
467;; Magit 467;; Magit
468(use-package magit 468(use-package magit
469 :bind ("C-z g" . magit-status)) 469 :bind ("C-z g" . magit-status))
470 470
471;; crux 471;; crux
472(use-package crux 472(use-package crux
473 :straight (:host github :repo "bbatsov/crux") 473 :straight (:host github :repo "bbatsov/crux")
474 :bind 474 :bind
475 ("M-o" . crux-other-window-or-switch-buffer) 475 ("M-o" . crux-other-window-or-switch-buffer)
476 :config 476 :config
477 (crux-with-region-or-line kill-ring-save) 477 (crux-with-region-or-line kill-ring-save)
478 (crux-with-region-or-line kill-region) 478 (crux-with-region-or-line kill-region)
479 (crux-with-region-or-line comment-or-uncomment-region)) 479 (crux-with-region-or-line comment-or-uncomment-region))
480 480
481;; Completion and... stuff 481;; Completion and... stuff
482(setq-default 482(setq-default
@@ -485,7 +485,7 @@
485 read-file-name-completion-ignore-case t) 485 read-file-name-completion-ignore-case t)
486 486
487(use-package icomplete-vertical 487(use-package icomplete-vertical
488 :demand 488 :demand
489 :init 489 :init
490 (setq-default 490 (setq-default
491 icomplete-delay-completions-threshold 0 491 icomplete-delay-completions-threshold 0
@@ -507,67 +507,82 @@
507 (icomplete-vertical-mode +1)) 507 (icomplete-vertical-mode +1))
508 508
509(use-package orderless 509(use-package orderless
510 :after icomplete 510 :after icomplete
511 :init (setq-default completion-styles '(orderless))) 511 :init (setq-default completion-styles '(orderless)))
512 512
513(use-package marginalia 513(use-package marginalia
514 :after icomplete 514 :after icomplete
515 :init (setq-default marginalia-annotators 515 :init (setq-default marginalia-annotators
516 '(marginalia-annotators-heavy 516 '(marginalia-annotators-heavy
517 marginalia-annotators-light)) 517 marginalia-annotators-light))
518 :config (marginalia-mode +1)) 518 :config (marginalia-mode +1))
519 519
520(use-package consult 520(use-package consult
521 :after icomplete 521 :after icomplete
522 :bind (;; C-c bindings (mode-specific-map) 522 :bind (;; C-c bindings (mode-specific-map)
523 ("C-c h" . consult-history) 523 ("C-c h" . consult-history)
524 ("C-c m" . consult-mode-command) 524 ("C-c m" . consult-mode-command)
525 ("C-c b" . consult-bookmark) 525 ("C-c b" . consult-bookmark)
526 ("C-c k" . consult-kmacro) 526 ("C-c k" . consult-kmacro)
527 ;; C-x bindings (ctl-x-map) 527 ;; C-x bindings (ctl-x-map)
528 ("C-x M-:" . consult-complex-command) ; orig. repeat-complet-command 528 ("C-x M-:" . consult-complex-command) ; orig. repeat-complet-command
529 ("C-x b" . consult-buffer) ; orig. switch-to-buffer 529 ("C-x b" . consult-buffer) ; orig. switch-to-buffer
530 ("C-x 4 b" . consult-buffer-other-window) ; orig. switch-to-buffer-other-window 530 ("C-x 4 b" . consult-buffer-other-window) ; orig. switch-to-buffer-other-window
531 ("C-x 5 b" . consult-buffer-other-frame) ; orig. switch-to-buffer-other-frame 531 ("C-x 5 b" . consult-buffer-other-frame) ; orig. switch-to-buffer-other-frame
532 ;; Custom M-# bindings for fast register access 532 ;; Custom M-# bindings for fast register access
533 ("M-#" . consult-register-load) 533 ("M-#" . consult-register-load)
534 ("M-'" . consult-register-store) ; orig. abbrev-prefix-mark (unrelated) 534 ("M-'" . consult-register-store) ; orig. abbrev-prefix-mark (unrelated)
535 ("C-M-#" . consult-register) 535 ("C-M-#" . consult-register)
536 ;; Other custom bindings 536 ;; Other custom bindings
537 ("M-y" . consult-yank-pop) ; orig. yank-pop 537 ("M-y" . consult-yank-pop) ; orig. yank-pop
538 ("<help> a" . consult-apropos) ; orig. apropos-command 538 ("<help> a" . consult-apropos) ; orig. apropos-command
539 ;; M-g bindings (goto-map) 539 ;; M-g bindings (goto-map)
540 ("M-g e" . consult-compile-error) 540 ("M-g e" . consult-compile-error)
541 ("M-g g" . consult-goto-line) ; orig. goto-line 541 ("M-g g" . consult-goto-line) ; orig. goto-line
542 ("M-g M-g" . consult-goto-line) ; orig. goto-line 542 ("M-g M-g" . consult-goto-line) ; orig. goto-line
543 ("M-g o" . consult-outline) 543 ("M-g o" . consult-outline)
544 ("M-g m" . consult-mark) 544 ("M-g m" . consult-mark)
545 ("M-g k" . consult-global-mark) 545 ("M-g k" . consult-global-mark)
546 ("M-g i" . consult-imenu) 546 ("M-g i" . consult-imenu)
547 ("M-g I" . consult-project-imenu) 547 ("M-g I" . consult-project-imenu)
548 ;; M-s bindings (search-map) 548 ;; M-s bindings (search-map)
549 ("M-s f" . consult-find) 549 ("M-s f" . consult-find)
550 ("M-s L" . consult-locate) 550 ("M-s L" . consult-locate)
551 ("M-s g" . consult-grep) 551 ("M-s g" . consult-grep)
552 ("M-s G" . consult-git-grep) 552 ("M-s G" . consult-git-grep)
553 ("M-s r" . consult-ripgrep) 553 ("M-s r" . consult-ripgrep)
554 ("M-s l" . consult-line) 554 ("M-s l" . consult-line)
555 ("M-s m" . consult-multi-occur) 555 ("M-s m" . consult-multi-occur)
556 ("M-s k" . consult-keep-lines) 556 ("M-s k" . consult-keep-lines)
557 ("M-s u" . consult-focus-lines) 557 ("M-s u" . consult-focus-lines)
558 ;; Isearch integration 558 ;; Isearch integration
559 ("M-s e" . consult-isearch) 559 ("M-s e" . consult-isearch)
560 :map isearch-mode-map 560 :map isearch-mode-map
561 ("M-e" . consult-isearch) ; orig. isearch-edit-string 561 ("M-e" . consult-isearch) ; orig. isearch-edit-string
562 ("M-s e" . consult-isearch) ; orig. isearch-edit-string 562 ("M-s e" . consult-isearch) ; orig. isearch-edit-string
563 ("M-s l" . consult-line)) ; required by consult-line to detect isearch 563 ("M-s l" . consult-line)) ; required by consult-line to detect isearch
564 :init 564 :init
565 (setq register-preview-delay 0 565 (setq register-preview-delay 0
566 register-preview-function #'consult-register-format) 566 register-preview-function #'consult-register-format)
567 (advice-add #'register-preview :override #'consult-register-window) 567 (advice-add #'register-preview :override #'consult-register-window)
568 (setq xref-show-xrefs-function #'consult-xref 568 (setq xref-show-xrefs-function #'consult-xref
569 xref-show-definitions-function #'consult-xref) 569 xref-show-definitions-function #'consult-xref)
570 :config 570 :config
571 ;; (setq consult-preview-key 'any) 571 ;; (setq consult-preview-key 'any)
572 ;; (setq consult-preview-key (kbd "M-p")) 572 ;; (setq consult-preview-key (kbd "M-p"))
573 (setq consult-narrow-key "<")) 573 (setq consult-narrow-key "<"))
574
575;; Language: Emacs-Lisp
576(setq-default eval-expression-print-length nil ; don't limit print length
577 eval-expression-print-level nil
578 )
579;; indent like common lisp
580(require 'cl-lib)
581(setq-default lisp-indent-function #'common-lisp-indent-function)
582(put 'cl-flet 'common-lisp-indent-function
583 (get 'flet 'common-lisp-indent-function))
584(put 'cl-labels 'common-lisp-indent-function
585 (get 'labels 'common-lisp-indent-function))
586(put 'if 'common-lisp-indent-function 2)
587(put 'dotimes-protect 'common-lisp-indent-function
588 (get 'when 'common-lisp-indent-function))