An opinionated Transient-based user interface to support the casual usage of Emacs Calc.
While Emacs Calc has an embarrassingly rich feature set, for many users this capability is inaccessible due the overwhelming number of keybindings used 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.
- To provide a keyboard-driven UI to Calc that is menu based.
- To allow users experienced with scientific calculators to casually use Calc without requiring reference to its Info manual.
- 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 Calc 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 Calc is early in its life-cycle, expect changes to its user experience in terms of menu hierarchy and keybinding choices in future releases.
As Casual Calc is new, we are looking for early adopters! Your feedback is welcome as it will likely impact Casual’s evolution, particularly with regards to UI.
Casual Calc is available on MELPA.
If installed via list-packages
then add this line to your Emacs initialization file.
(require 'casual-calc) ;; optional
(keymap-set calc-mode-map "C-o" #'casual-calc-tmenu)
(keymap-set calc-alg-map "C-o" #'casual-calc-tmenu)
If you use use-package
, here is the recipe for installing it.
(use-package calc
:defer t)
(use-package casual-calc
:ensure nil
:bind (:map
calc-mode-map
("C-o" . casual-calc-tmenu)
:map
calc-alg-map
("C-o" . casual-calc-tmenu)))
:after (calc))
Casual Calc requires Emacs 29.1+.
- Invoke
M-x calc
to launch Calc. - When the point is in the Calc window, invoke
C-o
(or a binding of your choosing) to launch the Casual Calc interface.
Once raised, the Casual Calc interface can be dismissed via:
C-g
to dismiss the current menu.C-q
to dismiss the interface completely.
For nearly all menus, algebraic entry via the ’ binding is available, as well as basic calculator operations (addition, subtraction, multiplication, division) and stack operations (pop, enter).
Casual Calc is built using Transient menus and as such adopts much of its default behavior.
Each menu item has a key and a label. The key is what is typed by the user to select the menu item. A key can be prefixed with a meta (M-) or control (C-) key. Labels ending with a >
character indicates that it will open another menu.
Dismissing a menu regardless of how deep you are in sub-menus can be done by entering C-q
. A menu can also be dismissed by entering C-g
, but this will return you to the parent menu.
If a mouse is available, a menu item can be selected by moving the mouse cursor over its label and pressing down button 1.
Pressing the ?
key will toggle help for all the menu items. Press the key of interest to get help for it. (Note, not all menu items are documented at this time.)
Some menus have arguments (example --rate=
) which you can set. You can persist these settings by typing C-x C-s
.
Menu item notation The following conventions are used to denote menu items.
If the label ends with a ›
, it is a sub-menu.
If the label ends with an …
, the command will prompt you for an input value.
If neither the above is in the label then the command is issued using arguments from the stack as needed.
The top of the stack is referred to as (1:
), where 1
is the stack index value. Emacs Calc uses a 1-offset for sequences to be consistent with math convention.
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 isD
. - 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 put5
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.
For users who wish to help contribute to Casual Calc or personally customize it for their own usage, please read the developer documentation.
If you enjoy using Casual Calc, consider making a modest financial contribution to help support its development and maintenance.
Casual Calc is part of a suite of user interfaces for different Emacs packages.
To get all current and future Casual user interfaces, please install Casual Suite from MELPA.
User Interfaces currently supported by Casual are listed below:
- Casual I-Search - a Transient menu for I-Search.
- Casual Dired - a Transient user interface for the Dired file manager.
- Casual Info - a Transient user interface for Info.
- Casual Bookmarks - a Transient user interface for Bookmarks.
- Casual IBuffer - a Transient user interface for IBuffer.
- Casual RE-Builder - a Transient user interface for RE-Builder.
- Casual Avy - a Transient user interface for Avy.
Users who prefer finer grained control over package installation can install each user interface above individually.
A heartfelt thanks to all the contributors to Calc and Transit. Casual would not be possible without your efforts.