From 703e75f3859f29a8ff67913cfcc52fa5cd46a66d Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 28 Dec 2021 22:15:12 -0600 Subject: Add advice to indent after a yank --- init.el | 10 ++++++++-- 1 file 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 @@ "C-c v" 'visible-mode) ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults (global-set-key (kbd "C-h") 'delete-backward-char) - (keyboard-translate ?\C-h ?\C-?)) + (keyboard-translate ?\C-h ?\C-?) (define-advice keyboard-escape-quit (:around (fn &rest r)) "Don't close splits on `keyboard-escape-quit'." (let ((buffer-quit-function #'ignore)) (apply fn r))) + (defun +yank@indent (&rest _) + (indent-region (min (point) (mark)) (max (point) (mark)))) + (advice-add 'yank :after '+yank@indent) + (advice-add 'yank-pop :after '+yank@indent)) (setup (:require +init) (:bind "C-c s" (lambda () @@ -68,7 +72,8 @@ (append +pulse-location-commands) 'lui-track-jump-to-indicator) (+pulse-location-mode +1)) -(setup (:require reading)) +(setup (:require reading) + (:+key "C-c C-r" #'reading-mode)) (setup Info (:hook #'variable-pitch-mode @@ -533,6 +538,7 @@ (define-key isearch-mode-map (car binding) (cdr binding)))) (with-eval-after-load 'org-mode (define-key org-mode-map "M-g o" 'consult-org-heading)) + (advice-add 'consult-yank-pop :after '+yank@indent) (with-eval-after-load 'consult (:option consult-narrow-key "<" consult-project-root-function '+consult-project-root) -- cgit 1.4.1-21-gabe81