167 |
* Embedded Mode:: Working with formulas embedded in a file. |
* Embedded Mode:: Working with formulas embedded in a file. |
168 |
* Programming:: Calc as a programmable calculator. |
* Programming:: Calc as a programmable calculator. |
169 |
|
|
170 |
* Customizable Variables:: Customizable Variables. |
* Customizing Calc:: Customizing Calc. |
171 |
* Reporting Bugs:: How to report bugs and make suggestions. |
* Reporting Bugs:: How to report bugs and make suggestions. |
172 |
|
|
173 |
* Summary:: Summary of Calc commands and functions. |
* Summary:: Summary of Calc commands and functions. |
708 |
@c [fix-ref Help Commands] |
@c [fix-ref Help Commands] |
709 |
You can access this manual on-line at any time within Calc by |
You can access this manual on-line at any time within Calc by |
710 |
pressing the @kbd{h i} key sequence. Outside of the Calc window, |
pressing the @kbd{h i} key sequence. Outside of the Calc window, |
711 |
you can press @kbd{M-# i} to read the manual on-line. Also, you |
you can press @kbd{C-x * i} to read the manual on-line. Also, you |
712 |
can jump directly to the Tutorial by pressing @kbd{h t} or @kbd{M-# t}, |
can jump directly to the Tutorial by pressing @kbd{h t} or @kbd{C-x * t}, |
713 |
or to the Summary by pressing @kbd{h s} or @kbd{M-# s}. Within Calc, |
or to the Summary by pressing @kbd{h s} or @kbd{C-x * s}. Within Calc, |
714 |
you can also go to the part of the manual describing any Calc key, |
you can also go to the part of the manual describing any Calc key, |
715 |
function, or variable using @w{@kbd{h k}}, @kbd{h f}, or @kbd{h v}, |
function, or variable using @w{@kbd{h k}}, @kbd{h f}, or @kbd{h v}, |
716 |
respectively. @xref{Help Commands}. |
respectively. @xref{Help Commands}. |
773 |
is usually omitted in key sequences like @kbd{M-x calc-keypad @key{RET}}. |
is usually omitted in key sequences like @kbd{M-x calc-keypad @key{RET}}. |
774 |
|
|
775 |
Commands are generally shown like this: @kbd{p} (@code{calc-precision}) |
Commands are generally shown like this: @kbd{p} (@code{calc-precision}) |
776 |
or @kbd{M-# k} (@code{calc-keypad}). This means that the command is |
or @kbd{C-x * k} (@code{calc-keypad}). This means that the command is |
777 |
normally used by pressing the @kbd{p} key or @kbd{M-# k} key sequence, |
normally used by pressing the @kbd{p} key or @kbd{C-x * k} key sequence, |
778 |
but it also has the full-name equivalent shown, e.g., @kbd{M-x calc-precision}. |
but it also has the full-name equivalent shown, e.g., @kbd{M-x calc-precision}. |
779 |
|
|
780 |
Commands that correspond to functions in algebraic notation |
Commands that correspond to functions in algebraic notation |
797 |
Tutorial. |
Tutorial. |
798 |
|
|
799 |
To begin, start Emacs if necessary (usually the command @code{emacs} |
To begin, start Emacs if necessary (usually the command @code{emacs} |
800 |
does this), and type @kbd{M-# c} (or @kbd{@key{ESC} # c}) to start the |
does this), and type @kbd{C-x * c} to start the |
801 |
Calculator. (You can also use @kbd{M-x calc} if this doesn't work. |
Calculator. (You can also use @kbd{M-x calc} if this doesn't work. |
802 |
@xref{Starting Calc}, for various ways of starting the Calculator.) |
@xref{Starting Calc}, for various ways of starting the Calculator.) |
803 |
|
|
849 |
result from the most-recent and compute the Inverse Hyperbolic sine. |
result from the most-recent and compute the Inverse Hyperbolic sine. |
850 |
|
|
851 |
@strong{Keypad mode.} If you are using the X window system, press |
@strong{Keypad mode.} If you are using the X window system, press |
852 |
@w{@kbd{M-# k}} to get Keypad mode. (If you don't use X, skip to |
@w{@kbd{C-x * k}} to get Keypad mode. (If you don't use X, skip to |
853 |
the next section.) |
the next section.) |
854 |
|
|
855 |
@noindent |
@noindent |
869 |
Click on @key{<-} to erase the result, then click @key{OFF} to turn |
Click on @key{<-} to erase the result, then click @key{OFF} to turn |
870 |
the Keypad Calculator off. |
the Keypad Calculator off. |
871 |
|
|
872 |
@strong{Grabbing data.} Type @kbd{M-# x} if necessary to exit Calc. |
@strong{Grabbing data.} Type @kbd{C-x * x} if necessary to exit Calc. |
873 |
Now select the following numbers as an Emacs region: ``Mark'' the |
Now select the following numbers as an Emacs region: ``Mark'' the |
874 |
front of the list by typing @kbd{C-@key{SPC}} or @kbd{C-@@} there, |
front of the list by typing @kbd{C-@key{SPC}} or @kbd{C-@@} there, |
875 |
then move to the other end of the list. (Either get this list from |
then move to the other end of the list. (Either get this list from |
876 |
the on-line copy of this manual, accessed by @w{@kbd{M-# i}}, or just |
the on-line copy of this manual, accessed by @w{@kbd{C-x * i}}, or just |
877 |
type these numbers into a scratch file.) Now type @kbd{M-# g} to |
type these numbers into a scratch file.) Now type @kbd{C-x * g} to |
878 |
``grab'' these numbers into Calc. |
``grab'' these numbers into Calc. |
879 |
|
|
880 |
@example |
@example |
896 |
@noindent |
@noindent |
897 |
You can also grab data as a rectangular matrix. Place the cursor on |
You can also grab data as a rectangular matrix. Place the cursor on |
898 |
the upper-leftmost @samp{1} and set the mark, then move to just after |
the upper-leftmost @samp{1} and set the mark, then move to just after |
899 |
the lower-right @samp{8} and press @kbd{M-# r}. |
the lower-right @samp{8} and press @kbd{C-x * r}. |
900 |
|
|
901 |
@noindent |
@noindent |
902 |
Type @kbd{v t} to transpose this |
Type @kbd{v t} to transpose this |
908 |
matrix. Type @w{@kbd{v u}} to unpack the rows into two separate |
matrix. Type @w{@kbd{v u}} to unpack the rows into two separate |
909 |
vectors. Now type @w{@kbd{V R + @key{TAB} V R +}} to compute the sums |
vectors. Now type @w{@kbd{V R + @key{TAB} V R +}} to compute the sums |
910 |
of the two original columns. (There is also a special |
of the two original columns. (There is also a special |
911 |
grab-and-sum-columns command, @kbd{M-# :}.) |
grab-and-sum-columns command, @kbd{C-x * :}.) |
912 |
|
|
913 |
@strong{Units conversion.} Units are entered algebraically. |
@strong{Units conversion.} Units are entered algebraically. |
914 |
Type @w{@kbd{' 43 mi/hr @key{RET}}} to enter the quantity 43 miles-per-hour. |
Type @w{@kbd{' 43 mi/hr @key{RET}}} to enter the quantity 43 miles-per-hour. |
939 |
|
|
940 |
@iftex |
@iftex |
941 |
@strong{Help functions.} You can read about any command in the on-line |
@strong{Help functions.} You can read about any command in the on-line |
942 |
manual. Type @kbd{M-# c} to return to Calc after each of these |
manual. Type @kbd{C-x * c} to return to Calc after each of these |
943 |
commands: @kbd{h k t N} to read about the @kbd{t N} command, |
commands: @kbd{h k t N} to read about the @kbd{t N} command, |
944 |
@kbd{h f sqrt @key{RET}} to read about the @code{sqrt} function, and |
@kbd{h f sqrt @key{RET}} to read about the @code{sqrt} function, and |
945 |
@kbd{h s} to read the Calc summary. |
@kbd{h s} to read the Calc summary. |
946 |
@end iftex |
@end iftex |
947 |
@ifinfo |
@ifinfo |
948 |
@strong{Help functions.} You can read about any command in the on-line |
@strong{Help functions.} You can read about any command in the on-line |
949 |
manual. Remember to type the letter @kbd{l}, then @kbd{M-# c}, to |
manual. Remember to type the letter @kbd{l}, then @kbd{C-x * c}, to |
950 |
return here after each of these commands: @w{@kbd{h k t N}} to read |
return here after each of these commands: @w{@kbd{h k t N}} to read |
951 |
about the @w{@kbd{t N}} command, @kbd{h f sqrt @key{RET}} to read about the |
about the @w{@kbd{t N}} command, @kbd{h f sqrt @key{RET}} to read about the |
952 |
@code{sqrt} function, and @kbd{h s} to read the Calc summary. |
@code{sqrt} function, and @kbd{h s} to read the Calc summary. |
953 |
@end ifinfo |
@end ifinfo |
954 |
|
|
955 |
Press @key{DEL} repeatedly to remove any leftover results from the stack. |
Press @key{DEL} repeatedly to remove any leftover results from the stack. |
956 |
To exit from Calc, press @kbd{q} or @kbd{M-# c} again. |
To exit from Calc, press @kbd{q} or @kbd{C-x * c} again. |
957 |
|
|
958 |
@node Using Calc, History and Acknowledgements, Demonstration of Calc, Getting Started |
@node Using Calc, History and Acknowledgements, Demonstration of Calc, Getting Started |
959 |
@section Using Calc |
@section Using Calc |
970 |
* Keypad Mode Overview:: |
* Keypad Mode Overview:: |
971 |
* Standalone Operation:: |
* Standalone Operation:: |
972 |
* Embedded Mode Overview:: |
* Embedded Mode Overview:: |
973 |
* Other M-# Commands:: |
* Other C-x * Commands:: |
974 |
@end menu |
@end menu |
975 |
|
|
976 |
@node Starting Calc, The Standard Interface, Using Calc, Using Calc |
@node Starting Calc, The Standard Interface, Using Calc, Using Calc |
977 |
@subsection Starting Calc |
@subsection Starting Calc |
978 |
|
|
979 |
@noindent |
@noindent |
980 |
On most systems, you can type @kbd{M-#} to start the Calculator. |
On most systems, you can type @kbd{C-x *} to start the Calculator. |
981 |
The notation @kbd{M-#} is short for Meta-@kbd{#}. On most |
The key sequence @kbd{C-x *} is bound to the command @code{calc-dispatch}, |
982 |
keyboards this means holding down the Meta (or Alt) and |
which can be rebound if convenient (@pxref{Customizing Calc}). |
983 |
Shift keys while typing @kbd{3}. |
|
984 |
|
When you press @kbd{C-x *}, Emacs waits for you to press a second key to |
985 |
@cindex META key |
complete the command. In this case, you will follow @kbd{C-x *} with a |
986 |
Once again, if you don't have a Meta key on your keyboard you can type |
letter (upper- or lower-case, it doesn't matter for @kbd{C-x *}) that says |
|
@key{ESC} first, then @kbd{#}, to accomplish the same thing. If you |
|
|
don't even have an @key{ESC} key, you can fake it by holding down |
|
|
Control or @key{CTRL} while typing a left square bracket |
|
|
(that's @kbd{C-[} in Emacs notation). |
|
|
|
|
|
The key @kbd{M-#} is bound to the command @code{calc-dispatch}, |
|
|
which can be rebound if convenient. |
|
|
(@xref{Key Bindings,,Customizing Key Bindings,emacs, |
|
|
The GNU Emacs Manual}.) |
|
|
|
|
|
When you press @kbd{M-#}, Emacs waits for you to press a second key to |
|
|
complete the command. In this case, you will follow @kbd{M-#} with a |
|
|
letter (upper- or lower-case, it doesn't matter for @kbd{M-#}) that says |
|
987 |
which Calc interface you want to use. |
which Calc interface you want to use. |
988 |
|
|
989 |
To get Calc's standard interface, type @kbd{M-# c}. To get |
To get Calc's standard interface, type @kbd{C-x * c}. To get |
990 |
Keypad mode, type @kbd{M-# k}. Type @kbd{M-# ?} to get a brief |
Keypad mode, type @kbd{C-x * k}. Type @kbd{C-x * ?} to get a brief |
991 |
list of the available options, and type a second @kbd{?} to get |
list of the available options, and type a second @kbd{?} to get |
992 |
a complete list. |
a complete list. |
993 |
|
|
994 |
To ease typing, @kbd{M-# M-#} (or @kbd{M-# #} if that's easier) |
To ease typing, @kbd{C-x * *} also works to start Calc. It starts the |
995 |
also works to start Calc. It starts the same interface (either |
same interface (either @kbd{C-x * c} or @w{@kbd{C-x * k}}) that you last |
996 |
@kbd{M-# c} or @w{@kbd{M-# k}}) that you last used, selecting the |
used, selecting the @kbd{C-x * c} interface by default. |
|
@kbd{M-# c} interface by default. (If your installation has |
|
|
a special function key set up to act like @kbd{M-#}, hitting that |
|
|
function key twice is just like hitting @kbd{M-# M-#}.) |
|
997 |
|
|
998 |
If @kbd{M-#} doesn't work for you, you can always type explicit |
If @kbd{C-x *} doesn't work for you, you can always type explicit |
999 |
commands like @kbd{M-x calc} (for the standard user interface) or |
commands like @kbd{M-x calc} (for the standard user interface) or |
1000 |
@w{@kbd{M-x calc-keypad}} (for Keypad mode). First type @kbd{M-x} |
@w{@kbd{M-x calc-keypad}} (for Keypad mode). First type @kbd{M-x} |
1001 |
(that's Meta with the letter @kbd{x}), then, at the prompt, |
(that's Meta with the letter @kbd{x}), then, at the prompt, |
1002 |
type the full command (like @kbd{calc-keypad}) and press Return. |
type the full command (like @kbd{calc-keypad}) and press Return. |
1003 |
|
|
1004 |
The same commands (like @kbd{M-# c} or @kbd{M-# M-#}) that start |
The same commands (like @kbd{C-x * c} or @kbd{C-x * *}) that start |
1005 |
the Calculator also turn it off if it is already on. |
the Calculator also turn it off if it is already on. |
1006 |
|
|
1007 |
@node The Standard Interface, Quick Mode Overview, Starting Calc, Using Calc |
@node The Standard Interface, Quick Mode Overview, Starting Calc, Using Calc |
1010 |
@noindent |
@noindent |
1011 |
@cindex Standard user interface |
@cindex Standard user interface |
1012 |
Calc's standard interface acts like a traditional RPN calculator, |
Calc's standard interface acts like a traditional RPN calculator, |
1013 |
operated by the normal Emacs keyboard. When you type @kbd{M-# c} |
operated by the normal Emacs keyboard. When you type @kbd{C-x * c} |
1014 |
to start the Calculator, the Emacs screen splits into two windows |
to start the Calculator, the Emacs screen splits into two windows |
1015 |
with the file you were editing on top and Calc on the bottom. |
with the file you were editing on top and Calc on the bottom. |
1016 |
|
|
1066 |
cursor is in the Calc stack or trail windows, keys are interpreted |
cursor is in the Calc stack or trail windows, keys are interpreted |
1067 |
as Calc commands. |
as Calc commands. |
1068 |
|
|
1069 |
When you quit by pressing @kbd{M-# c} a second time, the Calculator |
When you quit by pressing @kbd{C-x * c} a second time, the Calculator |
1070 |
windows go away but the actual Stack and Trail are not gone, just |
windows go away but the actual Stack and Trail are not gone, just |
1071 |
hidden. When you press @kbd{M-# c} once again you will get the |
hidden. When you press @kbd{C-x * c} once again you will get the |
1072 |
same stack and trail contents you had when you last used the |
same stack and trail contents you had when you last used the |
1073 |
Calculator. |
Calculator. |
1074 |
|
|
1075 |
The Calculator does not remember its state between Emacs sessions. |
The Calculator does not remember its state between Emacs sessions. |
1076 |
Thus if you quit Emacs and start it again, @kbd{M-# c} will give you |
Thus if you quit Emacs and start it again, @kbd{C-x * c} will give you |
1077 |
a fresh stack and trail. There is a command (@kbd{m m}) that lets |
a fresh stack and trail. There is a command (@kbd{m m}) that lets |
1078 |
you save your favorite mode settings between sessions, though. |
you save your favorite mode settings between sessions, though. |
1079 |
One of the things it saves is which user interface (standard or |
One of the things it saves is which user interface (standard or |
1080 |
Keypad) you last used; otherwise, a freshly started Emacs will |
Keypad) you last used; otherwise, a freshly started Emacs will |
1081 |
always treat @kbd{M-# M-#} the same as @kbd{M-# c}. |
always treat @kbd{C-x * *} the same as @kbd{C-x * c}. |
1082 |
|
|
1083 |
The @kbd{q} key is another equivalent way to turn the Calculator off. |
The @kbd{q} key is another equivalent way to turn the Calculator off. |
1084 |
|
|
1085 |
If you type @kbd{M-# b} first and then @kbd{M-# c}, you get a |
If you type @kbd{C-x * b} first and then @kbd{C-x * c}, you get a |
1086 |
full-screen version of Calc (@code{full-calc}) in which the stack and |
full-screen version of Calc (@code{full-calc}) in which the stack and |
1087 |
trail windows are still side-by-side but are now as tall as the whole |
trail windows are still side-by-side but are now as tall as the whole |
1088 |
Emacs screen. When you press @kbd{q} or @kbd{M-# c} again to quit, |
Emacs screen. When you press @kbd{q} or @kbd{C-x * c} again to quit, |
1089 |
the file you were editing before reappears. The @kbd{M-# b} key |
the file you were editing before reappears. The @kbd{C-x * b} key |
1090 |
switches back and forth between ``big'' full-screen mode and the |
switches back and forth between ``big'' full-screen mode and the |
1091 |
normal partial-screen mode. |
normal partial-screen mode. |
1092 |
|
|
1093 |
Finally, @kbd{M-# o} (@code{calc-other-window}) is like @kbd{M-# c} |
Finally, @kbd{C-x * o} (@code{calc-other-window}) is like @kbd{C-x * c} |
1094 |
except that the Calc window is not selected. The buffer you were |
except that the Calc window is not selected. The buffer you were |
1095 |
editing before remains selected instead. @kbd{M-# o} is a handy |
editing before remains selected instead. @kbd{C-x * o} is a handy |
1096 |
way to switch out of Calc momentarily to edit your file; type |
way to switch out of Calc momentarily to edit your file; type |
1097 |
@kbd{M-# c} to switch back into Calc when you are done. |
@kbd{C-x * c} to switch back into Calc when you are done. |
1098 |
|
|
1099 |
@node Quick Mode Overview, Keypad Mode Overview, The Standard Interface, Using Calc |
@node Quick Mode Overview, Keypad Mode Overview, The Standard Interface, Using Calc |
1100 |
@subsection Quick Mode (Overview) |
@subsection Quick Mode (Overview) |
1101 |
|
|
1102 |
@noindent |
@noindent |
1103 |
@dfn{Quick mode} is a quick way to use Calc when you don't need the |
@dfn{Quick mode} is a quick way to use Calc when you don't need the |
1104 |
full complexity of the stack and trail. To use it, type @kbd{M-# q} |
full complexity of the stack and trail. To use it, type @kbd{C-x * q} |
1105 |
(@code{quick-calc}) in any regular editing buffer. |
(@code{quick-calc}) in any regular editing buffer. |
1106 |
|
|
1107 |
Quick mode is very simple: It prompts you to type any formula in |
Quick mode is very simple: It prompts you to type any formula in |
1108 |
standard algebraic notation (like @samp{4 - 2/3}) and then displays |
standard algebraic notation (like @samp{4 - 2/3}) and then displays |
1109 |
the result at the bottom of the Emacs screen (@mathit{3.33333333333} |
the result at the bottom of the Emacs screen (@mathit{3.33333333333} |
1110 |
in this case). You are then back in the same editing buffer you |
in this case). You are then back in the same editing buffer you |
1111 |
were in before, ready to continue editing or to type @kbd{M-# q} |
were in before, ready to continue editing or to type @kbd{C-x * q} |
1112 |
again to do another quick calculation. The result of the calculation |
again to do another quick calculation. The result of the calculation |
1113 |
will also be in the Emacs ``kill ring'' so that a @kbd{C-y} command |
will also be in the Emacs ``kill ring'' so that a @kbd{C-y} command |
1114 |
at this point will yank the result into your editing buffer. |
at this point will yank the result into your editing buffer. |
1115 |
|
|
1116 |
Calc mode settings affect Quick mode, too, though you will have to |
Calc mode settings affect Quick mode, too, though you will have to |
1117 |
go into regular Calc (with @kbd{M-# c}) to change the mode settings. |
go into regular Calc (with @kbd{C-x * c}) to change the mode settings. |
1118 |
|
|
1119 |
@c [fix-ref Quick Calculator mode] |
@c [fix-ref Quick Calculator mode] |
1120 |
@xref{Quick Calculator}, for further information. |
@xref{Quick Calculator}, for further information. |
1128 |
don't have a mouse, you will have to operate Keypad mode with your |
don't have a mouse, you will have to operate Keypad mode with your |
1129 |
arrow keys (which is probably more trouble than it's worth). |
arrow keys (which is probably more trouble than it's worth). |
1130 |
|
|
1131 |
Type @kbd{M-# k} to turn Keypad mode on or off. Once again you |
Type @kbd{C-x * k} to turn Keypad mode on or off. Once again you |
1132 |
get two new windows, this time on the righthand side of the screen |
get two new windows, this time on the righthand side of the screen |
1133 |
instead of at the bottom. The upper window is the familiar Calc |
instead of at the bottom. The upper window is the familiar Calc |
1134 |
Stack; the lower window is a picture of a typical calculator keypad. |
Stack; the lower window is a picture of a typical calculator keypad. |
1190 |
keypad. One advantage of Keypad mode is that you don't need an |
keypad. One advantage of Keypad mode is that you don't need an |
1191 |
explicit command to switch between editing and calculating. |
explicit command to switch between editing and calculating. |
1192 |
|
|
1193 |
If you press @kbd{M-# b} first, you get a full-screen Keypad mode |
If you press @kbd{C-x * b} first, you get a full-screen Keypad mode |
1194 |
(@code{full-calc-keypad}) with three windows: The keypad in the lower |
(@code{full-calc-keypad}) with three windows: The keypad in the lower |
1195 |
left, the stack in the lower right, and the trail on top. |
left, the stack in the lower right, and the trail on top. |
1196 |
|
|
1218 |
@end example |
@end example |
1219 |
|
|
1220 |
@noindent |
@noindent |
1221 |
which run a full-screen Calculator (as if by @kbd{M-# b M-# c}) or |
which run a full-screen Calculator (as if by @kbd{C-x * b C-x * c}) or |
1222 |
a full-screen X-based Calculator (as if by @kbd{M-# b M-# k}). |
a full-screen X-based Calculator (as if by @kbd{C-x * b C-x * k}). |
1223 |
In standalone operation, quitting the Calculator (by pressing |
In standalone operation, quitting the Calculator (by pressing |
1224 |
@kbd{q} or clicking on the keypad @key{EXIT} button) quits Emacs |
@kbd{q} or clicking on the keypad @key{EXIT} button) quits Emacs |
1225 |
itself. |
itself. |
1226 |
|
|
1227 |
@node Embedded Mode Overview, Other M-# Commands, Standalone Operation, Using Calc |
@node Embedded Mode Overview, Other C-x * Commands, Standalone Operation, Using Calc |
1228 |
@subsection Embedded Mode (Overview) |
@subsection Embedded Mode (Overview) |
1229 |
|
|
1230 |
@noindent |
@noindent |
1260 |
@end group |
@end group |
1261 |
@end smallexample |
@end smallexample |
1262 |
|
|
1263 |
Now, move the cursor onto this new formula and press @kbd{M-# e}. |
Now, move the cursor onto this new formula and press @kbd{C-x * e}. |
1264 |
Calc will read the formula (using the surrounding blank lines to |
Calc will read the formula (using the surrounding blank lines to |
1265 |
tell how much text to read), then push this formula (invisibly) |
tell how much text to read), then push this formula (invisibly) |
1266 |
onto the Calc stack. The cursor will stay on the formula in the |
onto the Calc stack. The cursor will stay on the formula in the |
1324 |
@end group |
@end group |
1325 |
@end smallexample |
@end smallexample |
1326 |
|
|
1327 |
To leave Embedded mode, type @kbd{M-# e} again. The mode line |
To leave Embedded mode, type @kbd{C-x * e} again. The mode line |
1328 |
and keyboard will revert to the way they were before. |
and keyboard will revert to the way they were before. |
1329 |
|
|
1330 |
The related command @kbd{M-# w} operates on a single word, which |
The related command @kbd{C-x * w} operates on a single word, which |
1331 |
generally means a single number, inside text. It uses any |
generally means a single number, inside text. It uses any |
1332 |
non-numeric characters rather than blank lines to delimit the |
non-numeric characters rather than blank lines to delimit the |
1333 |
formula it reads. Here's an example of its use: |
formula it reads. Here's an example of its use: |
1336 |
A slope of one-third corresponds to an angle of 1 degrees. |
A slope of one-third corresponds to an angle of 1 degrees. |
1337 |
@end smallexample |
@end smallexample |
1338 |
|
|
1339 |
Place the cursor on the @samp{1}, then type @kbd{M-# w} to enable |
Place the cursor on the @samp{1}, then type @kbd{C-x * w} to enable |
1340 |
Embedded mode on that number. Now type @kbd{3 /} (to get one-third), |
Embedded mode on that number. Now type @kbd{3 /} (to get one-third), |
1341 |
and @kbd{I T} (the Inverse Tangent converts a slope into an angle), |
and @kbd{I T} (the Inverse Tangent converts a slope into an angle), |
1342 |
then @w{@kbd{M-# w}} again to exit Embedded mode. |
then @w{@kbd{C-x * w}} again to exit Embedded mode. |
1343 |
|
|
1344 |
@smallexample |
@smallexample |
1345 |
A slope of one-third corresponds to an angle of 18.4349488229 degrees. |
A slope of one-third corresponds to an angle of 18.4349488229 degrees. |
1348 |
@c [fix-ref Embedded Mode] |
@c [fix-ref Embedded Mode] |
1349 |
@xref{Embedded Mode}, for full details. |
@xref{Embedded Mode}, for full details. |
1350 |
|
|
1351 |
@node Other M-# Commands, , Embedded Mode Overview, Using Calc |
@node Other C-x * Commands, , Embedded Mode Overview, Using Calc |
1352 |
@subsection Other @kbd{M-#} Commands |
@subsection Other @kbd{C-x *} Commands |
1353 |
|
|
1354 |
@noindent |
@noindent |
1355 |
Two more Calc-related commands are @kbd{M-# g} and @kbd{M-# r}, |
Two more Calc-related commands are @kbd{C-x * g} and @kbd{C-x * r}, |
1356 |
which ``grab'' data from a selected region of a buffer into the |
which ``grab'' data from a selected region of a buffer into the |
1357 |
Calculator. The region is defined in the usual Emacs way, by |
Calculator. The region is defined in the usual Emacs way, by |
1358 |
a ``mark'' placed at one end of the region, and the Emacs |
a ``mark'' placed at one end of the region, and the Emacs |
1359 |
cursor or ``point'' placed at the other. |
cursor or ``point'' placed at the other. |
1360 |
|
|
1361 |
The @kbd{M-# g} command reads the region in the usual left-to-right, |
The @kbd{C-x * g} command reads the region in the usual left-to-right, |
1362 |
top-to-bottom order. The result is packaged into a Calc vector |
top-to-bottom order. The result is packaged into a Calc vector |
1363 |
of numbers and placed on the stack. Calc (in its standard |
of numbers and placed on the stack. Calc (in its standard |
1364 |
user interface) is then started. Type @kbd{v u} if you want |
user interface) is then started. Type @kbd{v u} if you want |
1365 |
to unpack this vector into separate numbers on the stack. Also, |
to unpack this vector into separate numbers on the stack. Also, |
1366 |
@kbd{C-u M-# g} interprets the region as a single number or |
@kbd{C-u C-x * g} interprets the region as a single number or |
1367 |
formula. |
formula. |
1368 |
|
|
1369 |
The @kbd{M-# r} command reads a rectangle, with the point and |
The @kbd{C-x * r} command reads a rectangle, with the point and |
1370 |
mark defining opposite corners of the rectangle. The result |
mark defining opposite corners of the rectangle. The result |
1371 |
is a matrix of numbers on the Calculator stack. |
is a matrix of numbers on the Calculator stack. |
1372 |
|
|
1373 |
Complementary to these is @kbd{M-# y}, which ``yanks'' the |
Complementary to these is @kbd{C-x * y}, which ``yanks'' the |
1374 |
value at the top of the Calc stack back into an editing buffer. |
value at the top of the Calc stack back into an editing buffer. |
1375 |
If you type @w{@kbd{M-# y}} while in such a buffer, the value is |
If you type @w{@kbd{C-x * y}} while in such a buffer, the value is |
1376 |
yanked at the current position. If you type @kbd{M-# y} while |
yanked at the current position. If you type @kbd{C-x * y} while |
1377 |
in the Calc buffer, Calc makes an educated guess as to which |
in the Calc buffer, Calc makes an educated guess as to which |
1378 |
editing buffer you want to use. The Calc window does not have |
editing buffer you want to use. The Calc window does not have |
1379 |
to be visible in order to use this command, as long as there |
to be visible in order to use this command, as long as there |
1380 |
is something on the Calc stack. |
is something on the Calc stack. |
1381 |
|
|
1382 |
Here, for reference, is the complete list of @kbd{M-#} commands. |
Here, for reference, is the complete list of @kbd{C-x *} commands. |
1383 |
The shift, control, and meta keys are ignored for the keystroke |
The shift, control, and meta keys are ignored for the keystroke |
1384 |
following @kbd{M-#}. |
following @kbd{C-x *}. |
1385 |
|
|
1386 |
@noindent |
@noindent |
1387 |
Commands for turning Calc on and off: |
Commands for turning Calc on and off: |
1388 |
|
|
1389 |
@table @kbd |
@table @kbd |
1390 |
@item # |
@item * |
1391 |
Turn Calc on or off, employing the same user interface as last time. |
Turn Calc on or off, employing the same user interface as last time. |
1392 |
|
|
1393 |
|
@item =, +, -, /, \, &, # |
1394 |
|
Alternatives for @kbd{*}. |
1395 |
|
|
1396 |
@item C |
@item C |
1397 |
Turn Calc on or off using its standard bottom-of-the-screen |
Turn Calc on or off using its standard bottom-of-the-screen |
1398 |
interface. If Calc is already turned on but the cursor is not |
interface. If Calc is already turned on but the cursor is not |
1404 |
move it out of that window. |
move it out of that window. |
1405 |
|
|
1406 |
@item B |
@item B |
1407 |
Control whether @kbd{M-# c} and @kbd{M-# k} use the full screen. |
Control whether @kbd{C-x * c} and @kbd{C-x * k} use the full screen. |
1408 |
|
|
1409 |
@item Q |
@item Q |
1410 |
Use Quick mode for a single short calculation. |
Use Quick mode for a single short calculation. |
1615 |
@c [tutorial] |
@c [tutorial] |
1616 |
|
|
1617 |
@ifinfo |
@ifinfo |
1618 |
@c This node is accessed by the `M-# t' command. |
@c This node is accessed by the `C-x * t' command. |
1619 |
@node Interactive Tutorial, , , Top |
@node Interactive Tutorial, , , Top |
1620 |
@chapter Tutorial |
@chapter Tutorial |
1621 |
|
|
1669 |
The easiest way to read this tutorial on-line is to have two windows on |
The easiest way to read this tutorial on-line is to have two windows on |
1670 |
your Emacs screen, one with Calc and one with the Info system. (If you |
your Emacs screen, one with Calc and one with the Info system. (If you |
1671 |
have a printed copy of the manual you can use that instead.) Press |
have a printed copy of the manual you can use that instead.) Press |
1672 |
@kbd{M-# c} to turn Calc on or to switch into the Calc window, and |
@kbd{C-x * c} to turn Calc on or to switch into the Calc window, and |
1673 |
press @kbd{M-# i} to start the Info system or to switch into its window. |
press @kbd{C-x * i} to start the Info system or to switch into its window. |
1674 |
Or, you may prefer to use the tutorial in printed form. |
Or, you may prefer to use the tutorial in printed form. |
1675 |
@end ifinfo |
@end ifinfo |
1676 |
@iftex |
@iftex |
1677 |
The easiest way to read this tutorial on-line is to have two windows on |
The easiest way to read this tutorial on-line is to have two windows on |
1678 |
your Emacs screen, one with Calc and one with the Info system. (If you |
your Emacs screen, one with Calc and one with the Info system. (If you |
1679 |
have a printed copy of the manual you can use that instead.) Press |
have a printed copy of the manual you can use that instead.) Press |
1680 |
@kbd{M-# c} to turn Calc on or to switch into the Calc window, and |
@kbd{C-x * c} to turn Calc on or to switch into the Calc window, and |
1681 |
press @kbd{M-# i} to start the Info system or to switch into its window. |
press @kbd{C-x * i} to start the Info system or to switch into its window. |
1682 |
@end iftex |
@end iftex |
1683 |
|
|
1684 |
This tutorial is designed to be done in sequence. But the rest of this |
This tutorial is designed to be done in sequence. But the rest of this |
1759 |
Thus we could add the numbers 2 and 3 in an RPN calculator by typing: |
Thus we could add the numbers 2 and 3 in an RPN calculator by typing: |
1760 |
@kbd{2 @key{RET} 3 @key{RET} +}. (The @key{RET} key, Return, corresponds to |
@kbd{2 @key{RET} 3 @key{RET} +}. (The @key{RET} key, Return, corresponds to |
1761 |
the @key{ENTER} key on traditional RPN calculators.) Try this now if |
the @key{ENTER} key on traditional RPN calculators.) Try this now if |
1762 |
you wish; type @kbd{M-# c} to switch into the Calc window (you can type |
you wish; type @kbd{C-x * c} to switch into the Calc window (you can type |
1763 |
@kbd{M-# c} again or @kbd{M-# o} to switch back to the Tutorial window). |
@kbd{C-x * c} again or @kbd{C-x * o} to switch back to the Tutorial window). |
1764 |
The first four keystrokes ``push'' the numbers 2 and 3 onto the stack. |
The first four keystrokes ``push'' the numbers 2 and 3 onto the stack. |
1765 |
The @kbd{+} key ``pops'' the top two numbers from the stack, adds them, |
The @kbd{+} key ``pops'' the top two numbers from the stack, adds them, |
1766 |
and pushes the result (5) back onto the stack. Here's how the stack |
and pushes the result (5) back onto the stack. Here's how the stack |
1772 |
. 1: 3 . |
. 1: 3 . |
1773 |
. |
. |
1774 |
|
|
1775 |
M-# c 2 @key{RET} 3 @key{RET} + @key{DEL} |
C-x * c 2 @key{RET} 3 @key{RET} + @key{DEL} |
1776 |
@end group |
@end group |
1777 |
@end smallexample |
@end smallexample |
1778 |
|
|
2421 |
@noindent |
@noindent |
2422 |
If you make a mistake, you can usually correct it by pressing shift-@kbd{U}, |
If you make a mistake, you can usually correct it by pressing shift-@kbd{U}, |
2423 |
the ``undo'' command. First, clear the stack (@kbd{M-0 @key{DEL}}) and exit |
the ``undo'' command. First, clear the stack (@kbd{M-0 @key{DEL}}) and exit |
2424 |
and restart Calc (@kbd{M-# M-# M-# M-#}) to make sure things start off |
and restart Calc (@kbd{C-x * * C-x * *}) to make sure things start off |
2425 |
with a clean slate. Now: |
with a clean slate. Now: |
2426 |
|
|
2427 |
@smallexample |
@smallexample |
4080 |
|
|
4081 |
@noindent |
@noindent |
4082 |
If you are reading this tutorial in printed form, you will find it |
If you are reading this tutorial in printed form, you will find it |
4083 |
easiest to press @kbd{M-# i} to enter the on-line Info version of |
easiest to press @kbd{C-x * i} to enter the on-line Info version of |
4084 |
the manual and find this table there. (Press @kbd{g}, then type |
the manual and find this table there. (Press @kbd{g}, then type |
4085 |
@kbd{List Tutorial}, to jump straight to this section.) |
@kbd{List Tutorial}, to jump straight to this section.) |
4086 |
|
|
4089 |
(On your system this may be @kbd{C-2}, @kbd{C-@key{SPC}}, or @kbd{NUL}.) |
(On your system this may be @kbd{C-2}, @kbd{C-@key{SPC}}, or @kbd{NUL}.) |
4090 |
Now position the cursor to the lower-right, just after the @expr{1.354}. |
Now position the cursor to the lower-right, just after the @expr{1.354}. |
4091 |
You have now defined this region as an Emacs ``rectangle.'' Still |
You have now defined this region as an Emacs ``rectangle.'' Still |
4092 |
in the Info buffer, type @kbd{M-# r}. This command |
in the Info buffer, type @kbd{C-x * r}. This command |
4093 |
(@code{calc-grab-rectangle}) will pop you back into the Calculator, with |
(@code{calc-grab-rectangle}) will pop you back into the Calculator, with |
4094 |
the contents of the rectangle you specified in the form of a matrix. |
the contents of the rectangle you specified in the form of a matrix. |
4095 |
|
|
4359 |
|
|
4360 |
@cindex Geometric mean |
@cindex Geometric mean |
4361 |
(@bullet{}) @strong{Exercise 3.} If the input data do not form a |
(@bullet{}) @strong{Exercise 3.} If the input data do not form a |
4362 |
rectangle, you can use @w{@kbd{M-# g}} (@code{calc-grab-region}) |
rectangle, you can use @w{@kbd{C-x * g}} (@code{calc-grab-region}) |
4363 |
to grab the data the way Emacs normally works with regions---it reads |
to grab the data the way Emacs normally works with regions---it reads |
4364 |
left-to-right, top-to-bottom, treating line breaks the same as spaces. |
left-to-right, top-to-bottom, treating line breaks the same as spaces. |
4365 |
Use this command to find the geometric mean of the following numbers. |
Use this command to find the geometric mean of the following numbers. |
4372 |
@end example |
@end example |
4373 |
|
|
4374 |
@noindent |
@noindent |
4375 |
The @kbd{M-# g} command accepts numbers separated by spaces or commas, |
The @kbd{C-x * g} command accepts numbers separated by spaces or commas, |
4376 |
with or without surrounding vector brackets. |
with or without surrounding vector brackets. |
4377 |
@xref{List Answer 3, 3}. (@bullet{}) |
@xref{List Answer 3, 3}. (@bullet{}) |
4378 |
|
|
5107 |
@end smallexample |
@end smallexample |
5108 |
|
|
5109 |
To see a complete list of built-in units, type @kbd{u v}. Press |
To see a complete list of built-in units, type @kbd{u v}. Press |
5110 |
@w{@kbd{M-# c}} again to re-enter the Calculator when you're done looking |
@w{@kbd{C-x * c}} again to re-enter the Calculator when you're done looking |
5111 |
at the units table. |
at the units table. |
5112 |
|
|
5113 |
(@bullet{}) @strong{Exercise 13.} How many seconds are there really |
(@bullet{}) @strong{Exercise 13.} How many seconds are there really |
6573 |
which reads the current region of the current buffer as a sequence of |
which reads the current region of the current buffer as a sequence of |
6574 |
keystroke names, and defines that sequence on the @kbd{X} |
keystroke names, and defines that sequence on the @kbd{X} |
6575 |
(and @kbd{C-x e}) key. Because this is so useful, Calc puts this |
(and @kbd{C-x e}) key. Because this is so useful, Calc puts this |
6576 |
command on the @kbd{M-# m} key. Try reading in this macro in the |
command on the @kbd{C-x * m} key. Try reading in this macro in the |
6577 |
following form: Press @kbd{C-@@} (or @kbd{C-@key{SPC}}) at |
following form: Press @kbd{C-@@} (or @kbd{C-@key{SPC}}) at |
6578 |
one end of the text below, then type @kbd{M-# m} at the other. |
one end of the text below, then type @kbd{C-x * m} at the other. |
6579 |
|
|
6580 |
@example |
@example |
6581 |
@group |
@group |
6725 |
using the @kbd{z s} command to call itself recursively, then assign it |
using the @kbd{z s} command to call itself recursively, then assign it |
6726 |
to the same key with @kbd{Z K s}. Now the @kbd{z s} command will run |
to the same key with @kbd{Z K s}. Now the @kbd{z s} command will run |
6727 |
the complete recursive program. (Another way is to use @w{@kbd{Z E}} |
the complete recursive program. (Another way is to use @w{@kbd{Z E}} |
6728 |
or @kbd{M-# m} (@code{read-kbd-macro}) to read the whole macro at once, |
or @kbd{C-x * m} (@code{read-kbd-macro}) to read the whole macro at once, |
6729 |
thus avoiding the ``training'' phase.) The task: Write a program |
thus avoiding the ``training'' phase.) The task: Write a program |
6730 |
that computes Stirling numbers of the first kind, given @expr{n} and |
that computes Stirling numbers of the first kind, given @expr{n} and |
6731 |
@expr{m} on the stack. Test it with @emph{small} inputs like |
@expr{m} on the stack. Test it with @emph{small} inputs like |
7517 |
@noindent |
@noindent |
7518 |
Move to one end of the list and press @kbd{C-@@} (or @kbd{C-@key{SPC}} or |
Move to one end of the list and press @kbd{C-@@} (or @kbd{C-@key{SPC}} or |
7519 |
whatever) to set the mark, then move to the other end of the list |
whatever) to set the mark, then move to the other end of the list |
7520 |
and type @w{@kbd{M-# g}}. |
and type @w{@kbd{C-x * g}}. |
7521 |
|
|
7522 |
@smallexample |
@smallexample |
7523 |
@group |
@group |
9512 |
@infoline @expr{x - f(x)/f'(x)}. |
@infoline @expr{x - f(x)/f'(x)}. |
9513 |
|
|
9514 |
(Because this definition is long, it will be repeated in concise form |
(Because this definition is long, it will be repeated in concise form |
9515 |
below. You can use @w{@kbd{M-# m}} to load it from there. While you are |
below. You can use @w{@kbd{C-x * m}} to load it from there. While you are |
9516 |
entering a @kbd{Z ` Z '} body in a macro, Calc simply collects |
entering a @kbd{Z ` Z '} body in a macro, Calc simply collects |
9517 |
keystrokes without executing them. In the following diagrams we'll |
keystrokes without executing them. In the following diagrams we'll |
9518 |
pretend Calc actually executed the keystrokes as you typed them, |
pretend Calc actually executed the keystrokes as you typed them, |
9634 |
step is repeated until @expr{z > 5}. |
step is repeated until @expr{z > 5}. |
9635 |
|
|
9636 |
(Because this definition is long, it will be repeated in concise form |
(Because this definition is long, it will be repeated in concise form |
9637 |
below. You can use @w{@kbd{M-# m}} to load it from there. While you are |
below. You can use @w{@kbd{C-x * m}} to load it from there. While you are |
9638 |
entering a @kbd{Z ` Z '} body in a macro, Calc simply collects |
entering a @kbd{Z ` Z '} body in a macro, Calc simply collects |
9639 |
keystrokes without executing them. In the following diagrams we'll |
keystrokes without executing them. In the following diagrams we'll |
9640 |
pretend Calc actually executed the keystrokes as you typed them, |
pretend Calc actually executed the keystrokes as you typed them, |
9755 |
coefficient on the @expr{x^n} term times @expr{n!}. |
coefficient on the @expr{x^n} term times @expr{n!}. |
9756 |
|
|
9757 |
(Because this definition is long, it will be repeated in concise form |
(Because this definition is long, it will be repeated in concise form |
9758 |
below. You can use @w{@kbd{M-# m}} to load it from there. While you are |
below. You can use @w{@kbd{C-x * m}} to load it from there. While you are |
9759 |
entering a @kbd{Z ` Z '} body in a macro, Calc simply collects |
entering a @kbd{Z ` Z '} body in a macro, Calc simply collects |
9760 |
keystrokes without executing them. In the following diagrams we'll |
keystrokes without executing them. In the following diagrams we'll |
9761 |
pretend Calc actually executed the keystrokes as you typed them, |
pretend Calc actually executed the keystrokes as you typed them, |
9864 |
to the form @expr{s(n,m) = s(n-1,m-1) - (n-1) s(n-1,m)}. |
to the form @expr{s(n,m) = s(n-1,m-1) - (n-1) s(n-1,m)}. |
9865 |
|
|
9866 |
(Because this definition is long, it will be repeated in concise form |
(Because this definition is long, it will be repeated in concise form |
9867 |
below. You can use @kbd{M-# m} to load it from there.) |
below. You can use @kbd{C-x * m} to load it from there.) |
9868 |
|
|
9869 |
@smallexample |
@smallexample |
9870 |
@group |
@group |
9938 |
@end group |
@end group |
9939 |
@end example |
@end example |
9940 |
|
|
9941 |
You can read this definition using @kbd{M-# m} (@code{read-kbd-macro}) |
You can read this definition using @kbd{C-x * m} (@code{read-kbd-macro}) |
9942 |
followed by @kbd{Z K s}, without having to make a dummy definition |
followed by @kbd{Z K s}, without having to make a dummy definition |
9943 |
first, because @code{read-kbd-macro} doesn't need to execute the |
first, because @code{read-kbd-macro} doesn't need to execute the |
9944 |
definition as it reads it in. For this reason, @code{M-# m} is often |
definition as it reads it in. For this reason, @code{C-x * m} is often |
9945 |
the easiest way to create recursive programs in Calc. |
the easiest way to create recursive programs in Calc. |
9946 |
|
|
9947 |
@node Programming Answer 12, , Programming Answer 11, Answers to Exercises |
@node Programming Answer 12, , Programming Answer 11, Answers to Exercises |
10031 |
to turn the trail window off, but the @samp{*Calc Trail*} buffer itself |
to turn the trail window off, but the @samp{*Calc Trail*} buffer itself |
10032 |
still exists and is updated silently. @xref{Trail Commands}. |
still exists and is updated silently. @xref{Trail Commands}. |
10033 |
|
|
10034 |
@kindex M-# c |
@kindex C-x * c |
10035 |
@kindex M-# M-# |
@kindex C-x * * |
10036 |
@ignore |
@ignore |
10037 |
@mindex @null |
@mindex @null |
10038 |
@end ignore |
@end ignore |
10039 |
@kindex M-# # |
In most installations, the @kbd{C-x * c} key sequence is a more |
10040 |
In most installations, the @kbd{M-# c} key sequence is a more |
convenient way to start the Calculator. Also, @kbd{C-x * *} |
10041 |
convenient way to start the Calculator. Also, @kbd{M-# M-#} and |
is a synonym for @kbd{C-x * c} unless you last used Calc |
|
@kbd{M-# #} are synonyms for @kbd{M-# c} unless you last used Calc |
|
10042 |
in its Keypad mode. |
in its Keypad mode. |
10043 |
|
|
10044 |
@kindex x |
@kindex x |
10054 |
|
|
10055 |
@cindex Extensions module |
@cindex Extensions module |
10056 |
@cindex @file{calc-ext} module |
@cindex @file{calc-ext} module |
10057 |
The Calculator exists in many parts. When you type @kbd{M-# c}, the |
The Calculator exists in many parts. When you type @kbd{C-x * c}, the |
10058 |
Emacs ``auto-load'' mechanism will bring in only the first part, which |
Emacs ``auto-load'' mechanism will bring in only the first part, which |
10059 |
contains the basic arithmetic functions. The other parts will be |
contains the basic arithmetic functions. The other parts will be |
10060 |
auto-loaded the first time you use the more advanced commands like trig |
auto-loaded the first time you use the more advanced commands like trig |
10062 |
of the Calculator in the common case when all you need to do is a |
of the Calculator in the common case when all you need to do is a |
10063 |
little arithmetic. If for some reason the Calculator fails to load an |
little arithmetic. If for some reason the Calculator fails to load an |
10064 |
extension module automatically, you can force it to load all the |
extension module automatically, you can force it to load all the |
10065 |
extensions by using the @kbd{M-# L} (@code{calc-load-everything}) |
extensions by using the @kbd{C-x * L} (@code{calc-load-everything}) |
10066 |
command. @xref{Mode Settings}. |
command. @xref{Mode Settings}. |
10067 |
|
|
10068 |
If you type @kbd{M-x calc} or @kbd{M-# c} with any numeric prefix argument, |
If you type @kbd{M-x calc} or @kbd{C-x * c} with any numeric prefix argument, |
10069 |
the Calculator is loaded if necessary, but it is not actually started. |
the Calculator is loaded if necessary, but it is not actually started. |
10070 |
If the argument is positive, the @file{calc-ext} extensions are also |
If the argument is positive, the @file{calc-ext} extensions are also |
10071 |
loaded if necessary. User-written Lisp code that wishes to make use |
loaded if necessary. User-written Lisp code that wishes to make use |
10072 |
of Calc's arithmetic routines can use @samp{(calc 0)} or @samp{(calc 1)} |
of Calc's arithmetic routines can use @samp{(calc 0)} or @samp{(calc 1)} |
10073 |
to auto-load the Calculator. |
to auto-load the Calculator. |
10074 |
|
|
10075 |
@kindex M-# b |
@kindex C-x * b |
10076 |
@pindex full-calc |
@pindex full-calc |
10077 |
If you type @kbd{M-# b}, then next time you use @kbd{M-# c} you |
If you type @kbd{C-x * b}, then next time you use @kbd{C-x * c} you |
10078 |
will get a Calculator that uses the full height of the Emacs screen. |
will get a Calculator that uses the full height of the Emacs screen. |
10079 |
When full-screen mode is on, @kbd{M-# c} runs the @code{full-calc} |
When full-screen mode is on, @kbd{C-x * c} runs the @code{full-calc} |
10080 |
command instead of @code{calc}. From the Unix shell you can type |
command instead of @code{calc}. From the Unix shell you can type |
10081 |
@samp{emacs -f full-calc} to start a new Emacs specifically for use |
@samp{emacs -f full-calc} to start a new Emacs specifically for use |
10082 |
as a calculator. When Calc is started from the Emacs command line |
as a calculator. When Calc is started from the Emacs command line |
10083 |
like this, Calc's normal ``quit'' commands actually quit Emacs itself. |
like this, Calc's normal ``quit'' commands actually quit Emacs itself. |
10084 |
|
|
10085 |
@kindex M-# o |
@kindex C-x * o |
10086 |
@pindex calc-other-window |
@pindex calc-other-window |
10087 |
The @kbd{M-# o} command is like @kbd{M-# c} except that the Calc |
The @kbd{C-x * o} command is like @kbd{C-x * c} except that the Calc |
10088 |
window is not actually selected. If you are already in the Calc |
window is not actually selected. If you are already in the Calc |
10089 |
window, @kbd{M-# o} switches you out of it. (The regular Emacs |
window, @kbd{C-x * o} switches you out of it. (The regular Emacs |
10090 |
@kbd{C-x o} command would also work for this, but it has a |
@kbd{C-x o} command would also work for this, but it has a |
10091 |
tendency to drop you into the Calc Trail window instead, which |
tendency to drop you into the Calc Trail window instead, which |
10092 |
@kbd{M-# o} takes care not to do.) |
@kbd{C-x * o} takes care not to do.) |
10093 |
|
|
10094 |
@ignore |
@ignore |
10095 |
@mindex M-# q |
@mindex C-x * q |
10096 |
@end ignore |
@end ignore |
10097 |
For one quick calculation, you can type @kbd{M-# q} (@code{quick-calc}) |
For one quick calculation, you can type @kbd{C-x * q} (@code{quick-calc}) |
10098 |
which prompts you for a formula (like @samp{2+3/4}). The result is |
which prompts you for a formula (like @samp{2+3/4}). The result is |
10099 |
displayed at the bottom of the Emacs screen without ever creating |
displayed at the bottom of the Emacs screen without ever creating |
10100 |
any special Calculator windows. @xref{Quick Calculator}. |
any special Calculator windows. @xref{Quick Calculator}. |
10101 |
|
|
10102 |
@ignore |
@ignore |
10103 |
@mindex M-# k |
@mindex C-x * k |
10104 |
@end ignore |
@end ignore |
10105 |
Finally, if you are using the X window system you may want to try |
Finally, if you are using the X window system you may want to try |
10106 |
@kbd{M-# k} (@code{calc-keypad}) which runs Calc with a |
@kbd{C-x * k} (@code{calc-keypad}) which runs Calc with a |
10107 |
``calculator keypad'' picture as well as a stack display. Click on |
``calculator keypad'' picture as well as a stack display. Click on |
10108 |
the keys with the mouse to operate the calculator. @xref{Keypad Mode}. |
the keys with the mouse to operate the calculator. @xref{Keypad Mode}. |
10109 |
|
|
10114 |
The @kbd{q} key (@code{calc-quit}) exits Calc mode and closes the |
The @kbd{q} key (@code{calc-quit}) exits Calc mode and closes the |
10115 |
Calculator's window(s). It does not delete the Calculator buffers. |
Calculator's window(s). It does not delete the Calculator buffers. |
10116 |
If you type @kbd{M-x calc} again, the Calculator will reappear with the |
If you type @kbd{M-x calc} again, the Calculator will reappear with the |
10117 |
contents of the stack intact. Typing @kbd{M-# c} or @kbd{M-# M-#} |
contents of the stack intact. Typing @kbd{C-x * c} or @kbd{C-x * *} |
10118 |
again from inside the Calculator buffer is equivalent to executing |
again from inside the Calculator buffer is equivalent to executing |
10119 |
@code{calc-quit}; you can think of @kbd{M-# M-#} as toggling the |
@code{calc-quit}; you can think of @kbd{C-x * *} as toggling the |
10120 |
Calculator on and off. |
Calculator on and off. |
10121 |
|
|
10122 |
@kindex M-# x |
@kindex C-x * x |
10123 |
The @kbd{M-# x} command also turns the Calculator off, no matter which |
The @kbd{C-x * x} command also turns the Calculator off, no matter which |
10124 |
user interface (standard, Keypad, or Embedded) is currently active. |
user interface (standard, Keypad, or Embedded) is currently active. |
10125 |
It also cancels @code{calc-edit} mode if used from there. |
It also cancels @code{calc-edit} mode if used from there. |
10126 |
|
|
10160 |
and @code{calc-scroll-up}. They scroll up or down by one-half the |
and @code{calc-scroll-up}. They scroll up or down by one-half the |
10161 |
height of the Calc window. |
height of the Calc window. |
10162 |
|
|
10163 |
@kindex M-# 0 |
@kindex C-x * 0 |
10164 |
@pindex calc-reset |
@pindex calc-reset |
10165 |
The @kbd{M-# 0} command (@code{calc-reset}; that's @kbd{M-#} followed |
The @kbd{C-x * 0} command (@code{calc-reset}; that's @kbd{C-x *} followed |
10166 |
by a zero) resets the Calculator to its initial state. This clears |
by a zero) resets the Calculator to its initial state. This clears |
10167 |
the stack, resets all the modes to their initial values (the values |
the stack, resets all the modes to their initial values (the values |
10168 |
that were saved with @kbd{m m} (@code{calc-save-modes})), clears the |
that were saved with @kbd{m m} (@code{calc-save-modes})), clears the |
10169 |
caches (@pxref{Caches}), and so on. (It does @emph{not} erase the |
caches (@pxref{Caches}), and so on. (It does @emph{not} erase the |
10170 |
values of any variables.) With an argument of 0, Calc will be reset to |
values of any variables.) With an argument of 0, Calc will be reset to |
10171 |
its default state; namely, the modes will be given their default values. |
its default state; namely, the modes will be given their default values. |
10172 |
With a positive prefix argument, @kbd{M-# 0} preserves the contents of |
With a positive prefix argument, @kbd{C-x * 0} preserves the contents of |
10173 |
the stack but resets everything else to its initial state; with a |
the stack but resets everything else to its initial state; with a |
10174 |
negative prefix argument, @kbd{M-# 0} preserves the contents of the |
negative prefix argument, @kbd{C-x * 0} preserves the contents of the |
10175 |
stack but resets everything else to its default state. |
stack but resets everything else to its default state. |
10176 |
|
|
10177 |
@pindex calc-version |
@pindex calc-version |
10205 |
Calc-specific analogues to the @kbd{C-h} functions for Emacs help. |
Calc-specific analogues to the @kbd{C-h} functions for Emacs help. |
10206 |
|
|
10207 |
@kindex h i |
@kindex h i |
10208 |
@kindex M-# i |
@kindex C-x * i |
10209 |
@kindex i |
@kindex i |
10210 |
@pindex calc-info |
@pindex calc-info |
10211 |
The @kbd{h i} (@code{calc-info}) command runs the Emacs Info system |
The @kbd{h i} (@code{calc-info}) command runs the Emacs Info system |
10212 |
to read this manual on-line. This is basically the same as typing |
to read this manual on-line. This is basically the same as typing |
10213 |
@kbd{C-h i} (the regular way to run the Info system), then, if Info |
@kbd{C-h i} (the regular way to run the Info system), then, if Info |
10214 |
is not already in the Calc manual, selecting the beginning of the |
is not already in the Calc manual, selecting the beginning of the |
10215 |
manual. The @kbd{M-# i} command is another way to read the Calc |
manual. The @kbd{C-x * i} command is another way to read the Calc |
10216 |
manual; it is different from @kbd{h i} in that it works any time, |
manual; it is different from @kbd{h i} in that it works any time, |
10217 |
not just inside Calc. The plain @kbd{i} key is also equivalent to |
not just inside Calc. The plain @kbd{i} key is also equivalent to |
10218 |
@kbd{h i}, though this key is obsolete and may be replaced with a |
@kbd{h i}, though this key is obsolete and may be replaced with a |
10219 |
different command in a future version of Calc. |
different command in a future version of Calc. |
10220 |
|
|
10221 |
@kindex h t |
@kindex h t |
10222 |
@kindex M-# t |
@kindex C-x * t |
10223 |
@pindex calc-tutorial |
@pindex calc-tutorial |
10224 |
The @kbd{h t} (@code{calc-tutorial}) command runs the Info system on |
The @kbd{h t} (@code{calc-tutorial}) command runs the Info system on |
10225 |
the Tutorial section of the Calc manual. It is like @kbd{h i}, |
the Tutorial section of the Calc manual. It is like @kbd{h i}, |
10227 |
than the beginning of the whole manual. (It actually selects the |
than the beginning of the whole manual. (It actually selects the |
10228 |
node ``Interactive Tutorial'' which tells a few things about |
node ``Interactive Tutorial'' which tells a few things about |
10229 |
using the Info system before going on to the actual tutorial.) |
using the Info system before going on to the actual tutorial.) |
10230 |
The @kbd{M-# t} key is equivalent to @kbd{h t} (but it works at |
The @kbd{C-x * t} key is equivalent to @kbd{h t} (but it works at |
10231 |
all times). |
all times). |
10232 |
|
|
10233 |
@kindex h s |
@kindex h s |
10234 |
@kindex M-# s |
@kindex C-x * s |
10235 |
@pindex calc-info-summary |
@pindex calc-info-summary |
10236 |
The @kbd{h s} (@code{calc-info-summary}) command runs the Info system |
The @kbd{h s} (@code{calc-info-summary}) command runs the Info system |
10237 |
on the Summary node of the Calc manual. @xref{Summary}. The @kbd{M-# s} |
on the Summary node of the Calc manual. @xref{Summary}. The @kbd{C-x * s} |
10238 |
key is equivalent to @kbd{h s}. |
key is equivalent to @kbd{h s}. |
10239 |
|
|
10240 |
@kindex h k |
@kindex h k |
10512 |
@section ``Quick Calculator'' Mode |
@section ``Quick Calculator'' Mode |
10513 |
|
|
10514 |
@noindent |
@noindent |
10515 |
@kindex M-# q |
@kindex C-x * q |
10516 |
@pindex quick-calc |
@pindex quick-calc |
10517 |
@cindex Quick Calculator |
@cindex Quick Calculator |
10518 |
There is another way to invoke the Calculator if all you need to do |
There is another way to invoke the Calculator if all you need to do |
10519 |
is make one or two quick calculations. Type @kbd{M-# q} (or |
is make one or two quick calculations. Type @kbd{C-x * q} (or |
10520 |
@kbd{M-x quick-calc}), then type any formula as an algebraic entry. |
@kbd{M-x quick-calc}), then type any formula as an algebraic entry. |
10521 |
The Calculator will compute the result and display it in the echo |
The Calculator will compute the result and display it in the echo |
10522 |
area, without ever actually putting up a Calc window. |
area, without ever actually putting up a Calc window. |
10525 |
refer to the previous Quick Calculator result. Older results are |
refer to the previous Quick Calculator result. Older results are |
10526 |
not retained; the Quick Calculator has no effect on the full |
not retained; the Quick Calculator has no effect on the full |
10527 |
Calculator's stack or trail. If you compute a result and then |
Calculator's stack or trail. If you compute a result and then |
10528 |
forget what it was, just run @code{M-# q} again and enter |
forget what it was, just run @code{C-x * q} again and enter |
10529 |
@samp{$} as the formula. |
@samp{$} as the formula. |
10530 |
|
|
10531 |
If this is the first time you have used the Calculator in this Emacs |
If this is the first time you have used the Calculator in this Emacs |
10532 |
session, the @kbd{M-# q} command will create the @code{*Calculator*} |
session, the @kbd{C-x * q} command will create the @code{*Calculator*} |
10533 |
buffer and perform all the usual initializations; it simply will |
buffer and perform all the usual initializations; it simply will |
10534 |
refrain from putting that buffer up in a new window. The Quick |
refrain from putting that buffer up in a new window. The Quick |
10535 |
Calculator refers to the @code{*Calculator*} buffer for all mode |
Calculator refers to the @code{*Calculator*} buffer for all mode |
10537 |
Calculator uses, simply run the full Calculator momentarily and use |
Calculator uses, simply run the full Calculator momentarily and use |
10538 |
the regular @kbd{p} command. |
the regular @kbd{p} command. |
10539 |
|
|
10540 |
If you use @code{M-# q} from inside the Calculator buffer, the |
If you use @code{C-x * q} from inside the Calculator buffer, the |
10541 |
effect is the same as pressing the apostrophe key (algebraic entry). |
effect is the same as pressing the apostrophe key (algebraic entry). |
10542 |
|
|
10543 |
The result of a Quick calculation is placed in the Emacs ``kill ring'' |
The result of a Quick calculation is placed in the Emacs ``kill ring'' |
10544 |
as well as being displayed. A subsequent @kbd{C-y} command will |
as well as being displayed. A subsequent @kbd{C-y} command will |
10545 |
yank the result into the editing buffer. You can also use this |
yank the result into the editing buffer. You can also use this |
10546 |
to yank the result into the next @kbd{M-# q} input line as a more |
to yank the result into the next @kbd{C-x * q} input line as a more |
10547 |
explicit alternative to @kbd{$} notation, or to yank the result |
explicit alternative to @kbd{$} notation, or to yank the result |
10548 |
into the Calculator stack after typing @kbd{M-# c}. |
into the Calculator stack after typing @kbd{C-x * c}. |
10549 |
|
|
10550 |
If you finish your formula by typing @key{LFD} (or @kbd{C-j}) instead |
If you finish your formula by typing @key{LFD} (or @kbd{C-j}) instead |
10551 |
of @key{RET}, the result is inserted immediately into the current |
of @key{RET}, the result is inserted immediately into the current |
10641 |
The @kbd{U} key may be pressed any number of times to undo successively |
The @kbd{U} key may be pressed any number of times to undo successively |
10642 |
farther back in time; with a numeric prefix argument it undoes a |
farther back in time; with a numeric prefix argument it undoes a |
10643 |
specified number of operations. The undo history is cleared only by the |
specified number of operations. The undo history is cleared only by the |
10644 |
@kbd{q} (@code{calc-quit}) command. (Recall that @kbd{M-# c} is |
@kbd{q} (@code{calc-quit}) command. (Recall that @kbd{C-x * c} is |
10645 |
synonymous with @code{calc-quit} while inside the Calculator; this |
synonymous with @code{calc-quit} while inside the Calculator; this |
10646 |
also clears the undo history.) |
also clears the undo history.) |
10647 |
|
|
10717 |
@pindex another-calc |
@pindex another-calc |
10718 |
It is possible to have any number of Calc mode buffers at once. |
It is possible to have any number of Calc mode buffers at once. |
10719 |
Usually this is done by executing @kbd{M-x another-calc}, which |
Usually this is done by executing @kbd{M-x another-calc}, which |
10720 |
is similar to @kbd{M-# c} except that if a @samp{*Calculator*} |
is similar to @kbd{C-x * c} except that if a @samp{*Calculator*} |
10721 |
buffer already exists, a new, independent one with a name of the |
buffer already exists, a new, independent one with a name of the |
10722 |
form @samp{*Calculator*<@var{n}>} is created. You can also use the |
form @samp{*Calculator*<@var{n}>} is created. You can also use the |
10723 |
command @code{calc-mode} to put any buffer into Calculator mode, but |
command @code{calc-mode} to put any buffer into Calculator mode, but |
10764 |
necessary; typically this means you will type a command and it won't |
necessary; typically this means you will type a command and it won't |
10765 |
work because some function you've never heard of was undefined. |
work because some function you've never heard of was undefined. |
10766 |
|
|
10767 |
@kindex M-# L |
@kindex C-x * L |
10768 |
@pindex calc-load-everything |
@pindex calc-load-everything |
10769 |
If this happens, the easiest workaround is to type @kbd{M-# L} |
If this happens, the easiest workaround is to type @kbd{C-x * L} |
10770 |
(@code{calc-load-everything}) to force all the parts of Calc to be |
(@code{calc-load-everything}) to force all the parts of Calc to be |
10771 |
loaded right away. This will cause Emacs to take up a lot more |
loaded right away. This will cause Emacs to take up a lot more |
10772 |
memory than it would otherwise, but it's guaranteed to fix the problem. |
memory than it would otherwise, but it's guaranteed to fix the problem. |
10825 |
If you suspect a Calculator cache has become corrupt, you can use the |
If you suspect a Calculator cache has become corrupt, you can use the |
10826 |
@code{calc-flush-caches} command to reset all caches to the empty state. |
@code{calc-flush-caches} command to reset all caches to the empty state. |
10827 |
(This should only be necessary in the event of bugs in the Calculator.) |
(This should only be necessary in the event of bugs in the Calculator.) |
10828 |
The @kbd{M-# 0} (with the zero key) command also resets caches along |
The @kbd{C-x * 0} (with the zero key) command also resets caches along |
10829 |
with all other aspects of the Calculator's state. |
with all other aspects of the Calculator's state. |
10830 |
|
|
10831 |
@node Debugging Calc, , Caches, Troubleshooting Commands |
@node Debugging Calc, , Caches, Troubleshooting Commands |
12035 |
|
|
12036 |
Commands that interpret (``parse'') text as algebraic formulas include |
Commands that interpret (``parse'') text as algebraic formulas include |
12037 |
algebraic entry (@kbd{'}), editing commands like @kbd{`} which parse |
algebraic entry (@kbd{'}), editing commands like @kbd{`} which parse |
12038 |
the contents of the editing buffer when you finish, the @kbd{M-# g} |
the contents of the editing buffer when you finish, the @kbd{C-x * g} |
12039 |
and @w{@kbd{M-# r}} commands, the @kbd{C-y} command, the X window system |
and @w{@kbd{C-x * r}} commands, the @kbd{C-y} command, the X window system |
12040 |
``paste'' mouse operation, and Embedded mode. All of these operations |
``paste'' mouse operation, and Embedded mode. All of these operations |
12041 |
use the same rules for parsing formulas; in particular, language modes |
use the same rules for parsing formulas; in particular, language modes |
12042 |
(@pxref{Language Modes}) affect them all in the same way. |
(@pxref{Language Modes}) affect them all in the same way. |
12432 |
The modes saved in the file include everything controlled by the @kbd{m} |
The modes saved in the file include everything controlled by the @kbd{m} |
12433 |
and @kbd{d} prefix keys, the current precision and binary word size, |
and @kbd{d} prefix keys, the current precision and binary word size, |
12434 |
whether or not the trail is displayed, the current height of the Calc |
whether or not the trail is displayed, the current height of the Calc |
12435 |
window, and more. The current interface (used when you type @kbd{M-# |
window, and more. The current interface (used when you type @kbd{C-x * *}) |
12436 |
M-#}) is also saved. If there were already saved mode settings in the |
is also saved. If there were already saved mode settings in the |
12437 |
file, they are replaced. Otherwise, the new mode information is |
file, they are replaced. Otherwise, the new mode information is |
12438 |
appended to the end of the file. |
appended to the end of the file. |
12439 |
|
|
12459 |
use in the future for commands like @kbd{m m}. The default settings |
use in the future for commands like @kbd{m m}. The default settings |
12460 |
file name is @file{~/.calc.el}. You can see the current file name by |
file name is @file{~/.calc.el}. You can see the current file name by |
12461 |
giving a blank response to the @kbd{m F} prompt. See also the |
giving a blank response to the @kbd{m F} prompt. See also the |
12462 |
discussion of the @code{calc-settings-file} variable; @pxref{Customizable Variables}. |
discussion of the @code{calc-settings-file} variable; @pxref{Customizing Calc}. |
12463 |
|
|
12464 |
If the file name you give is your user init file (typically |
If the file name you give is your user init file (typically |
12465 |
@file{~/.emacs}), @kbd{m F} will not automatically load the new file. This |
@file{~/.emacs}), @kbd{m F} will not automatically load the new file. This |
12480 |
until the various advanced Calc features are used. Since this mode only |
until the various advanced Calc features are used. Since this mode only |
12481 |
has effect when Calc is first loaded, @kbd{m x} is usually followed by |
has effect when Calc is first loaded, @kbd{m x} is usually followed by |
12482 |
@kbd{m m} to make the mode-setting permanent. To load all of Calc just |
@kbd{m m} to make the mode-setting permanent. To load all of Calc just |
12483 |
once, rather than always in the future, you can press @kbd{M-# L}. |
once, rather than always in the future, you can press @kbd{C-x * L}. |
12484 |
|
|
12485 |
@kindex m S |
@kindex m S |
12486 |
@pindex calc-shift-prefix |
@pindex calc-shift-prefix |
12850 |
to update all @samp{=>} operators while leaving recomputation off.) |
to update all @samp{=>} operators while leaving recomputation off.) |
12851 |
|
|
12852 |
To update @samp{=>} operators in an Embedded buffer while |
To update @samp{=>} operators in an Embedded buffer while |
12853 |
automatic recomputation is off, use @w{@kbd{M-# u}}. |
automatic recomputation is off, use @w{@kbd{C-x * u}}. |
12854 |
@xref{Embedded Mode}. |
@xref{Embedded Mode}. |
12855 |
|
|
12856 |
@node Working Message, , Automatic Recomputation, Calculation Modes |
@node Working Message, , Automatic Recomputation, Calculation Modes |
13497 |
@samp{\,} (@TeX{}'s thin-space symbol) as the digit separator. |
@samp{\,} (@TeX{}'s thin-space symbol) as the digit separator. |
13498 |
|
|
13499 |
Please note that grouped numbers will not generally be parsed correctly |
Please note that grouped numbers will not generally be parsed correctly |
13500 |
if re-read in textual form, say by the use of @kbd{M-# y} and @kbd{M-# g}. |
if re-read in textual form, say by the use of @kbd{C-x * y} and @kbd{C-x * g}. |
13501 |
(@xref{Kill and Yank}, for details on these commands.) One exception is |
(@xref{Kill and Yank}, for details on these commands.) One exception is |
13502 |
the @samp{\,} separator, which doesn't interfere with parsing because it |
the @samp{\,} separator, which doesn't interfere with parsing because it |
13503 |
is ignored by @TeX{} language mode. |
is ignored by @TeX{} language mode. |
13557 |
calculations are often carried to one or two more significant figures, |
calculations are often carried to one or two more significant figures, |
13558 |
but values placed on the stack will be rounded down to ten figures.) |
but values placed on the stack will be rounded down to ten figures.) |
13559 |
Numbers are never actually rounded to the display precision for storage, |
Numbers are never actually rounded to the display precision for storage, |
13560 |
except by commands like @kbd{C-k} and @kbd{M-# y} which operate on the |
except by commands like @kbd{C-k} and @kbd{C-x * y} which operate on the |
13561 |
actual displayed text in the Calculator buffer. |
actual displayed text in the Calculator buffer. |
13562 |
|
|
13563 |
@kindex d . |
@kindex d . |
14119 |
For example, suppose the formula @samp{2*a[1] + atan(a[2])} occurs in a C |
For example, suppose the formula @samp{2*a[1] + atan(a[2])} occurs in a C |
14120 |
program; elsewhere in the program you need the derivatives of this formula |
program; elsewhere in the program you need the derivatives of this formula |
14121 |
with respect to @samp{a[1]} and @samp{a[2]}. First, type @kbd{d C} |
with respect to @samp{a[1]} and @samp{a[2]}. First, type @kbd{d C} |
14122 |
to switch to C notation. Now use @code{C-u M-# g} to grab the formula |
to switch to C notation. Now use @code{C-u C-x * g} to grab the formula |
14123 |
into the Calculator, @kbd{a d a[1] @key{RET}} to differentiate with respect |
into the Calculator, @kbd{a d a[1] @key{RET}} to differentiate with respect |
14124 |
to the first variable, and @kbd{M-# y} to yank the formula for the derivative |
to the first variable, and @kbd{C-x * y} to yank the formula for the derivative |
14125 |
back into your C program. Press @kbd{U} to undo the differentiation and |
back into your C program. Press @kbd{U} to undo the differentiation and |
14126 |
repeat with @kbd{a d a[2] @key{RET}} for the other derivative. |
repeat with @kbd{a d a[2] @key{RET}} for the other derivative. |
14127 |
|
|
21264 |
The obsolete reduce-by-columns function, @code{reducec}, is still |
The obsolete reduce-by-columns function, @code{reducec}, is still |
21265 |
supported but there is no way to get it through the @kbd{V R} command. |
supported but there is no way to get it through the @kbd{V R} command. |
21266 |
|
|
21267 |
The commands @kbd{M-# :} and @kbd{M-# _} are equivalent to typing |
The commands @kbd{C-x * :} and @kbd{C-x * _} are equivalent to typing |
21268 |
@kbd{M-# r} to grab a rectangle of data into Calc, and then typing |
@kbd{C-x * r} to grab a rectangle of data into Calc, and then typing |
21269 |
@kbd{V R : +} or @kbd{V R _ +}, respectively, to sum the columns or |
@kbd{V R : +} or @kbd{V R _ +}, respectively, to sum the columns or |
21270 |
rows of the matrix. @xref{Grabbing From Buffers}. |
rows of the matrix. @xref{Grabbing From Buffers}. |
21271 |
|
|
27920 |
The @kbd{u V} (@code{calc-view-units-table}) command is like @kbd{u v} except |
The @kbd{u V} (@code{calc-view-units-table}) command is like @kbd{u v} except |
27921 |
that the cursor is not moved into the Units Table buffer. You can |
that the cursor is not moved into the Units Table buffer. You can |
27922 |
type @kbd{u V} again to remove the Units Table from the display. To |
type @kbd{u V} again to remove the Units Table from the display. To |
27923 |
return from the Units Table buffer after a @kbd{u v}, type @kbd{M-# c} |
return from the Units Table buffer after a @kbd{u v}, type @kbd{C-x * c} |
27924 |
again or use the regular Emacs @w{@kbd{C-x o}} (@code{other-window}) |
again or use the regular Emacs @w{@kbd{C-x o}} (@code{other-window}) |
27925 |
command. You can also kill the buffer with @kbd{C-x k} if you wish; |
command. You can also kill the buffer with @kbd{C-x k} if you wish; |
27926 |
the actual units table is safely stored inside the Calculator. |
the actual units table is safely stored inside the Calculator. |
29306 |
@samp{%s} to signify the name of the file to be displayed or printed. |
@samp{%s} to signify the name of the file to be displayed or printed. |
29307 |
Or, these variables may contain Lisp expressions which are evaluated |
Or, these variables may contain Lisp expressions which are evaluated |
29308 |
to display or print the output. These variables are customizable |
to display or print the output. These variables are customizable |
29309 |
(@pxref{Customizable Variables}). |
(@pxref{Customizing Calc}). |
29310 |
|
|
29311 |
@kindex g x |
@kindex g x |
29312 |
@pindex calc-graph-display |
@pindex calc-graph-display |
29465 |
@section Grabbing from Other Buffers |
@section Grabbing from Other Buffers |
29466 |
|
|
29467 |
@noindent |
@noindent |
29468 |
@kindex M-# g |
@kindex C-x * g |
29469 |
@pindex calc-grab-region |
@pindex calc-grab-region |
29470 |
The @kbd{M-# g} (@code{calc-grab-region}) command takes the text between |
The @kbd{C-x * g} (@code{calc-grab-region}) command takes the text between |
29471 |
point and mark in the current buffer and attempts to parse it as a |
point and mark in the current buffer and attempts to parse it as a |
29472 |
vector of values. Basically, it wraps the text in vector brackets |
vector of values. Basically, it wraps the text in vector brackets |
29473 |
@samp{[ ]} unless the text already is enclosed in vector brackets, |
@samp{[ ]} unless the text already is enclosed in vector brackets, |
29474 |
then reads the text as if it were an algebraic entry. The contents |
then reads the text as if it were an algebraic entry. The contents |
29475 |
of the vector may be numbers, formulas, or any other Calc objects. |
of the vector may be numbers, formulas, or any other Calc objects. |
29476 |
If the @kbd{M-# g} command works successfully, it does an automatic |
If the @kbd{C-x * g} command works successfully, it does an automatic |
29477 |
@kbd{M-# c} to enter the Calculator buffer. |
@kbd{C-x * c} to enter the Calculator buffer. |
29478 |
|
|
29479 |
A numeric prefix argument grabs the specified number of lines around |
A numeric prefix argument grabs the specified number of lines around |
29480 |
point, ignoring the mark. A positive prefix grabs from point to the |
point, ignoring the mark. A positive prefix grabs from point to the |
29481 |
@expr{n}th following newline (so that @kbd{M-1 M-# g} grabs from point |
@expr{n}th following newline (so that @kbd{M-1 C-x * g} grabs from point |
29482 |
to the end of the current line); a negative prefix grabs from point |
to the end of the current line); a negative prefix grabs from point |
29483 |
back to the @expr{n+1}st preceding newline. In these cases the text |
back to the @expr{n+1}st preceding newline. In these cases the text |
29484 |
that is grabbed is exactly the same as the text that @kbd{C-k} would |
that is grabbed is exactly the same as the text that @kbd{C-k} would |
29489 |
|
|
29490 |
A plain @kbd{C-u} prefix interprets the region between point and mark |
A plain @kbd{C-u} prefix interprets the region between point and mark |
29491 |
as a single number or formula rather than a vector. For example, |
as a single number or formula rather than a vector. For example, |
29492 |
@kbd{M-# g} on the text @samp{2 a b} produces the vector of three |
@kbd{C-x * g} on the text @samp{2 a b} produces the vector of three |
29493 |
values @samp{[2, a, b]}, but @kbd{C-u M-# g} on the same region |
values @samp{[2, a, b]}, but @kbd{C-u C-x * g} on the same region |
29494 |
reads a formula which is a product of three things: @samp{2 a b}. |
reads a formula which is a product of three things: @samp{2 a b}. |
29495 |
(The text @samp{a + b}, on the other hand, will be grabbed as a |
(The text @samp{a + b}, on the other hand, will be grabbed as a |
29496 |
vector of one element by plain @kbd{M-# g} because the interpretation |
vector of one element by plain @kbd{C-x * g} because the interpretation |
29497 |
@samp{[a, +, b]} would be a syntax error.) |
@samp{[a, +, b]} would be a syntax error.) |
29498 |
|
|
29499 |
If a different language has been specified (@pxref{Language Modes}), |
If a different language has been specified (@pxref{Language Modes}), |
29500 |
the grabbed text will be interpreted according to that language. |
the grabbed text will be interpreted according to that language. |
29501 |
|
|
29502 |
@kindex M-# r |
@kindex C-x * r |
29503 |
@pindex calc-grab-rectangle |
@pindex calc-grab-rectangle |
29504 |
The @kbd{M-# r} (@code{calc-grab-rectangle}) command takes the text between |
The @kbd{C-x * r} (@code{calc-grab-rectangle}) command takes the text between |
29505 |
point and mark and attempts to parse it as a matrix. If point and mark |
point and mark and attempts to parse it as a matrix. If point and mark |
29506 |
are both in the leftmost column, the lines in between are parsed in their |
are both in the leftmost column, the lines in between are parsed in their |
29507 |
entirety. Otherwise, point and mark define the corners of a rectangle |
entirety. Otherwise, point and mark define the corners of a rectangle |
29521 |
format used in the Calc stack buffer) are ignored. If you wish to |
format used in the Calc stack buffer) are ignored. If you wish to |
29522 |
force this interpretation (even if the line contains bracketed |
force this interpretation (even if the line contains bracketed |
29523 |
portions), give a negative numeric prefix argument to the |
portions), give a negative numeric prefix argument to the |
29524 |
@kbd{M-# r} command. |
@kbd{C-x * r} command. |
29525 |
|
|
29526 |
If you give a numeric prefix argument of zero or plain @kbd{C-u}, each |
If you give a numeric prefix argument of zero or plain @kbd{C-u}, each |
29527 |
line is instead interpreted as a single formula which is converted into |
line is instead interpreted as a single formula which is converted into |
29528 |
a one-element vector. Thus the result of @kbd{C-u M-# r} will be a |
a one-element vector. Thus the result of @kbd{C-u C-x * r} will be a |
29529 |
one-column matrix. For example, suppose one line of the data is the |
one-column matrix. For example, suppose one line of the data is the |
29530 |
expression @samp{2 a}. A plain @w{@kbd{M-# r}} will interpret this as |
expression @samp{2 a}. A plain @w{@kbd{C-x * r}} will interpret this as |
29531 |
@samp{[2 a]}, which in turn is read as a two-element vector that forms |
@samp{[2 a]}, which in turn is read as a two-element vector that forms |
29532 |
one row of the matrix. But a @kbd{C-u M-# r} will interpret this row |
one row of the matrix. But a @kbd{C-u C-x * r} will interpret this row |
29533 |
as @samp{[2*a]}. |
as @samp{[2*a]}. |
29534 |
|
|
29535 |
If you give a positive numeric prefix argument @var{n}, then each line |
If you give a positive numeric prefix argument @var{n}, then each line |
29544 |
@infoline 1x1 |
@infoline 1x1 |
29545 |
matrix, just hit @kbd{v u} (@code{calc-unpack}) twice.) |
matrix, just hit @kbd{v u} (@code{calc-unpack}) twice.) |
29546 |
|
|
29547 |
@kindex M-# : |
@kindex C-x * : |
29548 |
@kindex M-# _ |
@kindex C-x * _ |
29549 |
@pindex calc-grab-sum-across |
@pindex calc-grab-sum-across |
29550 |
@pindex calc-grab-sum-down |
@pindex calc-grab-sum-down |
29551 |
@cindex Summing rows and columns of data |
@cindex Summing rows and columns of data |
29552 |
The @kbd{M-# :} (@code{calc-grab-sum-down}) command is a handy way to |
The @kbd{C-x * :} (@code{calc-grab-sum-down}) command is a handy way to |
29553 |
grab a rectangle of data and sum its columns. It is equivalent to |
grab a rectangle of data and sum its columns. It is equivalent to |
29554 |
typing @kbd{M-# r}, followed by @kbd{V R : +} (the vector reduction |
typing @kbd{C-x * r}, followed by @kbd{V R : +} (the vector reduction |
29555 |
command that sums the columns of a matrix; @pxref{Reducing}). The |
command that sums the columns of a matrix; @pxref{Reducing}). The |
29556 |
result of the command will be a vector of numbers, one for each column |
result of the command will be a vector of numbers, one for each column |
29557 |
in the input data. The @kbd{M-# _} (@code{calc-grab-sum-across}) command |
in the input data. The @kbd{C-x * _} (@code{calc-grab-sum-across}) command |
29558 |
similarly grabs a rectangle and sums its rows by executing @w{@kbd{V R _ +}}. |
similarly grabs a rectangle and sums its rows by executing @w{@kbd{V R _ +}}. |
29559 |
|
|
29560 |
As well as being more convenient, @kbd{M-# :} and @kbd{M-# _} are also |
As well as being more convenient, @kbd{C-x * :} and @kbd{C-x * _} are also |
29561 |
much faster because they don't actually place the grabbed vector on |
much faster because they don't actually place the grabbed vector on |
29562 |
the stack. In a @kbd{M-# r V R : +} sequence, formatting the vector |
the stack. In a @kbd{C-x * r V R : +} sequence, formatting the vector |
29563 |
for display on the stack takes a large fraction of the total time |
for display on the stack takes a large fraction of the total time |
29564 |
(unless you have planned ahead and used @kbd{v .} and @kbd{t .} modes). |
(unless you have planned ahead and used @kbd{v .} and @kbd{t .} modes). |
29565 |
|
|
29566 |
For example, suppose we have a column of numbers in a file which we |
For example, suppose we have a column of numbers in a file which we |
29567 |
wish to sum. Go to one corner of the column and press @kbd{C-@@} to |
wish to sum. Go to one corner of the column and press @kbd{C-@@} to |
29568 |
set the mark; go to the other corner and type @kbd{M-# :}. Since there |
set the mark; go to the other corner and type @kbd{C-x * :}. Since there |
29569 |
is only one column, the result will be a vector of one number, the sum. |
is only one column, the result will be a vector of one number, the sum. |
29570 |
(You can type @kbd{v u} to unpack this vector into a plain number if |
(You can type @kbd{v u} to unpack this vector into a plain number if |
29571 |
you want to do further arithmetic with it.) |
you want to do further arithmetic with it.) |
29572 |
|
|
29573 |
To compute the product of the column of numbers, we would have to do |
To compute the product of the column of numbers, we would have to do |
29574 |
it ``by hand'' since there's no special grab-and-multiply command. |
it ``by hand'' since there's no special grab-and-multiply command. |
29575 |
Use @kbd{M-# r} to grab the column of numbers into the calculator in |
Use @kbd{C-x * r} to grab the column of numbers into the calculator in |
29576 |
the form of a column matrix. The statistics command @kbd{u *} is a |
the form of a column matrix. The statistics command @kbd{u *} is a |
29577 |
handy way to find the product of a vector or matrix of numbers. |
handy way to find the product of a vector or matrix of numbers. |
29578 |
@xref{Statistical Operations}. Another approach would be to use |
@xref{Statistical Operations}. Another approach would be to use |
29604 |
With a lone @kbd{C-u} as a prefix argument, @kbd{y} @emph{replaces} the |
With a lone @kbd{C-u} as a prefix argument, @kbd{y} @emph{replaces} the |
29605 |
region in the other buffer with the yanked text, then quits the |
region in the other buffer with the yanked text, then quits the |
29606 |
Calculator, leaving you in that buffer. A typical use would be to use |
Calculator, leaving you in that buffer. A typical use would be to use |
29607 |
@kbd{M-# g} to read a region of data into the Calculator, operate on the |
@kbd{C-x * g} to read a region of data into the Calculator, operate on the |
29608 |
data to produce a new matrix, then type @kbd{C-u y} to replace the |
data to produce a new matrix, then type @kbd{C-u y} to replace the |
29609 |
original data with the new data. One might wish to alter the matrix |
original data with the new data. One might wish to alter the matrix |
29610 |
display style (@pxref{Vector and Matrix Formats}) or change the current |
display style (@pxref{Vector and Matrix Formats}) or change the current |
29611 |
display language (@pxref{Language Modes}) before doing this. Also, note |
display language (@pxref{Language Modes}) before doing this. Also, note |
29612 |
that this command replaces a linear region of text (as grabbed by |
that this command replaces a linear region of text (as grabbed by |
29613 |
@kbd{M-# g}), not a rectangle (as grabbed by @kbd{M-# r}). |
@kbd{C-x * g}), not a rectangle (as grabbed by @kbd{C-x * r}). |
29614 |
|
|
29615 |
If the editing buffer is in overwrite (as opposed to insert) mode, |
If the editing buffer is in overwrite (as opposed to insert) mode, |
29616 |
and the @kbd{C-u} prefix was not used, then the yanked number will |
and the @kbd{C-u} prefix was not used, then the yanked number will |
29627 |
``overwrite mode'' has thus been generalized from overwriting characters |
``overwrite mode'' has thus been generalized from overwriting characters |
29628 |
to overwriting one complete number with another. |
to overwriting one complete number with another. |
29629 |
|
|
29630 |
@kindex M-# y |
@kindex C-x * y |
29631 |
The @kbd{M-# y} key sequence is equivalent to @kbd{y} except that |
The @kbd{C-x * y} key sequence is equivalent to @kbd{y} except that |
29632 |
it can be typed anywhere, not just in Calc. This provides an easy |
it can be typed anywhere, not just in Calc. This provides an easy |
29633 |
way to guarantee that Calc knows which editing buffer you want to use! |
way to guarantee that Calc knows which editing buffer you want to use! |
29634 |
|
|
29665 |
@chapter Keypad Mode |
@chapter Keypad Mode |
29666 |
|
|
29667 |
@noindent |
@noindent |
29668 |
@kindex M-# k |
@kindex C-x * k |
29669 |
@pindex calc-keypad |
@pindex calc-keypad |
29670 |
The @kbd{M-# k} (@code{calc-keypad}) command starts the Calculator |
The @kbd{C-x * k} (@code{calc-keypad}) command starts the Calculator |
29671 |
and displays a picture of a calculator-style keypad. If you are using |
and displays a picture of a calculator-style keypad. If you are using |
29672 |
the X window system, you can click on any of the ``keys'' in the |
the X window system, you can click on any of the ``keys'' in the |
29673 |
keypad using the left mouse button to operate the calculator. |
keypad using the left mouse button to operate the calculator. |
29676 |
calculations with the mouse. |
calculations with the mouse. |
29677 |
|
|
29678 |
@pindex full-calc-keypad |
@pindex full-calc-keypad |
29679 |
If you have used @kbd{M-# b} first, @kbd{M-# k} instead invokes |
If you have used @kbd{C-x * b} first, @kbd{C-x * k} instead invokes |
29680 |
the @code{full-calc-keypad} command, which takes over the whole |
the @code{full-calc-keypad} command, which takes over the whole |
29681 |
Emacs screen and displays the keypad, the Calc stack, and the Calc |
Emacs screen and displays the keypad, the Calc stack, and the Calc |
29682 |
trail all at once. This mode would normally be used when running |
trail all at once. This mode would normally be used when running |
29837 |
by the two limits of the interval. |
by the two limits of the interval. |
29838 |
@end table |
@end table |
29839 |
|
|
29840 |
The @kbd{OFF} key turns Calc off; typing @kbd{M-# k} or @kbd{M-# M-#} |
The @kbd{OFF} key turns Calc off; typing @kbd{C-x * k} or @kbd{C-x * *} |
29841 |
again has the same effect. This is analogous to typing @kbd{q} or |
again has the same effect. This is analogous to typing @kbd{q} or |
29842 |
hitting @kbd{M-# c} again in the normal calculator. If Calc is |
hitting @kbd{C-x * c} again in the normal calculator. If Calc is |
29843 |
running standalone (the @code{full-calc-keypad} command appeared in the |
running standalone (the @code{full-calc-keypad} command appeared in the |
29844 |
command line that started Emacs), then @kbd{OFF} is replaced with |
command line that started Emacs), then @kbd{OFF} is replaced with |
29845 |
@kbd{EXIT}; clicking on this actually exits Emacs itself. |
@kbd{EXIT}; clicking on this actually exits Emacs itself. |
30079 |
@section Basic Embedded Mode |
@section Basic Embedded Mode |
30080 |
|
|
30081 |
@noindent |
@noindent |
30082 |
@kindex M-# e |
@kindex C-x * e |
30083 |
@pindex calc-embedded |
@pindex calc-embedded |
30084 |
To enter Embedded mode, position the Emacs point (cursor) on a |
To enter Embedded mode, position the Emacs point (cursor) on a |
30085 |
formula in any buffer and press @kbd{M-# e} (@code{calc-embedded}). |
formula in any buffer and press @kbd{C-x * e} (@code{calc-embedded}). |
30086 |
Note that @kbd{M-# e} is not to be used in the Calc stack buffer |
Note that @kbd{C-x * e} is not to be used in the Calc stack buffer |
30087 |
like most Calc commands, but rather in regular editing buffers that |
like most Calc commands, but rather in regular editing buffers that |
30088 |
are visiting your own files. |
are visiting your own files. |
30089 |
|
|
30094 |
@code{plain-tex-mode} and @code{context-mode}, C language for |
@code{plain-tex-mode} and @code{context-mode}, C language for |
30095 |
@code{c-mode} and @code{c++-mode}, FORTRAN language for |
@code{c-mode} and @code{c++-mode}, FORTRAN language for |
30096 |
@code{fortran-mode} and @code{f90-mode}, Pascal for @code{pascal-mode}, |
@code{fortran-mode} and @code{f90-mode}, Pascal for @code{pascal-mode}, |
30097 |
and eqn for @code{nroff-mode} (@pxref{Customizable Variables}). |
and eqn for @code{nroff-mode} (@pxref{Customizing Calc}). |
30098 |
These can be overridden with Calc's mode |
These can be overridden with Calc's mode |
30099 |
changing commands (@pxref{Mode Settings in Embedded Mode}). If no |
changing commands (@pxref{Mode Settings in Embedded Mode}). If no |
30100 |
suitable language is available, Calc will continue with its current language. |
suitable language is available, Calc will continue with its current language. |
30131 |
by point and mark) instead of formula delimiters. With a prefix |
by point and mark) instead of formula delimiters. With a prefix |
30132 |
argument of @kbd{C-u} only, Calc uses the current line as the formula. |
argument of @kbd{C-u} only, Calc uses the current line as the formula. |
30133 |
|
|
30134 |
@kindex M-# w |
@kindex C-x * w |
30135 |
@pindex calc-embedded-word |
@pindex calc-embedded-word |
30136 |
The @kbd{M-# w} (@code{calc-embedded-word}) command will start Embedded |
The @kbd{C-x * w} (@code{calc-embedded-word}) command will start Embedded |
30137 |
mode on the current ``word''; in this case Calc will scan for the first |
mode on the current ``word''; in this case Calc will scan for the first |
30138 |
non-numeric character (i.e., the first character that is not a digit, |
non-numeric character (i.e., the first character that is not a digit, |
30139 |
sign, decimal point, or upper- or lower-case @samp{e}) forward and |
sign, decimal point, or upper- or lower-case @samp{e}) forward and |
30151 |
the built-in @code{arctan} function, and the @samp{a[1]} will be |
the built-in @code{arctan} function, and the @samp{a[1]} will be |
30152 |
interpreted as @samp{a} times the vector @samp{[1]}! |
interpreted as @samp{a} times the vector @samp{[1]}! |
30153 |
|
|
30154 |
If you press @kbd{M-# e} or @kbd{M-# w} to activate an embedded |
If you press @kbd{C-x * e} or @kbd{C-x * w} to activate an embedded |
30155 |
formula which is blank, say with the cursor on the space between |
formula which is blank, say with the cursor on the space between |
30156 |
the two delimiters @samp{$ $}, Calc will immediately prompt for |
the two delimiters @samp{$ $}, Calc will immediately prompt for |
30157 |
an algebraic entry. |
an algebraic entry. |
30165 |
When Embedded mode begins, Calc pushes the current formula onto |
When Embedded mode begins, Calc pushes the current formula onto |
30166 |
the stack. No Calc stack window is created; however, Calc copies |
the stack. No Calc stack window is created; however, Calc copies |
30167 |
the top-of-stack position into the original buffer at all times. |
the top-of-stack position into the original buffer at all times. |
30168 |
You can create a Calc window by hand with @kbd{M-# o} if you |
You can create a Calc window by hand with @kbd{C-x * o} if you |
30169 |
find you need to see the entire stack. |
find you need to see the entire stack. |
30170 |
|
|
30171 |
For example, typing @kbd{M-# e} while somewhere in the formula |
For example, typing @kbd{C-x * e} while somewhere in the formula |
30172 |
@samp{n>2} in the following line enables Embedded mode on that |
@samp{n>2} in the following line enables Embedded mode on that |
30173 |
inequality: |
inequality: |
30174 |
|
|
30202 |
We define $F_n = F_(n-1)+F_(n-2)$ for all $2 < n$. |
We define $F_n = F_(n-1)+F_(n-2)$ for all $2 < n$. |
30203 |
@end example |
@end example |
30204 |
|
|
30205 |
The @kbd{M-# o} command is a useful way to open a Calc window |
The @kbd{C-x * o} command is a useful way to open a Calc window |
30206 |
without actually selecting that window. Giving this command |
without actually selecting that window. Giving this command |
30207 |
verifies that @samp{2 < n} is also on the Calc stack. Typing |
verifies that @samp{2 < n} is also on the Calc stack. Typing |
30208 |
@kbd{17 @key{RET}} would produce: |
@kbd{17 @key{RET}} would produce: |
30218 |
normally see the stack in Embedded mode, it is still there and |
normally see the stack in Embedded mode, it is still there and |
30219 |
it still operates in the same way. But, as with old-fashioned |
it still operates in the same way. But, as with old-fashioned |
30220 |
RPN calculators, you can only see the value at the top of the |
RPN calculators, you can only see the value at the top of the |
30221 |
stack at any given time (unless you use @kbd{M-# o}). |
stack at any given time (unless you use @kbd{C-x * o}). |
30222 |
|
|
30223 |
Typing @kbd{M-# e} again turns Embedded mode off. The Calc |
Typing @kbd{C-x * e} again turns Embedded mode off. The Calc |
30224 |
window reveals that the formula @w{@samp{2 < n}} is automatically |
window reveals that the formula @w{@samp{2 < n}} is automatically |
30225 |
removed from the stack, but the @samp{17} is not. Entering |
removed from the stack, but the @samp{17} is not. Entering |
30226 |
Embedded mode always pushes one thing onto the stack, and |
Embedded mode always pushes one thing onto the stack, and |
30228 |
that happens on the stack is entirely your business as far as |
that happens on the stack is entirely your business as far as |
30229 |
Embedded mode is concerned. |
Embedded mode is concerned. |
30230 |
|
|
30231 |
If you press @kbd{M-# e} in the wrong place by accident, it is |
If you press @kbd{C-x * e} in the wrong place by accident, it is |
30232 |
possible that Calc will be able to parse the nearby text as a |
possible that Calc will be able to parse the nearby text as a |
30233 |
formula and will mangle that text in an attempt to redisplay it |
formula and will mangle that text in an attempt to redisplay it |
30234 |
``properly'' in the current language mode. If this happens, |
``properly'' in the current language mode. If this happens, |
30235 |
press @kbd{M-# e} again to exit Embedded mode, then give the |
press @kbd{C-x * e} again to exit Embedded mode, then give the |
30236 |
regular Emacs ``undo'' command (@kbd{C-_} or @kbd{C-x u}) to put |
regular Emacs ``undo'' command (@kbd{C-_} or @kbd{C-x u}) to put |
30237 |
the text back the way it was before Calc edited it. Note that Calc's |
the text back the way it was before Calc edited it. Note that Calc's |
30238 |
own Undo command (typed before you turn Embedded mode back off) |
own Undo command (typed before you turn Embedded mode back off) |
30343 |
@r{(the value)} |
@r{(the value)} |
30344 |
@end smallexample |
@end smallexample |
30345 |
|
|
30346 |
@kindex M-# d |
@kindex C-x * d |
30347 |
@pindex calc-embedded-duplicate |
@pindex calc-embedded-duplicate |
30348 |
The @kbd{M-# d} (@code{calc-embedded-duplicate}) command is a |
The @kbd{C-x * d} (@code{calc-embedded-duplicate}) command is a |
30349 |
handy way to make sequences like this. If you type @kbd{M-# d}, |
handy way to make sequences like this. If you type @kbd{C-x * d}, |
30350 |
the formula under the cursor (which may or may not have Embedded |
the formula under the cursor (which may or may not have Embedded |
30351 |
mode enabled for it at the time) is copied immediately below and |
mode enabled for it at the time) is copied immediately below and |
30352 |
Embedded mode is then enabled for that copy. |
Embedded mode is then enabled for that copy. |
30360 |
@end smallexample |
@end smallexample |
30361 |
|
|
30362 |
@noindent |
@noindent |
30363 |
and press @kbd{M-# d} with the cursor on this formula. The result |
and press @kbd{C-x * d} with the cursor on this formula. The result |
30364 |
is |
is |
30365 |
|
|
30366 |
@smallexample |
@smallexample |
30375 |
@noindent |
@noindent |
30376 |
with the second copy of the formula enabled in Embedded mode. |
with the second copy of the formula enabled in Embedded mode. |
30377 |
You can now press @kbd{a d x @key{RET}} to take the derivative, and |
You can now press @kbd{a d x @key{RET}} to take the derivative, and |
30378 |
@kbd{M-# d M-# d} to make two more copies of the derivative. |
@kbd{C-x * d C-x * d} to make two more copies of the derivative. |
30379 |
To complete the computations, type @kbd{3 s l x @key{RET}} to evaluate |
To complete the computations, type @kbd{3 s l x @key{RET}} to evaluate |
30380 |
the last formula, then move up to the second-to-last formula |
the last formula, then move up to the second-to-last formula |
30381 |
and type @kbd{2 s l x @key{RET}}. |
and type @kbd{2 s l x @key{RET}}. |
30382 |
|
|
30383 |
Finally, you would want to press @kbd{M-# e} to exit Embedded |
Finally, you would want to press @kbd{C-x * e} to exit Embedded |
30384 |
mode, then go up and insert the necessary text in between the |
mode, then go up and insert the necessary text in between the |
30385 |
various formulas and numbers. |
various formulas and numbers. |
30386 |
|
|
30388 |
\bigskip |
\bigskip |
30389 |
@end tex |
@end tex |
30390 |
|
|
30391 |
@kindex M-# f |
@kindex C-x * f |
30392 |
@kindex M-# ' |
@kindex C-x * ' |
30393 |
@pindex calc-embedded-new-formula |
@pindex calc-embedded-new-formula |
30394 |
The @kbd{M-# f} (@code{calc-embedded-new-formula}) command |
The @kbd{C-x * f} (@code{calc-embedded-new-formula}) command |
30395 |
creates a new embedded formula at the current point. It inserts |
creates a new embedded formula at the current point. It inserts |
30396 |
some default delimiters, which are usually just blank lines, |
some default delimiters, which are usually just blank lines, |
30397 |
and then does an algebraic entry to get the formula (which is |
and then does an algebraic entry to get the formula (which is |
30398 |
then enabled for Embedded mode). This is just shorthand for |
then enabled for Embedded mode). This is just shorthand for |
30399 |
typing the delimiters yourself, positioning the cursor between |
typing the delimiters yourself, positioning the cursor between |
30400 |
the new delimiters, and pressing @kbd{M-# e}. The key sequence |
the new delimiters, and pressing @kbd{C-x * e}. The key sequence |
30401 |
@kbd{M-# '} is equivalent to @kbd{M-# f}. |
@kbd{C-x * '} is equivalent to @kbd{C-x * f}. |
30402 |
|
|
30403 |
@kindex M-# n |
@kindex C-x * n |
30404 |
@kindex M-# p |
@kindex C-x * p |
30405 |
@pindex calc-embedded-next |
@pindex calc-embedded-next |
30406 |
@pindex calc-embedded-previous |
@pindex calc-embedded-previous |
30407 |
The @kbd{M-# n} (@code{calc-embedded-next}) and @kbd{M-# p} |
The @kbd{C-x * n} (@code{calc-embedded-next}) and @kbd{C-x * p} |
30408 |
(@code{calc-embedded-previous}) commands move the cursor to the |
(@code{calc-embedded-previous}) commands move the cursor to the |
30409 |
next or previous active embedded formula in the buffer. They |
next or previous active embedded formula in the buffer. They |
30410 |
can take positive or negative prefix arguments to move by several |
can take positive or negative prefix arguments to move by several |
30411 |
formulas. Note that these commands do not actually examine the |
formulas. Note that these commands do not actually examine the |
30412 |
text of the buffer looking for formulas; they only see formulas |
text of the buffer looking for formulas; they only see formulas |
30413 |
which have previously been activated in Embedded mode. In fact, |
which have previously been activated in Embedded mode. In fact, |
30414 |
@kbd{M-# n} and @kbd{M-# p} are a useful way to tell which |
@kbd{C-x * n} and @kbd{C-x * p} are a useful way to tell which |
30415 |
embedded formulas are currently active. Also, note that these |
embedded formulas are currently active. Also, note that these |
30416 |
commands do not enable Embedded mode on the next or previous |
commands do not enable Embedded mode on the next or previous |
30417 |
formula, they just move the cursor. (By the way, @kbd{M-# n} is |
formula, they just move the cursor. |
|
not as awkward to type as it may seem, because @kbd{M-#} ignores |
|
|
Shift and Meta on the second keystroke: @kbd{M-# M-N} can be typed |
|
|
by holding down Shift and Meta and alternately typing two keys.) |
|
30418 |
|
|
30419 |
@kindex M-# ` |
@kindex C-x * ` |
30420 |
@pindex calc-embedded-edit |
@pindex calc-embedded-edit |
30421 |
The @kbd{M-# `} (@code{calc-embedded-edit}) command edits the |
The @kbd{C-x * `} (@code{calc-embedded-edit}) command edits the |
30422 |
embedded formula at the current point as if by @kbd{`} (@code{calc-edit}). |
embedded formula at the current point as if by @kbd{`} (@code{calc-edit}). |
30423 |
Embedded mode does not have to be enabled for this to work. Press |
Embedded mode does not have to be enabled for this to work. Press |
30424 |
@kbd{C-c C-c} to finish the edit, or @kbd{C-x k} to cancel. |
@kbd{C-c C-c} to finish the edit, or @kbd{C-x k} to cancel. |
30483 |
Then, @kbd{17 @key{TAB} @key{DEL}} will swap the 17 into place (@pxref{Selecting |
Then, @kbd{17 @key{TAB} @key{DEL}} will swap the 17 into place (@pxref{Selecting |
30484 |
Subformulas}, to see how this works). |
Subformulas}, to see how this works). |
30485 |
|
|
30486 |
@kindex M-# j |
@kindex C-x * j |
30487 |
@pindex calc-embedded-select |
@pindex calc-embedded-select |
30488 |
The @kbd{M-# j} (@code{calc-embedded-select}) command provides an |
The @kbd{C-x * j} (@code{calc-embedded-select}) command provides an |
30489 |
easy way to operate on assignments. It is just like @kbd{M-# e}, |
easy way to operate on assignments. It is just like @kbd{C-x * e}, |
30490 |
except that if the enabled formula is an assignment, it uses |
except that if the enabled formula is an assignment, it uses |
30491 |
@kbd{j 2} to select the righthand side. If the enabled formula |
@kbd{j 2} to select the righthand side. If the enabled formula |
30492 |
is an evaluates-to, it uses @kbd{j 1} to select the lefthand side. |
is an evaluates-to, it uses @kbd{j 1} to select the lefthand side. |
30497 |
@end example |
@end example |
30498 |
|
|
30499 |
@noindent |
@noindent |
30500 |
in which case @kbd{M-# j} will select the middle part (@samp{foo + 3}). |
in which case @kbd{C-x * j} will select the middle part (@samp{foo + 3}). |
30501 |
|
|
30502 |
The formula is automatically deselected when you leave Embedded |
The formula is automatically deselected when you leave Embedded |
30503 |
mode. |
mode. |
30504 |
|
|
30505 |
@kindex M-# u |
@kindex C-x * u |
|
@kindex M-# = |
|
30506 |
@pindex calc-embedded-update-formula |
@pindex calc-embedded-update-formula |
30507 |
Another way to change the assignment to @code{foo} would simply be |
Another way to change the assignment to @code{foo} would simply be |
30508 |
to edit the number using regular Emacs editing rather than Embedded |
to edit the number using regular Emacs editing rather than Embedded |
30509 |
mode. Then, we have to find a way to get Embedded mode to notice |
mode. Then, we have to find a way to get Embedded mode to notice |
30510 |
the change. The @kbd{M-# u} or @kbd{M-# =} |
the change. The @kbd{C-x * u} (@code{calc-embedded-update-formula}) |
30511 |
(@code{calc-embedded-update-formula}) command is a convenient way |
command is a convenient way to do this. |
|
to do this. |
|
30512 |
|
|
30513 |
@example |
@example |
30514 |
foo := 6 |
foo := 6 |
30516 |
foo + 7 => 13 |
foo + 7 => 13 |
30517 |
@end example |
@end example |
30518 |
|
|
30519 |
Pressing @kbd{M-# u} is much like pressing @kbd{M-# e = M-# e}, that |
Pressing @kbd{C-x * u} is much like pressing @kbd{C-x * e = C-x * e}, that |
30520 |
is, temporarily enabling Embedded mode for the formula under the |
is, temporarily enabling Embedded mode for the formula under the |
30521 |
cursor and then evaluating it with @kbd{=}. But @kbd{M-# u} does |
cursor and then evaluating it with @kbd{=}. But @kbd{C-x * u} does |
30522 |
not actually use @kbd{M-# e}, and in fact another formula somewhere |
not actually use @kbd{C-x * e}, and in fact another formula somewhere |
30523 |
else can be enabled in Embedded mode while you use @kbd{M-# u} and |
else can be enabled in Embedded mode while you use @kbd{C-x * u} and |
30524 |
that formula will not be disturbed. |
that formula will not be disturbed. |
30525 |
|
|
30526 |
With a numeric prefix argument, @kbd{M-# u} updates all active |
With a numeric prefix argument, @kbd{C-x * u} updates all active |
30527 |
@samp{=>} formulas in the buffer. Formulas which have not yet |
@samp{=>} formulas in the buffer. Formulas which have not yet |
30528 |
been activated in Embedded mode, and formulas which do not have |
been activated in Embedded mode, and formulas which do not have |
30529 |
@samp{=>} as their top-level operator, are not affected by this. |
@samp{=>} as their top-level operator, are not affected by this. |
30530 |
(This is useful only if you have used @kbd{m C}; see below.) |
(This is useful only if you have used @kbd{m C}; see below.) |
30531 |
|
|
30532 |
With a plain @kbd{C-u} prefix, @kbd{C-u M-# u} updates only in the |
With a plain @kbd{C-u} prefix, @kbd{C-u C-x * u} updates only in the |
30533 |
region between mark and point rather than in the whole buffer. |
region between mark and point rather than in the whole buffer. |
30534 |
|
|
30535 |
@kbd{M-# u} is also a handy way to activate a formula, such as an |
@kbd{C-x * u} is also a handy way to activate a formula, such as an |
30536 |
@samp{=>} formula that has freshly been typed in or loaded from a |
@samp{=>} formula that has freshly been typed in or loaded from a |
30537 |
file. |
file. |
30538 |
|
|
30539 |
@kindex M-# a |
@kindex C-x * a |
30540 |
@pindex calc-embedded-activate |
@pindex calc-embedded-activate |
30541 |
The @kbd{M-# a} (@code{calc-embedded-activate}) command scans |
The @kbd{C-x * a} (@code{calc-embedded-activate}) command scans |
30542 |
through the current buffer and activates all embedded formulas |
through the current buffer and activates all embedded formulas |
30543 |
that contain @samp{:=} or @samp{=>} symbols. This does not mean |
that contain @samp{:=} or @samp{=>} symbols. This does not mean |
30544 |
that Embedded mode is actually turned on, but only that the |
that Embedded mode is actually turned on, but only that the |
30546 |
the @samp{=>} values can be properly updated as assignments are |
the @samp{=>} values can be properly updated as assignments are |
30547 |
changed. |
changed. |
30548 |
|
|
30549 |
It is a good idea to type @kbd{M-# a} right after loading a file |
It is a good idea to type @kbd{C-x * a} right after loading a file |
30550 |
that uses embedded @samp{=>} operators. Emacs includes a nifty |
that uses embedded @samp{=>} operators. Emacs includes a nifty |
30551 |
``buffer-local variables'' feature that you can use to do this |
``buffer-local variables'' feature that you can use to do this |
30552 |
automatically. The idea is to place near the end of your file |
automatically. The idea is to place near the end of your file |
30569 |
When Emacs loads a file into memory, it checks for a Local Variables |
When Emacs loads a file into memory, it checks for a Local Variables |
30570 |
section like this one at the end of the file. If it finds this |
section like this one at the end of the file. If it finds this |
30571 |
section, it does the specified things (in this case, running |
section, it does the specified things (in this case, running |
30572 |
@kbd{M-# a} automatically) before editing of the file begins. |
@kbd{C-x * a} automatically) before editing of the file begins. |
30573 |
The Local Variables section must be within 3000 characters of the |
The Local Variables section must be within 3000 characters of the |
30574 |
end of the file for Emacs to find it, and it must be in the last |
end of the file for Emacs to find it, and it must be in the last |
30575 |
page of the file if the file has any page separators. |
page of the file if the file has any page separators. |
30576 |
@xref{File Variables, , Local Variables in Files, emacs, the |
@xref{File Variables, , Local Variables in Files, emacs, the |
30577 |
Emacs manual}. |
Emacs manual}. |
30578 |
|
|
30579 |
Note that @kbd{M-# a} does not update the formulas it finds. |
Note that @kbd{C-x * a} does not update the formulas it finds. |
30580 |
To do this, type, say, @kbd{M-1 M-# u} after @w{@kbd{M-# a}}. |
To do this, type, say, @kbd{M-1 C-x * u} after @w{@kbd{C-x * a}}. |
30581 |
Generally this should not be a problem, though, because the |
Generally this should not be a problem, though, because the |
30582 |
formulas will have been up-to-date already when the file was |
formulas will have been up-to-date already when the file was |
30583 |
saved. |
saved. |
30584 |
|
|
30585 |
Normally, @kbd{M-# a} activates all the formulas it finds, but |
Normally, @kbd{C-x * a} activates all the formulas it finds, but |
30586 |
any previous active formulas remain active as well. With a |
any previous active formulas remain active as well. With a |
30587 |
positive numeric prefix argument, @kbd{M-# a} first deactivates |
positive numeric prefix argument, @kbd{C-x * a} first deactivates |
30588 |
all current active formulas, then actives the ones it finds in |
all current active formulas, then actives the ones it finds in |
30589 |
its scan of the buffer. With a negative prefix argument, |
its scan of the buffer. With a negative prefix argument, |
30590 |
@kbd{M-# a} simply deactivates all formulas. |
@kbd{C-x * a} simply deactivates all formulas. |
30591 |
|
|
30592 |
Embedded mode has two symbols, @samp{Active} and @samp{~Active}, |
Embedded mode has two symbols, @samp{Active} and @samp{~Active}, |
30593 |
which it puts next to the major mode name in a buffer's mode line. |
which it puts next to the major mode name in a buffer's mode line. |
30594 |
It puts @samp{Active} if it has reason to believe that all |
It puts @samp{Active} if it has reason to believe that all |
30595 |
formulas in the buffer are active, because you have typed @kbd{M-# a} |
formulas in the buffer are active, because you have typed @kbd{C-x * a} |
30596 |
and Calc has not since had to deactivate any formulas (which can |
and Calc has not since had to deactivate any formulas (which can |
30597 |
happen if Calc goes to update an @samp{=>} formula somewhere because |
happen if Calc goes to update an @samp{=>} formula somewhere because |
30598 |
a variable changed, and finds that the formula is no longer there |
a variable changed, and finds that the formula is no longer there |
30599 |
due to some kind of editing outside of Embedded mode). Calc puts |
due to some kind of editing outside of Embedded mode). Calc puts |
30600 |
@samp{~Active} in the mode line if some, but probably not all, |
@samp{~Active} in the mode line if some, but probably not all, |
30601 |
formulas in the buffer are active. This happens if you activate |
formulas in the buffer are active. This happens if you activate |
30602 |
a few formulas one at a time but never use @kbd{M-# a}, or if you |
a few formulas one at a time but never use @kbd{C-x * a}, or if you |
30603 |
used @kbd{M-# a} but then Calc had to deactivate a formula |
used @kbd{C-x * a} but then Calc had to deactivate a formula |
30604 |
because it lost track of it. If neither of these symbols appears |
because it lost track of it. If neither of these symbols appears |
30605 |
in the mode line, no embedded formulas are active in the buffer |
in the mode line, no embedded formulas are active in the buffer |
30606 |
(e.g., before Embedded mode has been used, or after a @kbd{M-- M-# a}). |
(e.g., before Embedded mode has been used, or after a @kbd{M-- C-x * a}). |
30607 |
|
|
30608 |
Embedded formulas can refer to assignments both before and after them |
Embedded formulas can refer to assignments both before and after them |
30609 |
in the buffer. If there are several assignments to a variable, the |
in the buffer. If there are several assignments to a variable, the |
30639 |
|
|
30640 |
The @kbd{m C} (@code{calc-auto-recompute}) command turns automatic |
The @kbd{m C} (@code{calc-auto-recompute}) command turns automatic |
30641 |
recomputation of @samp{=>} forms on and off. If you turn automatic |
recomputation of @samp{=>} forms on and off. If you turn automatic |
30642 |
recomputation off, you will have to use @kbd{M-# u} to update these |
recomputation off, you will have to use @kbd{C-x * u} to update these |
30643 |
formulas manually after an assignment has been changed. If you |
formulas manually after an assignment has been changed. If you |
30644 |
plan to change several assignments at once, it may be more efficient |
plan to change several assignments at once, it may be more efficient |
30645 |
to type @kbd{m C}, change all the assignments, then use @kbd{M-1 M-# u} |
to type @kbd{m C}, change all the assignments, then use @kbd{M-1 C-x * u} |
30646 |
to update the entire buffer afterwards. The @kbd{m C} command also |
to update the entire buffer afterwards. The @kbd{m C} command also |
30647 |
controls @samp{=>} formulas on the stack; @pxref{Evaluates-To |
controls @samp{=>} formulas on the stack; @pxref{Evaluates-To |
30648 |
Operator}. When you turn automatic recomputation back on, the |
Operator}. When you turn automatic recomputation back on, the |
30649 |
stack will be updated but the Embedded buffer will not; you must |
stack will be updated but the Embedded buffer will not; you must |
30650 |
use @kbd{M-# u} to update the buffer by hand. |
use @kbd{C-x * u} to update the buffer by hand. |
30651 |
|
|
30652 |
@node Mode Settings in Embedded Mode, Customizing Embedded Mode, Assignments in Embedded Mode, Embedded Mode |
@node Mode Settings in Embedded Mode, Customizing Embedded Mode, Assignments in Embedded Mode, Embedded Mode |
30653 |
@section Mode Settings in Embedded Mode |
@section Mode Settings in Embedded Mode |
30758 |
the file, as long as those mode settings are suitable for all |
the file, as long as those mode settings are suitable for all |
30759 |
formulas in the file. |
formulas in the file. |
30760 |
|
|
30761 |
Enabling a formula with @kbd{M-# e} causes a fresh scan for local |
Enabling a formula with @kbd{C-x * e} causes a fresh scan for local |
30762 |
mode annotations; you will have to use this after adding annotations |
mode annotations; you will have to use this after adding annotations |
30763 |
above a formula by hand to get the formula to notice them. Updating |
above a formula by hand to get the formula to notice them. Updating |
30764 |
a formula with @kbd{M-# u} will also re-scan the local modes, but |
a formula with @kbd{C-x * u} will also re-scan the local modes, but |
30765 |
global modes are only re-scanned by @kbd{M-# a}. |
global modes are only re-scanned by @kbd{C-x * a}. |
30766 |
|
|
30767 |
Another way that modes can get out of date is if you add a local |
Another way that modes can get out of date is if you add a local |
30768 |
mode annotation to a formula that has another formula after it. |
mode annotation to a formula that has another formula after it. |
30778 |
456. |
456. |
30779 |
@end example |
@end example |
30780 |
|
|
30781 |
We would have to go down to the other formula and press @kbd{M-# u} |
We would have to go down to the other formula and press @kbd{C-x * u} |
30782 |
on it in order to get it to notice the new annotation. |
on it in order to get it to notice the new annotation. |
30783 |
|
|
30784 |
Two more mode-recording modes selectable by @kbd{m R} are available |
Two more mode-recording modes selectable by @kbd{m R} are available |
30800 |
@noindent |
@noindent |
30801 |
You can modify Embedded mode's behavior by setting various Lisp |
You can modify Embedded mode's behavior by setting various Lisp |
30802 |
variables described here. These variables are customizable |
variables described here. These variables are customizable |
30803 |
(@pxref{Customizable Variables}), or you can use @kbd{M-x set-variable} |
(@pxref{Customizing Calc}), or you can use @kbd{M-x set-variable} |
30804 |
or @kbd{M-x edit-options} to adjust a variable on the fly. |
or @kbd{M-x edit-options} to adjust a variable on the fly. |
30805 |
(Another possibility would be to use a file-local variable annotation at |
(Another possibility would be to use a file-local variable annotation at |
30806 |
the end of the file; |
the end of the file; |
30807 |
@pxref{File Variables, , Local Variables in Files, emacs, the Emacs manual}.) |
@pxref{File Variables, , Local Variables in Files, emacs, the Emacs manual}.) |
30808 |
Many of the variables given mentioned here can be set to depend on the |
Many of the variables given mentioned here can be set to depend on the |
30809 |
major mode of the editing buffer (@pxref{Customizable Variables}). |
major mode of the editing buffer (@pxref{Customizing Calc}). |
30810 |
|
|
30811 |
@vindex calc-embedded-open-formula |
@vindex calc-embedded-open-formula |
30812 |
The @code{calc-embedded-open-formula} variable holds a regular |
The @code{calc-embedded-open-formula} variable holds a regular |
30880 |
@vindex calc-embedded-open-word |
@vindex calc-embedded-open-word |
30881 |
@vindex calc-embedded-close-word |
@vindex calc-embedded-close-word |
30882 |
The @code{calc-embedded-open-word} and @code{calc-embedded-close-word} |
The @code{calc-embedded-open-word} and @code{calc-embedded-close-word} |
30883 |
variables are similar expressions used when you type @kbd{M-# w} |
variables are similar expressions used when you type @kbd{C-x * w} |
30884 |
instead of @kbd{M-# e} to enable Embedded mode. |
instead of @kbd{C-x * e} to enable Embedded mode. |
30885 |
|
|
30886 |
@vindex calc-embedded-open-plain |
@vindex calc-embedded-open-plain |
30887 |
The @code{calc-embedded-open-plain} variable is a string which |
The @code{calc-embedded-open-plain} variable is a string which |
30902 |
@vindex calc-embedded-open-new-formula |
@vindex calc-embedded-open-new-formula |
30903 |
The @code{calc-embedded-open-new-formula} variable is a string |
The @code{calc-embedded-open-new-formula} variable is a string |
30904 |
which is inserted at the front of a new formula when you type |
which is inserted at the front of a new formula when you type |
30905 |
@kbd{M-# f}. Its default value is @code{"\n\n"}. If this |
@kbd{C-x * f}. Its default value is @code{"\n\n"}. If this |
30906 |
string begins with a newline character and the @kbd{M-# f} is |
string begins with a newline character and the @kbd{C-x * f} is |
30907 |
typed at the beginning of a line, @kbd{M-# f} will skip this |
typed at the beginning of a line, @kbd{C-x * f} will skip this |
30908 |
first newline to avoid introducing unnecessary blank lines in |
first newline to avoid introducing unnecessary blank lines in |
30909 |
the file. |
the file. |
30910 |
|
|
30912 |
The @code{calc-embedded-close-new-formula} variable is the corresponding |
The @code{calc-embedded-close-new-formula} variable is the corresponding |
30913 |
string which is inserted at the end of a new formula. Its default |
string which is inserted at the end of a new formula. Its default |
30914 |
value is also @code{"\n\n"}. The final newline is omitted by |
value is also @code{"\n\n"}. The final newline is omitted by |
30915 |
@w{@kbd{M-# f}} if typed at the end of a line. (It follows that if |
@w{@kbd{C-x * f}} if typed at the end of a line. (It follows that if |
30916 |
@kbd{M-# f} is typed on a blank line, both a leading opening |
@kbd{C-x * f} is typed on a blank line, both a leading opening |
30917 |
newline and a trailing closing newline are omitted.) |
newline and a trailing closing newline are omitted.) |
30918 |
|
|
30919 |
@vindex calc-embedded-announce-formula |
@vindex calc-embedded-announce-formula |
30920 |
The @code{calc-embedded-announce-formula} variable is a regular |
The @code{calc-embedded-announce-formula} variable is a regular |
30921 |
expression which is sure to be followed by an embedded formula. |
expression which is sure to be followed by an embedded formula. |
30922 |
The @kbd{M-# a} command searches for this pattern as well as for |
The @kbd{C-x * a} command searches for this pattern as well as for |
30923 |
@samp{=>} and @samp{:=} operators. Note that @kbd{M-# a} will |
@samp{=>} and @samp{:=} operators. Note that @kbd{C-x * a} will |
30924 |
not activate just anything surrounded by formula delimiters; after |
not activate just anything surrounded by formula delimiters; after |
30925 |
all, blank lines are considered formula delimiters by default! |
all, blank lines are considered formula delimiters by default! |
30926 |
But if your language includes a delimiter which can only occur |
But if your language includes a delimiter which can only occur |
30948 |
major modes. If you change this, it is a good idea still to end with a |
major modes. If you change this, it is a good idea still to end with a |
30949 |
newline so that mode annotations will appear on lines by themselves. |
newline so that mode annotations will appear on lines by themselves. |
30950 |
|
|
30951 |
@node Programming, Customizable Variables, Embedded Mode, Top |
@node Programming, Customizing Calc, Embedded Mode, Top |
30952 |
@chapter Programming |
@chapter Programming |
30953 |
|
|
30954 |
@noindent |
@noindent |
31160 |
we take it for granted that it is clear we really mean |
we take it for granted that it is clear we really mean |
31161 |
@kbd{' [1 @key{SPC} 2 @key{SPC} 3] @key{RET}}. |
@kbd{' [1 @key{SPC} 2 @key{SPC} 3] @key{RET}}. |
31162 |
|
|
31163 |
@kindex M-# m |
@kindex C-x * m |
31164 |
@pindex read-kbd-macro |
@pindex read-kbd-macro |
31165 |
The @kbd{M-# m} (@code{read-kbd-macro}) command reads an Emacs ``region'' |
The @kbd{C-x * m} (@code{read-kbd-macro}) command reads an Emacs ``region'' |
31166 |
of spelled-out keystrokes and defines it as the current keyboard macro. |
of spelled-out keystrokes and defines it as the current keyboard macro. |
31167 |
It is a convenient way to define a keyboard macro that has been stored |
It is a convenient way to define a keyboard macro that has been stored |
31168 |
in a file, or to define a macro without executing it at the same time. |
in a file, or to define a macro without executing it at the same time. |
31270 |
Another approach is to enter a harmless dummy definition for the macro, |
Another approach is to enter a harmless dummy definition for the macro, |
31271 |
then go back and edit in the real one with a @kbd{Z E} command. Yet |
then go back and edit in the real one with a @kbd{Z E} command. Yet |
31272 |
another approach is to type the macro as written-out keystroke names |
another approach is to type the macro as written-out keystroke names |
31273 |
in a buffer, then use @kbd{M-# m} (@code{read-kbd-macro}) to read the |
in a buffer, then use @kbd{C-x * m} (@code{read-kbd-macro}) to read the |
31274 |
macro. |
macro. |
31275 |
|
|
31276 |
@kindex Z / |
@kindex Z / |
31444 |
@node Invocation Macros, Algebraic Definitions, Keyboard Macros, Programming |
@node Invocation Macros, Algebraic Definitions, Keyboard Macros, Programming |
31445 |
@section Invocation Macros |
@section Invocation Macros |
31446 |
|
|
31447 |
@kindex M-# z |
@kindex C-x * z |
31448 |
@kindex Z I |
@kindex Z I |
31449 |
@pindex calc-user-invocation |
@pindex calc-user-invocation |
31450 |
@pindex calc-user-define-invocation |
@pindex calc-user-define-invocation |
31451 |
Calc provides one special keyboard macro, called up by @kbd{M-# z} |
Calc provides one special keyboard macro, called up by @kbd{C-x * z} |
31452 |
(@code{calc-user-invocation}), that is intended to allow you to define |
(@code{calc-user-invocation}), that is intended to allow you to define |
31453 |
your own special way of starting Calc. To define this ``invocation |
your own special way of starting Calc. To define this ``invocation |
31454 |
macro,'' create the macro in the usual way with @kbd{C-x (} and |
macro,'' create the macro in the usual way with @kbd{C-x (} and |
31455 |
@kbd{C-x )}, then type @kbd{Z I} (@code{calc-user-define-invocation}). |
@kbd{C-x )}, then type @kbd{Z I} (@code{calc-user-define-invocation}). |
31456 |
There is only one invocation macro, so you don't need to type any |
There is only one invocation macro, so you don't need to type any |
31457 |
additional letters after @kbd{Z I}. From now on, you can type |
additional letters after @kbd{Z I}. From now on, you can type |
31458 |
@kbd{M-# z} at any time to execute your invocation macro. |
@kbd{C-x * z} at any time to execute your invocation macro. |
31459 |
|
|
31460 |
For example, suppose you find yourself often grabbing rectangles of |
For example, suppose you find yourself often grabbing rectangles of |
31461 |
numbers into Calc and multiplying their columns. You can do this |
numbers into Calc and multiplying their columns. You can do this |
31462 |
by typing @kbd{M-# r} to grab, and @kbd{V R : *} to multiply columns. |
by typing @kbd{C-x * r} to grab, and @kbd{V R : *} to multiply columns. |
31463 |
To make this into an invocation macro, just type @kbd{C-x ( M-# r |
To make this into an invocation macro, just type @kbd{C-x ( C-x * r |
31464 |
V R : * C-x )}, then @kbd{Z I}. Then, to multiply a rectangle of data, |
V R : * C-x )}, then @kbd{Z I}. Then, to multiply a rectangle of data, |
31465 |
just mark the data in its buffer in the usual way and type @kbd{M-# z}. |
just mark the data in its buffer in the usual way and type @kbd{C-x * z}. |
31466 |
|
|
31467 |
Invocation macros are treated like regular Emacs keyboard macros; |
Invocation macros are treated like regular Emacs keyboard macros; |
31468 |
all the special features described above for @kbd{Z K}-style macros |
all the special features described above for @kbd{Z K}-style macros |
31469 |
do not apply. @kbd{M-# z} is just like @kbd{C-x e}, except that it |
do not apply. @kbd{C-x * z} is just like @kbd{C-x e}, except that it |
31470 |
uses the macro that was last stored by @kbd{Z I}. (In fact, the |
uses the macro that was last stored by @kbd{Z I}. (In fact, the |
31471 |
macro does not even have to have anything to do with Calc!) |
macro does not even have to have anything to do with Calc!) |
31472 |
|
|
34710 |
|
|
34711 |
@defvar calc-end-hook |
@defvar calc-end-hook |
34712 |
This hook is called by @code{calc-quit}, generally because the user |
This hook is called by @code{calc-quit}, generally because the user |
34713 |
presses @kbd{q} or @kbd{M-# c} while in Calc. The Calc buffer will |
presses @kbd{q} or @kbd{C-x * c} while in Calc. The Calc buffer will |
34714 |
be the current buffer. The hook is called as the very first |
be the current buffer. The hook is called as the very first |
34715 |
step, before the Calc window is destroyed. |
step, before the Calc window is destroyed. |
34716 |
@end defvar |
@end defvar |
34762 |
@end defvar |
@end defvar |
34763 |
|
|
34764 |
@defvar calc-reset-hook |
@defvar calc-reset-hook |
34765 |
This hook is called after @kbd{M-# 0} (@code{calc-reset}) has |
This hook is called after @kbd{C-x * 0} (@code{calc-reset}) has |
34766 |
reset all modes. The Calc buffer will be the current buffer. |
reset all modes. The Calc buffer will be the current buffer. |
34767 |
@end defvar |
@end defvar |
34768 |
|
|
34827 |
list and also call @code{make-local-variable} itself. |
list and also call @code{make-local-variable} itself. |
34828 |
@end defvar |
@end defvar |
34829 |
|
|
34830 |
@node Customizable Variables, Reporting Bugs, Programming, Top |
@node Customizing Calc, Reporting Bugs, Programming, Top |
34831 |
@appendix Customizable Variables |
@appendix Customizing Calc |
34832 |
|
|
34833 |
|
The usual prefix for Calc is the key sequence @kbd{C-x *}. If you wish |
34834 |
|
to use a different prefix, you can put |
34835 |
|
|
34836 |
|
@example |
34837 |
|
(global-set-key "NEWPREFIX" 'calc-dispatch) |
34838 |
|
@end example |
34839 |
|
|
34840 |
|
@noindent |
34841 |
|
in your .emacs file. |
34842 |
|
(@xref{Key Bindings,,Customizing Key Bindings,emacs, |
34843 |
|
The GNU Emacs Manual}, for more information on binding keys.) |
34844 |
|
A convenient way to start Calc is with @kbd{C-x * *}; to make it equally |
34845 |
|
convenient for users who use a different prefix, the prefix can be |
34846 |
|
followed by @kbd{=}, @kbd{&}, @kbd{#}, @kbd{\}, @kbd{/}, @kbd{+} or |
34847 |
|
@kbd{-} as well as @kbd{*} to start Calc, and so in many cases the last |
34848 |
|
character of the prefix can simply be typed twice. |
34849 |
|
|
34850 |
GNU Calc is controlled by many variables, most of which can be reset |
Calc is controlled by many variables, most of which can be reset |
34851 |
from within Calc. Some variables are less involved with actual |
from within Calc. Some variables are less involved with actual |
34852 |
calculation, and can be set outside of Calc using Emacs's |
calculation, and can be set outside of Calc using Emacs's |
34853 |
customization facilities. These variables are listed below. |
customization facilities. These variables are listed below. |
34880 |
The variable @code{calc-gnuplot-name} should be the name of the |
The variable @code{calc-gnuplot-name} should be the name of the |
34881 |
GNUPLOT program (a string). If you have GNUPLOT installed on your |
GNUPLOT program (a string). If you have GNUPLOT installed on your |
34882 |
system but Calc is unable to find it, you may need to set this |
system but Calc is unable to find it, you may need to set this |
34883 |
variable. (@pxref{Customizable Variables}) |
variable. (@pxref{Customizing Calc}) |
34884 |
You may also need to set some Lisp variables to show Calc how to run |
You may also need to set some Lisp variables to show Calc how to run |
34885 |
GNUPLOT on your system, see @ref{Devices, ,Graphical Devices} . The default value |
GNUPLOT on your system, see @ref{Devices, ,Graphical Devices} . The default value |
34886 |
of @code{calc-gnuplot-name} is @code{"gnuplot"}. |
of @code{calc-gnuplot-name} is @code{"gnuplot"}. |
34934 |
@defvarx calc-embedded-announce-formula-alist |
@defvarx calc-embedded-announce-formula-alist |
34935 |
See @ref{Customizing Embedded Mode}.@* |
See @ref{Customizing Embedded Mode}.@* |
34936 |
The variable @code{calc-embedded-announce-formula} helps determine |
The variable @code{calc-embedded-announce-formula} helps determine |
34937 |
what formulas @kbd{M-# a} will activate in a buffer. It is a |
what formulas @kbd{C-x * a} will activate in a buffer. It is a |
34938 |
regular expression, and when activating embedded formulas with |
regular expression, and when activating embedded formulas with |
34939 |
@kbd{M-# a}, it will tell Calc that what follows is a formula to be |
@kbd{C-x * a}, it will tell Calc that what follows is a formula to be |
34940 |
activated. (Calc also uses other patterns to find formulas, such as |
activated. (Calc also uses other patterns to find formulas, such as |
34941 |
@samp{=>} and @samp{:=}.) |
@samp{=>} and @samp{:=}.) |
34942 |
|
|
34973 |
See @ref{Customizing Embedded Mode}.@* |
See @ref{Customizing Embedded Mode}.@* |
34974 |
The variables @code{calc-embedded-open-formula} and |
The variables @code{calc-embedded-open-formula} and |
34975 |
@code{calc-embedded-open-formula} control the region that Calc will |
@code{calc-embedded-open-formula} control the region that Calc will |
34976 |
activate as a formula when Embedded mode is entered with @kbd{M-# e}. |
activate as a formula when Embedded mode is entered with @kbd{C-x * e}. |
34977 |
They are regular expressions; |
They are regular expressions; |
34978 |
Calc normally scans backward and forward in the buffer for the |
Calc normally scans backward and forward in the buffer for the |
34979 |
nearest text matching these regular expressions to be the ``formula |
nearest text matching these regular expressions to be the ``formula |
35011 |
See @ref{Customizing Embedded Mode}.@* |
See @ref{Customizing Embedded Mode}.@* |
35012 |
The variables @code{calc-embedded-open-word} and |
The variables @code{calc-embedded-open-word} and |
35013 |
@code{calc-embedded-close-word} control the region that Calc will |
@code{calc-embedded-close-word} control the region that Calc will |
35014 |
activate when Embedded mode is entered with @kbd{M-# w}. They are |
activate when Embedded mode is entered with @kbd{C-x * w}. They are |
35015 |
regular expressions. |
regular expressions. |
35016 |
|
|
35017 |
The default values of @code{calc-embedded-open-word} and |
The default values of @code{calc-embedded-open-word} and |
35075 |
See @ref{Customizing Embedded Mode}.@* |
See @ref{Customizing Embedded Mode}.@* |
35076 |
The variables @code{calc-embedded-open-new-formula} and |
The variables @code{calc-embedded-open-new-formula} and |
35077 |
@code{calc-embedded-close-new-formula} are strings which are |
@code{calc-embedded-close-new-formula} are strings which are |
35078 |
inserted before and after a new formula when you type @kbd{M-# f}. |
inserted before and after a new formula when you type @kbd{C-x * f}. |
35079 |
|
|
35080 |
The default value of @code{calc-embedded-open-new-formula} is |
The default value of @code{calc-embedded-open-new-formula} is |
35081 |
@code{"\n\n"}. If this string begins with a newline character and the |
@code{"\n\n"}. If this string begins with a newline character and the |
35082 |
@kbd{M-# f} is typed at the beginning of a line, @kbd{M-# f} will skip |
@kbd{C-x * f} is typed at the beginning of a line, @kbd{C-x * f} will skip |
35083 |
this first newline to avoid introducing unnecessary blank lines in the |
this first newline to avoid introducing unnecessary blank lines in the |
35084 |
file. The default value of @code{calc-embedded-close-new-formula} is |
file. The default value of @code{calc-embedded-close-new-formula} is |
35085 |
also @code{"\n\n"}. The final newline is omitted by @w{@kbd{M-# f}} |
also @code{"\n\n"}. The final newline is omitted by @w{@kbd{C-x * f}} |
35086 |
if typed at the end of a line. (It follows that if @kbd{M-# f} is |
if typed at the end of a line. (It follows that if @kbd{C-x * f} is |
35087 |
typed on a blank line, both a leading opening newline and a trailing |
typed on a blank line, both a leading opening newline and a trailing |
35088 |
closing newline are omitted.) |
closing newline are omitted.) |
35089 |
|
|
35139 |
and @code{calc-embedded-open-close-plain-alist}. |
and @code{calc-embedded-open-close-plain-alist}. |
35140 |
@end defvar |
@end defvar |
35141 |
|
|
35142 |
@node Reporting Bugs, Summary, Customizable Variables, Top |
@node Reporting Bugs, Summary, Customizing Calc, Top |
35143 |
@appendix Reporting Bugs |
@appendix Reporting Bugs |
35144 |
|
|
35145 |
@noindent |
@noindent |
35223 |
@advance@baselineskip-2.5pt |
@advance@baselineskip-2.5pt |
35224 |
@let@c@sumbreak |
@let@c@sumbreak |
35225 |
@end iftex |
@end iftex |
35226 |
@r{ @: M-# a @: @: 33 @:calc-embedded-activate@:} |
@r{ @: C-x * a @: @: 33 @:calc-embedded-activate@:} |
35227 |
@r{ @: M-# b @: @: @:calc-big-or-small@:} |
@r{ @: C-x * b @: @: @:calc-big-or-small@:} |
35228 |
@r{ @: M-# c @: @: @:calc@:} |
@r{ @: C-x * c @: @: @:calc@:} |
35229 |
@r{ @: M-# d @: @: @:calc-embedded-duplicate@:} |
@r{ @: C-x * d @: @: @:calc-embedded-duplicate@:} |
35230 |
@r{ @: M-# e @: @: 34 @:calc-embedded@:} |
@r{ @: C-x * e @: @: 34 @:calc-embedded@:} |
35231 |
@r{ @: M-# f @:formula @: @:calc-embedded-new-formula@:} |
@r{ @: C-x * f @:formula @: @:calc-embedded-new-formula@:} |
35232 |
@r{ @: M-# g @: @: 35 @:calc-grab-region@:} |
@r{ @: C-x * g @: @: 35 @:calc-grab-region@:} |
35233 |
@r{ @: M-# i @: @: @:calc-info@:} |
@r{ @: C-x * i @: @: @:calc-info@:} |
35234 |
@r{ @: M-# j @: @: @:calc-embedded-select@:} |
@r{ @: C-x * j @: @: @:calc-embedded-select@:} |
35235 |
@r{ @: M-# k @: @: @:calc-keypad@:} |
@r{ @: C-x * k @: @: @:calc-keypad@:} |
35236 |
@r{ @: M-# l @: @: @:calc-load-everything@:} |
@r{ @: C-x * l @: @: @:calc-load-everything@:} |
35237 |
@r{ @: M-# m @: @: @:read-kbd-macro@:} |
@r{ @: C-x * m @: @: @:read-kbd-macro@:} |
35238 |
@r{ @: M-# n @: @: 4 @:calc-embedded-next@:} |
@r{ @: C-x * n @: @: 4 @:calc-embedded-next@:} |
35239 |
@r{ @: M-# o @: @: @:calc-other-window@:} |
@r{ @: C-x * o @: @: @:calc-other-window@:} |
35240 |
@r{ @: M-# p @: @: 4 @:calc-embedded-previous@:} |
@r{ @: C-x * p @: @: 4 @:calc-embedded-previous@:} |
35241 |
@r{ @: M-# q @:formula @: @:quick-calc@:} |
@r{ @: C-x * q @:formula @: @:quick-calc@:} |
35242 |
@r{ @: M-# r @: @: 36 @:calc-grab-rectangle@:} |
@r{ @: C-x * r @: @: 36 @:calc-grab-rectangle@:} |
35243 |
@r{ @: M-# s @: @: @:calc-info-summary@:} |
@r{ @: C-x * s @: @: @:calc-info-summary@:} |
35244 |
@r{ @: M-# t @: @: @:calc-tutorial@:} |
@r{ @: C-x * t @: @: @:calc-tutorial@:} |
35245 |
@r{ @: M-# u @: @: @:calc-embedded-update-formula@:} |
@r{ @: C-x * u @: @: @:calc-embedded-update-formula@:} |
35246 |
@r{ @: M-# w @: @: @:calc-embedded-word@:} |
@r{ @: C-x * w @: @: @:calc-embedded-word@:} |
35247 |
@r{ @: M-# x @: @: @:calc-quit@:} |
@r{ @: C-x * x @: @: @:calc-quit@:} |
35248 |
@r{ @: M-# y @: @:1,28,49 @:calc-copy-to-buffer@:} |
@r{ @: C-x * y @: @:1,28,49 @:calc-copy-to-buffer@:} |
35249 |
@r{ @: M-# z @: @: @:calc-user-invocation@:} |
@r{ @: C-x * z @: @: @:calc-user-invocation@:} |
35250 |
@r{ @: M-# = @: @: @:calc-embedded-update-formula@:} |
@r{ @: C-x * : @: @: 36 @:calc-grab-sum-down@:} |
35251 |
@r{ @: M-# : @: @: 36 @:calc-grab-sum-down@:} |
@r{ @: C-x * _ @: @: 36 @:calc-grab-sum-across@:} |
35252 |
@r{ @: M-# _ @: @: 36 @:calc-grab-sum-across@:} |
@r{ @: C-x * ` @:editing @: 30 @:calc-embedded-edit@:} |
35253 |
@r{ @: M-# ` @:editing @: 30 @:calc-embedded-edit@:} |
@r{ @: C-x * 0 @:(zero) @: @:calc-reset@:} |
|
@r{ @: M-# 0 @:(zero) @: @:calc-reset@:} |
|
35254 |
|
|
35255 |
@c |
@c |
35256 |
@r{ @: 0-9 @:number @: @:@:number} |
@r{ @: 0-9 @:number @: @:@:number} |