summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/mm-calc.el
blob: 2a9a74ba2a94ce2f84de5c0d2d2b1241fe759c6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)