diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 519343c..4233d43 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -334,6 +334,18 @@ (add-hook 'yaml-mode-hook (lambda () (setq-local show-trailing-whitespace t)))) +(use-package calc + :bind ("C-x M-e" . calc-eval-in-place) + :init + (defun calc-eval-in-place () + (interactive) + (let ((result (calc-eval (buffer-substring-no-properties (point) (mark))))) + (if (stringp result) + (progn + (delete-region (point) (mark)) + (insert result)) + (apply 'user-error "Error at charater %d: %s" result))))) + ;;;; external packages (required) (use-package auto-package-update :ensure :commands auto-package-update-cli