summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-12-28 22:15:12 -0600
committerCase Duckworth2021-12-28 22:15:12 -0600
commit703e75f3859f29a8ff67913cfcc52fa5cd46a66d (patch)
tree79b0e04434934ac64d29b71ff37f56c8635f15a8
parentDon't close splits on `keyboard-escape-quit' (diff)
downloademacs-703e75f3859f29a8ff67913cfcc52fa5cd46a66d.tar.gz
emacs-703e75f3859f29a8ff67913cfcc52fa5cd46a66d.zip
Add advice to indent after a yank
-rw-r--r--init.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/init.el b/init.el index d9850fa..63afc75 100644 --- a/init.el +++ b/init.el
@@ -33,11 +33,15 @@
33 "C-c v" 'visible-mode) 33 "C-c v" 'visible-mode)
34 ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults 34 ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
35 (global-set-key (kbd "C-h") 'delete-backward-char) 35 (global-set-key (kbd "C-h") 'delete-backward-char)
36 (keyboard-translate ?\C-h ?\C-?)) 36 (keyboard-translate ?\C-h ?\C-?)
37 (define-advice keyboard-escape-quit (:around (fn &rest r)) 37 (define-advice keyboard-escape-quit (:around (fn &rest r))
38 "Don't close splits on `keyboard-escape-quit'." 38 "Don't close splits on `keyboard-escape-quit'."
39 (let ((buffer-quit-function #'ignore)) 39 (let ((buffer-quit-function #'ignore))
40 (apply fn r))) 40 (apply fn r)))
41 (defun +yank@indent (&rest _)
42 (indent-region (min (point) (mark)) (max (point) (mark))))
43 (advice-add 'yank :after '+yank@indent)
44 (advice-add 'yank-pop :after '+yank@indent))
41 45
42(setup (:require +init) 46(setup (:require +init)
43 (:bind "C-c s" (lambda () 47 (:bind "C-c s" (lambda ()
@@ -68,7 +72,8 @@
68 (append +pulse-location-commands) 'lui-track-jump-to-indicator) 72 (append +pulse-location-commands) 'lui-track-jump-to-indicator)
69 (+pulse-location-mode +1)) 73 (+pulse-location-mode +1))
70 74
71(setup (:require reading)) 75(setup (:require reading)
76 (:+key "C-c C-r" #'reading-mode))
72 77
73(setup Info 78(setup Info
74 (:hook #'variable-pitch-mode 79 (:hook #'variable-pitch-mode
@@ -533,6 +538,7 @@
533 (define-key isearch-mode-map (car binding) (cdr binding)))) 538 (define-key isearch-mode-map (car binding) (cdr binding))))
534 (with-eval-after-load 'org-mode 539 (with-eval-after-load 'org-mode
535 (define-key org-mode-map "M-g o" 'consult-org-heading)) 540 (define-key org-mode-map "M-g o" 'consult-org-heading))
541 (advice-add 'consult-yank-pop :after '+yank@indent)
536 (with-eval-after-load 'consult 542 (with-eval-after-load 'consult
537 (:option consult-narrow-key "<" 543 (:option consult-narrow-key "<"
538 consult-project-root-function '+consult-project-root) 544 consult-project-root-function '+consult-project-root)