From d71d36267e830daf35e511f69e85736a5449dc31 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 30 Dec 2021 12:27:39 -0600 Subject: Move yank-indent advice to +emacs.el --- lisp/+emacs.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lisp/+emacs.el') diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 2d63e82..39b064c 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el @@ -188,7 +188,7 @@ Do this only if the buffer is not visiting a file." (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) (add-hook 'minibuffer-setup-hook 'cursor-intangible-mode) -;;; Better-default functions +;;; Better-default functions ... (defun +cycle-spacing (&optional n preserve-nl-back mode) "Negate N argument on `cycle-spacing'. @@ -214,6 +214,15 @@ kill without asking." (save-buffers-kill-emacs)) (server-save-buffers-kill-terminal nil))) +;; ... and advice + +;; Indent the region after a yank. +(defun +yank@indent (&rest _) + "Indent the current region." + (indent-region (min (point) (mark)) (max (point) (mark)))) +(advice-add #'yank :after #'+yank@indent) +(advice-add #'yank-pop :after #'+yank@indent) + ;;; Bindings ;; I need to place these bindings under `+key-mode-map' so that they aren't -- cgit 1.4.1-21-gabe81