To start the Calculator in its standard interface, type M-x calc. By default this creates a pair of small windows, `*Calculator*' and `*Calc Trail*'. The former displays the contents of the Calculator stack and is manipulated exclusively through Calc commands. It is possible (though not usually necessary) to create several Calc Mode buffers each of which has an independent stack, undo list, and mode settings. There is exactly one Calc Trail buffer; it records a list of the results of all calculations that have been done. The Calc Trail buffer uses a variant of Calc Mode, so Calculator commands still work when the trail buffer's window is selected. It is possible to turn the trail window off, but the `*Calc Trail*' buffer itself still exists and is updated silently. See section Trail Commands.
In most installations, the M-# c key sequence is a more convenient way to start the Calculator. Also, M-# M-# and M-# # are synonyms for M-# c unless you last used Calc in its "keypad" mode.
Most Calc commands use one or two keystrokes. Lower- and upper-case
letters are distinct. Commands may also be entered in full M-x form;
for some commands this is the only form. As a convenience, the x
key (calc-execute-extended-command
)
is like M-x except that it enters the initial string `calc-'
for you. For example, the following key sequences are equivalent:
S, M-x calc-sin RET, x sin RET.
The Calculator exists in many parts. When you type M-# c, the
Emacs "auto-load" mechanism will bring in only the first part, which
contains the basic arithmetic functions. The other parts will be
auto-loaded the first time you use the more advanced commands like trig
functions or matrix operations. This is done to improve the response time
of the Calculator in the common case when all you need to do is a
little arithmetic. If for some reason the Calculator fails to load an
extension module automatically, you can force it to load all the
extensions by using the M-# L (calc-load-everything
)
command. See section Mode Settings.
If you type M-x calc or M-# c with any numeric prefix argument, the Calculator is loaded if necessary, but it is not actually started. If the argument is positive, the `calc-ext' extensions are also loaded if necessary. User-written Lisp code that wishes to make use of Calc's arithmetic routines can use `(calc 0)' or `(calc 1)' to auto-load the Calculator.
If you type M-# b, then next time you use M-# c you
will get a Calculator that uses the full height of the Emacs screen.
When full-screen mode is on, M-# c runs the full-calc
command instead of calc
. From the Unix shell you can type
`emacs -f full-calc' to start a new Emacs specifically for use
as a calculator. When Calc is started from the Emacs command line
like this, Calc's normal "quit" commands actually quit Emacs itself.
The M-# o command is like M-# c except that the Calc window is not actually selected. If you are already in the Calc window, M-# o switches you out of it. (The regular Emacs C-x o command would also work for this, but it has a tendency to drop you into the Calc Trail window instead, which M-# o takes care not to do.)
For one quick calculation, you can type M-# q (quick-calc
)
which prompts you for a formula (like `2+3/4'). The result is
displayed at the bottom of the Emacs screen without ever creating
any special Calculator windows. See section "Quick Calculator" Mode.
Finally, if you are using the X window system you may want to try
M-# k (calc-keypad
) which runs Calc with a
"calculator keypad" picture as well as a stack display. Click on
the keys with the mouse to operate the calculator. See section "Keypad" Mode.
The q key (calc-quit
) exits Calc Mode and closes the
Calculator's window(s). It does not delete the Calculator buffers.
If you type M-x calc again, the Calculator will reappear with the
contents of the stack intact. Typing M-# c or M-# M-#
again from inside the Calculator buffer is equivalent to executing
calc-quit
; you can think of M-# M-# as toggling the
Calculator on and off.
The M-# x command also turns the Calculator off, no matter which
user interface (standard, Keypad, or Embedded) is currently active.
It also cancels calc-edit
mode if used from there.
The d SPC key sequence (calc-refresh
) redraws the contents
of the Calculator buffer from memory. Use this if the contents of the
buffer have been damaged somehow.
The o key (calc-realign
) moves the cursor back to its
"home" position at the bottom of the Calculator buffer.
The < and > keys are bound to calc-scroll-left
and
calc-scroll-right
. These are just like the normal horizontal
scrolling commands except that they scroll one half-screen at a time by
default. (Calc formats its output to fit within the bounds of the
window whenever it can.)
The { and } keys are bound to calc-scroll-down
and calc-scroll-up
. They scroll up or down by one-half the
height of the Calc window.
The M-# 0 command (calc-reset
; that's M-# followed
by a zero) resets the Calculator to its default state. This clears
the stack, resets all the modes, clears the caches (see section Caches),
and so on. (It does not erase the values of any variables.)
With a numeric prefix argument, M-# 0 preserves the contents
of the stack but resets everything else.
The M-x calc-version command displays the current version number of Calc and the name of the person who installed it on your system. (This information is also present in the `*Calc Trail*' buffer, and in the output of the h h command.)