Skip to content

kickingvegas/Casual

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://melpa.org/packages/casual-badge.svg

Casual

An opinionated Transient-based porcelain to support the casual usage of Emacs Calc.

docs/images/casual-main-menu.png

Motivation

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.

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 resorting to 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.

Asks

As Casual 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.

Install

Casual is available on MELPA.

If installed via list-packages then add this line to your Emacs initialization file.

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

If you use use-package, here is the recipe for installing it.

(use-package casual
  :ensure t
  :bind (:map calc-mode-map ("C-o" . 'casual-main-menu)))

If you are installing by using a clone of this repository, then ensure that the directory holding casual.el is in your info-path. Add the following lines to your Emacs initialization file.

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

Casual requires Emacs 29.1+.

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.

Common Menu Actions

Casual 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 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.

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.

Development

For users who wish to help contribute to Casual or personally customize it for their own usage, please read the developer documentation.

Sponsorship

If you enjoy using Casual, consider making a modest financial contribution to help support its development and maintenance.

docs/images/default-yellow.png

Acknowledgments

A heartfelt thanks to all the contributors to Calc and Transit. Casual would not be possible without your efforts.

About

An opinionated Transient-based porcelain to support the casual usage of Emacs Calc.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published