Mercurial > emacs
comparison man/calc.texi @ 90136:7a3341d65a12
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-33
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 223-227)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 02 Apr 2005 22:40:25 +0000 |
parents | 4da4a09e8b1b 9ec6d63a7605 |
children | 02f1dbc4a199 |
comparison
equal
deleted
inserted
replaced
90135:baa2d4aa0064 | 90136:7a3341d65a12 |
---|---|
163 * Graphics:: Commands for making graphs of data. | 163 * Graphics:: Commands for making graphs of data. |
164 * Kill and Yank:: Moving data into and out of Calc. | 164 * Kill and Yank:: Moving data into and out of Calc. |
165 * Embedded Mode:: Working with formulas embedded in a file. | 165 * Embedded Mode:: Working with formulas embedded in a file. |
166 * Programming:: Calc as a programmable calculator. | 166 * Programming:: Calc as a programmable calculator. |
167 | 167 |
168 * Installation:: Installing Calc as a part of GNU Emacs. | 168 * Customizable Variables:: Customizable Variables. |
169 * Reporting Bugs:: How to report bugs and make suggestions. | 169 * Reporting Bugs:: How to report bugs and make suggestions. |
170 | 170 |
171 * Summary:: Summary of Calc commands and functions. | 171 * Summary:: Summary of Calc commands and functions. |
172 | 172 |
173 * Key Index:: The standard Calc key sequences. | 173 * Key Index:: The standard Calc key sequences. |
10611 If this happens, the easiest workaround is to type @kbd{M-# L} | 10611 If this happens, the easiest workaround is to type @kbd{M-# L} |
10612 (@code{calc-load-everything}) to force all the parts of Calc to be | 10612 (@code{calc-load-everything}) to force all the parts of Calc to be |
10613 loaded right away. This will cause Emacs to take up a lot more | 10613 loaded right away. This will cause Emacs to take up a lot more |
10614 memory than it would otherwise, but it's guaranteed to fix the problem. | 10614 memory than it would otherwise, but it's guaranteed to fix the problem. |
10615 | 10615 |
10616 If you seem to run into this problem no matter what you do, or if | |
10617 even the @kbd{M-# L} command crashes, Calc may have been improperly | |
10618 installed. @xref{Installation}, for details of the installation | |
10619 process. | |
10620 | |
10621 @node Recursion Depth, Caches, Autoloading Problems, Troubleshooting Commands | 10616 @node Recursion Depth, Caches, Autoloading Problems, Troubleshooting Commands |
10622 @subsection Recursion Depth | 10617 @subsection Recursion Depth |
10623 | 10618 |
10624 @noindent | 10619 @noindent |
10625 @kindex M | 10620 @kindex M |
12304 their default values, then settings from the file you named are loaded | 12299 their default values, then settings from the file you named are loaded |
12305 if this file exists, and this file becomes the one that Calc will | 12300 if this file exists, and this file becomes the one that Calc will |
12306 use in the future for commands like @kbd{m m}. The default settings | 12301 use in the future for commands like @kbd{m m}. The default settings |
12307 file name is @file{~/.calc.el}. You can see the current file name by | 12302 file name is @file{~/.calc.el}. You can see the current file name by |
12308 giving a blank response to the @kbd{m F} prompt. See also the | 12303 giving a blank response to the @kbd{m F} prompt. See also the |
12309 discussion of the @code{calc-settings-file} variable; @pxref{Installation}. | 12304 discussion of the @code{calc-settings-file} variable; @pxref{Customizable Variables}. |
12310 | 12305 |
12311 If the file name you give is your user init file (typically | 12306 If the file name you give is your user init file (typically |
12312 @file{~/.emacs}), @kbd{m F} will not automatically load the new file. This | 12307 @file{~/.emacs}), @kbd{m F} will not automatically load the new file. This |
12313 is because your user init file may contain other things you don't want | 12308 is because your user init file may contain other things you don't want |
12314 to reread. You can give | 12309 to reread. You can give |
29107 @vindex calc-gnuplot-default-device | 29102 @vindex calc-gnuplot-default-device |
29108 @vindex calc-gnuplot-default-output | 29103 @vindex calc-gnuplot-default-output |
29109 @vindex calc-gnuplot-print-command | 29104 @vindex calc-gnuplot-print-command |
29110 @vindex calc-gnuplot-print-device | 29105 @vindex calc-gnuplot-print-device |
29111 @vindex calc-gnuplot-print-output | 29106 @vindex calc-gnuplot-print-output |
29112 If you are installing Calc you may wish to configure the default and | 29107 You may wish to configure the default and |
29113 printer devices and output files for the whole system. The relevant | 29108 printer devices and output files for the whole system. The relevant |
29114 Lisp variables are @code{calc-gnuplot-default-device} and @code{-output}, | 29109 Lisp variables are @code{calc-gnuplot-default-device} and @code{-output}, |
29115 and @code{calc-gnuplot-print-device} and @code{-output}. The output | 29110 and @code{calc-gnuplot-print-device} and @code{-output}. The output |
29116 file names must be either strings as described above, or Lisp | 29111 file names must be either strings as described above, or Lisp |
29117 expressions which are evaluated on the fly to get the output file names. | 29112 expressions which are evaluated on the fly to get the output file names. |
29120 @code{calc-gnuplot-print-command}, which give the system commands to | 29115 @code{calc-gnuplot-print-command}, which give the system commands to |
29121 display or print the output of GNUPLOT, respectively. These may be | 29116 display or print the output of GNUPLOT, respectively. These may be |
29122 @code{nil} if no command is necessary, or strings which can include | 29117 @code{nil} if no command is necessary, or strings which can include |
29123 @samp{%s} to signify the name of the file to be displayed or printed. | 29118 @samp{%s} to signify the name of the file to be displayed or printed. |
29124 Or, these variables may contain Lisp expressions which are evaluated | 29119 Or, these variables may contain Lisp expressions which are evaluated |
29125 to display or print the output. | 29120 to display or print the output. These variables are customizable |
29121 (@pxref{Customizable Variables}). | |
29126 | 29122 |
29127 @kindex g x | 29123 @kindex g x |
29128 @pindex calc-graph-display | 29124 @pindex calc-graph-display |
29129 The @kbd{g x} (@code{calc-graph-display}) command lets you specify | 29125 The @kbd{g x} (@code{calc-graph-display}) command lets you specify |
29130 on which X window system display your graphs should be drawn. Enter | 29126 on which X window system display your graphs should be drawn. Enter |
29908 in @code{latex-mode}, for example, Calc will set its language to La@TeX{}. | 29904 in @code{latex-mode}, for example, Calc will set its language to La@TeX{}. |
29909 Similarly, Calc will use @TeX{} language for @code{tex-mode}, | 29905 Similarly, Calc will use @TeX{} language for @code{tex-mode}, |
29910 @code{plain-tex-mode} and @code{context-mode}, C language for | 29906 @code{plain-tex-mode} and @code{context-mode}, C language for |
29911 @code{c-mode} and @code{c++-mode}, FORTRAN language for | 29907 @code{c-mode} and @code{c++-mode}, FORTRAN language for |
29912 @code{fortran-mode} and @code{f90-mode}, Pascal for @code{pascal-mode}, | 29908 @code{fortran-mode} and @code{f90-mode}, Pascal for @code{pascal-mode}, |
29913 and eqn for @code{nroff-mode}. These can be overridden with Calc's mode | 29909 and eqn for @code{nroff-mode} (@pxref{Customizable Variables}). |
29910 These can be overridden with Calc's mode | |
29914 changing commands (@pxref{Mode Settings in Embedded Mode}). If no | 29911 changing commands (@pxref{Mode Settings in Embedded Mode}). If no |
29915 suitable language is available, Calc will continue with its current language. | 29912 suitable language is available, Calc will continue with its current language. |
29916 | 29913 |
29917 Calc normally scans backward and forward in the buffer for the | 29914 Calc normally scans backward and forward in the buffer for the |
29918 nearest opening and closing @dfn{formula delimiters}. The simplest | 29915 nearest opening and closing @dfn{formula delimiters}. The simplest |
30610 @node Customizing Embedded Mode, , Mode Settings in Embedded Mode, Embedded Mode | 30607 @node Customizing Embedded Mode, , Mode Settings in Embedded Mode, Embedded Mode |
30611 @section Customizing Embedded Mode | 30608 @section Customizing Embedded Mode |
30612 | 30609 |
30613 @noindent | 30610 @noindent |
30614 You can modify Embedded mode's behavior by setting various Lisp | 30611 You can modify Embedded mode's behavior by setting various Lisp |
30615 variables described here. Use @kbd{M-x set-variable} or | 30612 variables described here. These variables are customizable |
30616 @kbd{M-x edit-options} to adjust a variable on the fly, or | 30613 (@pxref{Customizable Variables}), or you can use @kbd{M-x set-variable} |
30617 put a suitable @code{setq} statement in your Calc init file (or | 30614 or @kbd{M-x edit-options} to adjust a variable on the fly. |
30618 @file{~/.emacs}) to set a variable permanently. (Another possibility would | 30615 (Another possibility would |
30619 be to use a file-local variable annotation at the end of the | 30616 be to use a file-local variable annotation at the end of the |
30620 file; @pxref{File Variables, , Local Variables in Files, emacs, the | 30617 file; @pxref{File Variables, , Local Variables in Files, emacs, the |
30621 Emacs manual}.) | 30618 Emacs manual}.) |
30622 | 30619 |
30623 While none of these variables will be buffer-local by default, you | 30620 While none of these variables will be buffer-local by default, you |
30758 follows a mode annotation written by Calc. Its default value | 30755 follows a mode annotation written by Calc. Its default value |
30759 is simply a newline, @code{"\n"}. If you change this, it is a | 30756 is simply a newline, @code{"\n"}. If you change this, it is a |
30760 good idea still to end with a newline so that mode annotations | 30757 good idea still to end with a newline so that mode annotations |
30761 will appear on lines by themselves. | 30758 will appear on lines by themselves. |
30762 | 30759 |
30763 @node Programming, Installation, Embedded Mode, Top | 30760 @node Programming, Customizable Variables, Embedded Mode, Top |
30764 @chapter Programming | 30761 @chapter Programming |
30765 | 30762 |
30766 @noindent | 30763 @noindent |
30767 There are several ways to ``program'' the Emacs Calculator, depending | 30764 There are several ways to ``program'' the Emacs Calculator, depending |
30768 on the nature of the problem you need to solve. | 30765 on the nature of the problem you need to solve. |
34608 Since @code{calc-mode-hook} is called after this list has been | 34605 Since @code{calc-mode-hook} is called after this list has been |
34609 used the first time, your hook should add a variable to the | 34606 used the first time, your hook should add a variable to the |
34610 list and also call @code{make-local-variable} itself. | 34607 list and also call @code{make-local-variable} itself. |
34611 @end defvar | 34608 @end defvar |
34612 | 34609 |
34613 @node Installation, Reporting Bugs, Programming, Top | 34610 @node Customizable Variables, Reporting Bugs, Programming, Top |
34614 @appendix Installation | 34611 @appendix Customizable Variables |
34615 | 34612 |
34616 @noindent | 34613 GNU Calc is controlled by many variables, most of which can be reset |
34617 As of Calc 2.02g, Calc is integrated with GNU Emacs, and thus requires | 34614 from within Calc. Some variables are less involved with actual |
34618 no separate installation of its Lisp files and this manual. | 34615 calculation, and can be set outside of Calc using Emacs's |
34619 | 34616 customization facilities. These variables are listed below. |
34620 @appendixsec The GNUPLOT Program | 34617 Typing @kbd{M-x customize-variable RET @var{variable-name} RET} |
34621 | 34618 will bring up a buffer in which the variable's value can be redefined. |
34622 @noindent | 34619 Typing @kbd{M-x customize-group RET calc RET} will bring up a buffer which |
34623 Calc's graphing commands use the GNUPLOT program. If you have GNUPLOT | 34620 contains all of Calc's customizable variables. (These variables can |
34624 but you must type some command other than @file{gnuplot} to get it, | 34621 also be reset by putting the appropriate lines in your .emacs file; |
34625 you should add a command to set the Lisp variable @code{calc-gnuplot-name} | 34622 @xref{Init File, ,Init File, emacs, The GNU Emacs Manual}.) |
34626 to the appropriate file name. You may also need to change the variables | 34623 |
34627 @code{calc-gnuplot-plot-command} and @code{calc-gnuplot-print-command} in | 34624 Some of the customizable variables are regular expressions. A regular |
34628 order to get correct displays and hardcopies, respectively, of your | 34625 expression is basically a pattern that Calc can search for. |
34629 plots. | 34626 See @ref{Regexp Search,, Regular Expression Search, emacs, The GNU Emacs Manual} |
34630 | 34627 to see how regular expressions work. |
34631 @ifinfo | 34628 |
34629 @table @code | |
34630 | |
34631 @item calc-settings-file | |
34632 | |
34633 @vindex calc-settings-file | |
34634 The variable @code{calc-settings-file} holds the file name in | |
34635 which commands like @kbd{m m} and @kbd{Z P} store ``permanent'' | |
34636 definitions. | |
34637 If @code{calc-settings-file} is not your user init file (typically | |
34638 @file{~/.emacs}) and if the variable @code{calc-loaded-settings-file} is | |
34639 @code{nil}, then Calc will automatically load your settings file (if it | |
34640 exists) the first time Calc is invoked. | |
34641 | |
34642 The default value for this variable is @code{"~/.calc.el"}. | |
34643 | |
34644 @item calc-gnuplot-name | |
34645 | |
34646 See @ref{Graphics}.@* | |
34647 The variable @code{calc-gnuplot-name} should be the name of the | |
34648 GNUPLOT program (a string). If you have GNUPLOT installed on your | |
34649 system but Calc is unable to find it, you may need to set this | |
34650 variable. (@pxref{Customizable Variables}) | |
34651 You may also need to set some Lisp variables to show Calc how to run | |
34652 GNUPLOT on your system, see @ref{Devices, ,Graphical Devices} . The default value | |
34653 of @code{calc-gnuplot-name} is @code{"gnuplot"}. | |
34654 | |
34655 @item calc-gnuplot-plot-command | |
34656 @itemx calc-gnuplot-print-command | |
34657 | |
34658 See @ref{Devices, ,Graphical Devices}.@* | |
34659 The variables @code{calc-gnuplot-plot-command} and | |
34660 @code{calc-gnuplot-print-command} represent system commands to | |
34661 display and print the output of GNUPLOT, respectively. These may be | |
34662 @code{nil} if no command is necessary, or strings which can include | |
34663 @samp{%s} to signify the name of the file to be displayed or printed. | |
34664 Or, these variables may contain Lisp expressions which are evaluated | |
34665 to display or print the output. | |
34666 | |
34667 The default value of @code{calc-gnuplot-plot-command} is @code{nil}, | |
34668 and the default value of @code{calc-gnuplot-print-command} is | |
34669 @code{"lp %s"}. | |
34670 | |
34671 @item calc-language-alist | |
34672 | |
34673 See @ref{Basic Embedded Mode}.@* | |
34674 The variable @code{calc-language-alist} controls the languages that | |
34675 Calc will associate with major modes. When Calc embedded mode is | |
34676 enabled, it will try to use the current major mode to | |
34677 determine what language should be used. (This can be overridden using | |
34678 Calc's mode changing commands, @xref{Mode Settings in Embedded Mode}.) | |
34679 The variable @code{calc-language-alist} consists of a list of pairs of | |
34680 the form @code{(@var{KEY} . @var{VALUE})}; for example, | |
34681 @code{(latex-mode . latex)} is one such pair. If Calc embedded is | |
34682 activated in a buffer whose major mode is @var{KEY}, it will set itself | |
34683 to use the language @var{VALUE}. | |
34684 | |
34685 The default value of @code{calc-language-alist} is | |
34632 @example | 34686 @example |
34633 | 34687 ((latex-mode . latex) |
34688 (tex-mode . tex) | |
34689 (plain-tex-mode . tex) | |
34690 (context-mode . tex) | |
34691 (nroff-mode . eqn) | |
34692 (pascal-mode . pascal) | |
34693 (c-mode . c) | |
34694 (c++-mode . c) | |
34695 (fortran-mode . fortran) | |
34696 (f90-mode . fortran)) | |
34634 @end example | 34697 @end example |
34635 @end ifinfo | 34698 |
34636 | 34699 @item calc-embedded-announce-formula |
34637 @appendixsec Settings File | 34700 |
34638 | 34701 See @ref{Customizing Embedded Mode}.@* |
34639 @noindent | 34702 The variable @code{calc-embedded-announce-formula} helps determine |
34640 @vindex calc-settings-file | 34703 what formulas @kbd{M-# a} will activate in a buffer. It is a |
34641 Another variable you might want to set is @code{calc-settings-file}, | 34704 regular expression, and when activating embedded formulas with |
34642 which holds the file name in which commands like @kbd{m m} and @kbd{Z P} | 34705 @kbd{M-# a}, it will tell Calc that what follows is a formula to be |
34643 store ``permanent'' definitions. The default value for this variable | 34706 activated. (Calc also uses other patterns to find formulas, such as |
34644 is @code{"~/.calc.el"}. If @code{calc-settings-file} is not your user | 34707 @samp{=>} and @samp{:=}.) |
34645 init file (typically @file{~/.emacs}) and if the variable | 34708 |
34646 @code{calc-loaded-settings-file} is @code{nil}, then Calc will | 34709 The default pattern is @code{"%Embed\n\\(% .*\n\\)*"}, which checks |
34647 automatically load your settings file (if it exists) the first time | 34710 for @samp{%Embed} followed by any number of lines beginning with |
34648 Calc is invoked. | 34711 @samp{%} and a space. |
34649 | 34712 |
34650 @ifinfo | 34713 @item calc-embedded-open-formula |
34651 @example | 34714 @itemx calc-embedded-close-formula |
34652 | 34715 |
34653 @end example | 34716 See @ref{Customizing Embedded Mode}.@* |
34654 @end ifinfo | 34717 The variables @code{calc-embedded-open-formula} and |
34655 @appendixsec Testing the Installation | 34718 @code{calc-embedded-open-formula} control the region that Calc will |
34656 | 34719 activate as a formula when Embedded mode is entered with @kbd{M-# e}. |
34657 @noindent | 34720 They are regular expressions; |
34658 To test your installation of Calc, start a new Emacs and type @kbd{M-# c} | 34721 Calc normally scans backward and forward in the buffer for the |
34659 to make sure the autoloads and key bindings work. Type @kbd{M-# i} | 34722 nearest text matching these regular expressions to be the ``formula |
34660 to make sure Calc can find its Info documentation. Press @kbd{q} to | 34723 delimiters''. |
34661 exit the Info system and @kbd{M-# c} to re-enter the Calculator. | 34724 |
34662 Type @kbd{20 S} to compute the sine of 20 degrees; this will test the | 34725 The simplest delimiters are blank lines. Other delimiters that |
34663 autoloading of the extensions modules. The result should be | 34726 Embedded mode understands by default are: |
34664 0.342020143326. Finally, press @kbd{M-# c} again to make sure the | 34727 @enumerate |
34665 Calculator can exit. | 34728 @item |
34666 | 34729 The @TeX{} and La@TeX{} math delimiters @samp{$ $}, @samp{$$ $$}, |
34667 You may also wish to test the GNUPLOT interface; to plot a sine wave, | 34730 @samp{\[ \]}, and @samp{\( \)}; |
34668 type @kbd{' [0 ..@: 360], sin(x) @key{RET} g f}. Type @kbd{g q} when you | 34731 @item |
34669 are done viewing the plot. | 34732 Lines beginning with @samp{\begin} and @samp{\end} (except matrix delimiters); |
34670 | 34733 @item |
34671 Calc is now ready to use. If you wish to go through the Calc Tutorial, | 34734 Lines beginning with @samp{@@} (Texinfo delimiters). |
34672 press @kbd{M-# t} to begin. | 34735 @item |
34673 @example | 34736 Lines beginning with @samp{.EQ} and @samp{.EN} (@dfn{eqn} delimiters); |
34674 | 34737 @item |
34675 @end example | 34738 Lines containing a single @samp{%} or @samp{.\"} symbol and nothing else. |
34676 @node Reporting Bugs, Summary, Installation, Top | 34739 @end enumerate |
34740 | |
34741 @item calc-embedded-open-word | |
34742 @itemx calc-embedded-close-word | |
34743 | |
34744 See @ref{Customizing Embedded Mode}.@* | |
34745 The variables @code{calc-embedded-open-word} and | |
34746 @code{calc-embedded-close-word} control the region that Calc will | |
34747 activate when Embedded mode is entered with @kbd{M-# w}. They are | |
34748 regular expressions. | |
34749 | |
34750 The default values of @code{calc-embedded-open-word} and | |
34751 @code{calc-embedded-close-word} are @code{"^\\|[^-+0-9.eE]"} and | |
34752 @code{"$\\|[^-+0-9.eE]"} respectively. | |
34753 | |
34754 @item calc-embedded-open-plain | |
34755 @itemx calc-embedded-close-plain | |
34756 | |
34757 See @ref{Customizing Embedded Mode}.@* | |
34758 The variables @code{calc-embedded-open-plain} and | |
34759 @code{calc-embedded-open-plain} are used to delimit ``plain'' | |
34760 formulas. Note that these are actual strings, not regular | |
34761 expressions, because Calc must be able to write these string into a | |
34762 buffer as well as to recognize them. | |
34763 | |
34764 The default string for @code{calc-embedded-open-plain} is | |
34765 @code{"%%% "}, note the trailing space. The default string for | |
34766 @code{calc-embedded-close-plain} is @code{" %%%\n"}, without | |
34767 the trailing newline here, the first line of a Big mode formula | |
34768 that followed might be shifted over with respect to the other lines. | |
34769 | |
34770 @item calc-embedded-open-new-formula | |
34771 @itemx calc-embedded-close-new-formula | |
34772 | |
34773 See @ref{Customizing Embedded Mode}.@* | |
34774 The variables @code{calc-embedded-open-new-formula} and | |
34775 @code{calc-embedded-close-new-formula} are strings which are | |
34776 inserted before and after a new formula when you type @kbd{M-# f}. | |
34777 | |
34778 The default value of @code{calc-embedded-open-new-formula} is | |
34779 @code{"\n\n"}. If this string begins with a newline character and the | |
34780 @kbd{M-# f} is typed at the beginning of a line, @kbd{M-# f} will skip | |
34781 this first newline to avoid introducing unnecessary blank lines in the | |
34782 file. The default value of @code{calc-embedded-close-new-formula} is | |
34783 also @code{"\n\n"}. The final newline is omitted by @w{@kbd{M-# f}} | |
34784 if typed at the end of a line. (It follows that if @kbd{M-# f} is | |
34785 typed on a blank line, both a leading opening newline and a trailing | |
34786 closing newline are omitted.) | |
34787 | |
34788 @item calc-embedded-open-mode | |
34789 @itemx calc-embedded-close-mode | |
34790 | |
34791 See @ref{Customizing Embedded Mode}.@* | |
34792 The variables @code{calc-embedded-open-mode} and | |
34793 @code{calc-embedded-close-mode} are strings which Calc will place before | |
34794 and after any mode annotations that it inserts. Calc never scans for | |
34795 these strings; Calc always looks for the annotation itself, so it is not | |
34796 necessary to add them to user-written annotations. | |
34797 | |
34798 The default value of @code{calc-embedded-open-mode} is @code{"% "} | |
34799 and the default value of @code{calc-embedded-close-mode} is | |
34800 @code{"\n"}. | |
34801 If you change the value of @code{calc-embedded-close-mode}, it is a good | |
34802 idea still to end with a newline so that mode annotations will appear on | |
34803 lines by themselves. | |
34804 | |
34805 @end table | |
34806 | |
34807 @node Reporting Bugs, Summary, Customizable Variables, Top | |
34677 @appendix Reporting Bugs | 34808 @appendix Reporting Bugs |
34678 | 34809 |
34679 @noindent | 34810 @noindent |
34680 If you find a bug in Calc, send e-mail to Jay Belanger, | 34811 If you find a bug in Calc, send e-mail to Jay Belanger, |
34681 | 34812 |