Next: Numeric Prefix Arguments, Previous: Algebraic Entry, Up: Introduction [Contents][Index]
There is another way to invoke the Calculator if all you need to do is make one or two quick calculations. Type C-x * q (or M-x quick-calc), then type any formula as an algebraic entry. The Calculator will compute the result and display it in the echo area, without ever actually putting up a Calc window.
You can use the $ character in a Quick Calculator formula to
refer to the previous Quick Calculator result. Older results are
not retained; the Quick Calculator has no effect on the full
Calculator’s stack or trail. If you compute a result and then
forget what it was, just run C-x * q
again and enter
‘$’ as the formula.
If this is the first time you have used the Calculator in this Emacs session, the C-x * q command will create the *Calculator* buffer and perform all the usual initializations; it simply will refrain from putting that buffer up in a new window. The Quick Calculator refers to the *Calculator* buffer for all mode settings. Thus, for example, to set the precision that the Quick Calculator uses, simply run the full Calculator momentarily and use the regular p command.
If you use C-x * q
from inside the Calculator buffer, the
effect is the same as pressing the apostrophe key (algebraic entry).
The result of a Quick calculation is placed in the Emacs “kill ring” as well as being displayed. A subsequent C-y command will yank the result into the editing buffer. You can also use this to yank the result into the next C-x * q input line as a more explicit alternative to $ notation, or to yank the result into the Calculator stack after typing C-x * c.
If you give a prefix argument to C-x * q or finish your formula by typing LFD (or C-j) instead of RET, the result is inserted immediately into the current buffer rather than going into the kill ring.
Quick Calculator results are actually evaluated as if by the = key (which replaces variable names by their stored values, if any). If the formula you enter is an assignment to a variable using the ‘:=’ operator, say, ‘foo := 2 + 3’ or ‘foo := foo + 1’, then the result of the evaluation is stored in that Calc variable. See Storing and Recalling.
If the result is an integer and the current display radix is decimal, the number will also be displayed in hex, octal and binary formats. If the integer is in the range from 1 to 126, it will also be displayed as an ASCII character.
For example, the quoted character ‘"x"’ produces the vector result ‘[120]’ (because 120 is the ASCII code of the lower-case “x”; see Strings). Since this is a vector, not an integer, it is displayed only according to the current mode settings. But running Quick Calc again and entering ‘120’ will produce the result ‘120 (16#78, 8#170, x)’ which shows the number in its decimal, hexadecimal, octal, and ASCII forms.
Please note that the Quick Calculator is not any faster at loading or computing the answer than the full Calculator; the name “quick” merely refers to the fact that it’s much less hassle to use for small calculations.
Next: Numeric Prefix Arguments, Previous: Algebraic Entry, Up: Introduction [Contents][Index]