summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/mm-calc.el
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-16 22:04:33 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-10-16 22:04:33 +0200
commit0ee7fa9c382ae30295f0b8d88457f7856c7ff800 (patch)
tree6b5a0cf01fa0bfa4d01b0134b268f5d993055c0b /.config/emacs/modules/mm-calc.el
parentd452ae1347b3711bc0a7ac80cfa2c37d9d63836e (diff)
emacs: Overhaul configuration completely
Diffstat (limited to '.config/emacs/modules/mm-calc.el')
-rw-r--r--.config/emacs/modules/mm-calc.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/.config/emacs/modules/mm-calc.el b/.config/emacs/modules/mm-calc.el
new file mode 100644
index 0000000..2a9a74b
--- /dev/null
+++ b/.config/emacs/modules/mm-calc.el
@@ -0,0 +1,25 @@
+;;; mm-calc.el --- Emacs configurations for ‘calc-mode’ -*- lexical-binding: t; -*-
+
+;; TODO: Swap more than 2 elements?
+(defun mm-calc-swap ()
+ "Swap the top two elements on the stack."
+ (declare (modes calc-mode))
+ (interactive)
+ (calc-over 2)
+ (calc-truncate-up 2)
+ (calc-pop 1)
+ (calc-truncate-down 2))
+
+(use-package calc
+ :bind (:map calc-mode-map
+ ("C-c x" . #'mm-calc-swap))
+ ;; TODO: Can this be done in :custom?
+ :init
+ (setopt
+ calc-display-trail nil
+ calc-group-digits t
+ ;; Optimize for Europeans
+ calc-point-char ","
+ calc-group-char "."))
+
+(provide 'mm-calc)