notes from /dev/null

by Charles Choi 최민수


Announcing Casual - An opinionated porcelain for Emacs Calc

24 Mar 2024  Charles Choi

Casual Main Menu Screenshot

Announcing the first public release of Casual - an opinionated Transient-based porcelain to support the casual usage of Emacs Calc.

It’s now on MELPA and requires Emacs 29.1+.

Install

Add the following lines to your Emacs initialization file.

(require 'casual)
(define-key calc-mode-map (kbd "C-o") 'casual-main-menu)

Motivation

While Emacs Calc has an embarrassingly rich feature set, for many users this capability is inaccessible due its dependence on an overwhelming number of keybindings to access them. These keybindings have a steep learning curve that is quickly lost if not in constant use.

Menus are a user interface (UI) affordance that offer users discoverability and recall. Providing a hierarchical menu UI over Calc greatly improves its casual use.

Goals

  • To provide a keyboard-driven UI to Calc that is menu based.
  • To allow users experienced with scientific calculators to casually use Calc without having to reference its Info pages.

Non-Goals

  • Full coverage of all Calc commands. Casual is not intended to be a power user tool.
  • Strict adherence to default Calc keybindings. Calc’s prompt-first interface resulted in a command keybinding design that embeds context in the key sequence (e.g. v for vector, b for binary). Hierarchical menus make this context implicit, allowing for key reuse in different contexts.
  • Strict adherence to Calc command naming. While Casual is mostly in alignment with Calc’s command naming, there are cases where it will make an opinionated change if the name is deemed too vague or idiomatic.
  • UX Stability (for now). Given that Casual is early in its life-cycle, expect changes to its user experience in terms of menu hierarchy and keybinding choices in future releases.

Usage

  1. Invoke M-x calc to launch Calc.
  2. When the point is in the Calc window, invoke C-o (or a binding of your choosing) to launch the Casual menu.

Calc Basics

It helps to know some basics about Calc.

  • Calc is a stack-based calculator that supports both RPN and algebraic style entry.
    • By default it uses RPN entry, but this can be changed to algebraic.
  • Stack based operations are always RPN-style.
  • Undo has the keybinding U, redo is D.
  • The top of the stack is referred to as 1:
  • Calc vectors are punctuated with [ and ] (e.g. [2 3]) Matrix values are represented as vectors within a vector. For example, [[1 0] [0 1]] is a square diagonal matrix.
  • Calc vector indexes are 1-offset.
  • Intervals
    • Inclusive intervals are represented as [𝑛..𝑚], where 𝑛 < 𝑚.
    • Exclusive intervals are represented as (𝑛..𝑚), where 𝑛 < 𝑚.
    • Any combination of lower and upper bounds set to be inclusive or exclusive is supported.
  • Complex numbers are entered as (𝑟, 𝑖), where 𝑟 is the real part and 𝑖 is the imaginary.
  • Radix numbers are entered as 𝑏#𝑛 where 𝑏 is the base value and 𝑛 is the number. For example entering 2#0101 will put 5 on the stack.
  • H:M:S values are default entered as ℎ@ 𝑚“ 𝑠’.
  • Org-mode active timestamps can be entered into Calc.
  • The top of the stack (1:) can be edited by pressing the ` key.
  • Entering a single quote (’) will prompt you for an algebraic entry.

Closing Thoughts

Back in the early 90’s I had the happy circumstance of owning a HP-28S. This calculator heavily influenced the feature set of Emacs Calc, but despite that Calc was frustrating to use because its primary interface (a prompt) was exactly the opposite of the interface provided by the HP-28S: an array of buttons to discover and press.

HP-28S photo

With keyboard-driven menus, I’d assert that Casual goes a long way towards fulfilling Calc’s promise to provide a HP-28 at your fingertips with the added bonus of integration into your digital life because it all lives in Emacs.

As Casual is new, I’m looking for early adopters! Your feedback is welcome as it will likely impact Casual’s evolution, particularly with regards to UI.

If you really like Casual, consider supporting its development and maintenance though buymeacoffee.

Thanks for reading and happy calculating!

emacs

 

AboutMastodonInstagramGitHub

Feeds & TagsGet Captee for macOS

Powered by Pelican