Two Wrongs

ec: The Emacs Calculator

ec: The Emacs Calculator

I have started using the Emacs calculator more and more as my daily driver, phasing out the irc bot I have used previously, as well as web calculators such as Google and WolframAlpha.

Two reasons for this:

  1. When I think about it, it’s weird that I didn’t use a real calculator program, but always something with a different primary purpose and just happened to be able to do calculatory stuff as a side effect.
  2. The Emacs calculator is simply better.

So I figured, if it’s so weird that I hop onto irc or enter Google to do simple calculations, why do I even do it? And I realised the answer is probably convenience. I’m often both mentally and desktop environmentally very close to either of those two, so naturally, I go there more often.

I set out to fix that, and I have. I made the following shell script, moved it to ~/.local/bin/ec

#!/bin/sh

case "$1" in
    -h|--help|help)
        echo "Usage: $0 [-g|--graphical]"
    ;;
    *)
        nw=$(test -z "$1" && echo "-nw")

        emacs $nw -Q --eval="$(cat <<EOF
        (progn
          (tool-bar-mode -1)
          (scroll-bar-mode -1)
          (menu-bar-mode -1)

          (cua-mode +1)
          (setq
             select-enable-primary t
             help-window-select t)
          (full-calc)
          (define-key calc-mode-map (kbd "q")
            \'save-buffers-kill-terminal))
        EOF
        )"
    ;;
esac