summaryrefslogtreecommitdiff
path: root/.config/emacs
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-11-18 12:13:23 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-11-18 12:13:23 +0100
commitd7c1c75c86592d998f53dbc42c10ff664b79a329 (patch)
treec960f01b2bf9ce0e675c73aad079a410be15fbc6 /.config/emacs
parent8d0095ee5d9c9a6594edc2618fef1d4a3d0ad7d3 (diff)
emacs: Move text
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/modules/mm-editing.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/.config/emacs/modules/mm-editing.el b/.config/emacs/modules/mm-editing.el
index 5072366..c32776f 100644
--- a/.config/emacs/modules/mm-editing.el
+++ b/.config/emacs/modules/mm-editing.el
@@ -226,6 +226,24 @@ forces that to not happen."
:commands (increment-number-at-point decrement-number-at-point))
+;;; Move Line or Region
+
+(defun mm-move-text-indent (&rest _)
+ (let ((deactivate deactivate-mark))
+ (if (region-active-p)
+ (indent-region (region-beginning) (region-end))
+ (indent-region (line-beginning-position) (line-end-position)))
+ (setq deactivate-mark deactivate)))
+
+(use-package move-text
+ :ensure t
+ :bind (("M-n" . move-text-down)
+ ("M-p" . move-text-up))
+ :config
+ (dolist (command #'(move-text-up move-text-down))
+ (advice-add command :after #'mm-move-text-indent)))
+
+
;;; Surround With Delimeters
(defun mm-editing-surround-with-spaces (char)