summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-11-07 21:59:17 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-11-07 21:59:17 +0100
commit3083940611299ce8b5bf941f3c4a8384f6fbcd6e (patch)
treefa70613b0c6511a44e5c4e7e7b0679626f7d8b0a /.config
parent2af1297e2cc7895b37df76c5b904293ad767b4aa (diff)
emacs: Add mm-rotate-left and mm-rotate-right
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/init.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index d53750e..bc29838 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -93,6 +93,18 @@ buffer suppressed."
(message-log-max nil))
,@body))
+(defun mm-rotate-left (n list)
+ "Rotate the elements of LIST N places to the left."
+ (declare (ftype (function (number (list t)) (list t)))
+ (pure t) (side-effect-free t))
+ (append (nthcdr n list) (butlast list (- (length list) n))))
+
+(defun mm-rotate-right (n list)
+ "Rotate the elements of LIST N places to the right."
+ (declare (ftype (function (number (list t)) (list t)))
+ (pure t) (side-effect-free t))
+ (mm-rotate-left (- (length list) n) list))
+
;;; Silent Native Compilation