Calc's standard interface acts like a traditional RPN calculator, operated by the normal Emacs keyboard. When you type M-# c to start the Calculator, the Emacs screen splits into two windows with the file you were editing on top and Calc on the bottom.
@advance@hsize20pt
... --**-Emacs: myfile (Fundamental)----All---------------------- --- Emacs Calculator Mode -- |Emacs Calc Mode v2.00... 2: 17.3 | 17.3 1: -5 | 3 . | 2 | 4 | * 8 | ->-5 | --%%-Calc: 12 Deg (Calculator)----All----- --%%-Emacs: *Calc Trail*
In this figure, the mode-line for `myfile' has moved up and the "Calculator" window has appeared below it. As you can see, Calc actually makes two windows side-by-side. The lefthand one is called the stack window and the righthand one is called the trail window. The stack holds the numbers involved in the calculation you are currently performing. The trail holds a complete record of all calculations you have done. In a desk calculator with a printer, the trail corresponds to the paper tape that records what you do.
In this case, the trail shows that four numbers (17.3, 3, 2, and 4) were first entered into the Calculator, then the 2 and 4 were multiplied to get 8, then the 3 and 8 were subtracted to get -5. (The `>' symbol shows that this was the most recent calculation.) The net result is the two numbers 17.3 and -5 sitting on the stack.
Most Calculator commands deal explicitly with the stack only, but there is a set of commands that allow you to search back through the trail and retrieve any previous result.
Calc commands use the digits, letters, and punctuation keys. Shifted (i.e., upper-case) letters are different from lowercase letters. Some letters are prefix keys that begin two-letter commands. For example, e means "enter exponent" and shifted E means e^x. With the d ("display modes") prefix the letter "e" takes on very different meanings: d e means "engineering notation" and d E means "eqn language mode."
There is nothing stopping you from switching out of the Calc
window and back into your editing window, say by using the Emacs
C-x o (other-window
) command. When the cursor is
inside a regular window, Emacs acts just like normal. When the
cursor is in the Calc stack or trail windows, keys are interpreted
as Calc commands.
When you quit by pressing M-# c a second time, the Calculator windows go away but the actual Stack and Trail are not gone, just hidden. When you press M-# c once again you will get the same stack and trail contents you had when you last used the Calculator.
The Calculator does not remember its state between Emacs sessions. Thus if you quit Emacs and start it again, M-# c will give you a fresh stack and trail. There is a command (m m) that lets you save your favorite mode settings between sessions, though. One of the things it saves is which user interface (standard or Keypad) you last used; otherwise, a freshly started Emacs will always treat M-# M-# the same as M-# c.
The q key is another equivalent way to turn the Calculator off.
If you type M-# b first and then M-# c, you get a
full-screen version of Calc (full-calc
) in which the stack and
trail windows are still side-by-side but are now as tall as the whole
Emacs screen. When you press q or M-# c again to quit,
the file you were editing before reappears. The M-# b key
switches back and forth between "big" full-screen mode and the
normal partial-screen mode.
Finally, M-# o (calc-other-window
) is like M-# c
except that the Calc window is not selected. The buffer you were
editing before remains selected instead. M-# o is a handy
way to switch out of Calc momentarily to edit your file; type
M-# c to switch back into Calc when you are done.