@copying
This file documents Calc, the GNU Emacs calculator.
-Copyright (C) 1990, 1991, 2001, 2002, 2005 Free Software Foundation, Inc.
+Copyright (C) 1990, 1991, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being just ``GNU GENERAL PUBLIC LICENSE'', with the
Front-Cover texts being ``A GNU Manual,'' and with the Back-Cover
@page
@vskip 0pt plus 1filll
-Copyright @copyright{} 1990, 1991, 2001, 2002, 2005
-Free Software Foundation, Inc.
+Copyright @copyright{} 1990, 1991, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
@insertcopying
@end titlepage
@display
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@end smallexample
Also add information on how to contact you by electronic and paper mail.
* What is Calc::
* About This Manual::
* Notations Used in This Manual::
-* Using Calc::
* Demonstration of Calc::
+* Using Calc::
* History and Acknowledgements::
@end menu
(If you don't have the @key{LFD} or @key{TAB} keys on your keyboard,
the @kbd{C-j} and @kbd{C-i} keys are equivalent to them, respectively.
If you don't have a Meta key, look for Alt or Extend Char. You can
-also press @key{ESC} or @key{C-[} first to get the same effect, so
+also press @key{ESC} or @kbd{C-[} first to get the same effect, so
that @kbd{M-x}, @kbd{@key{ESC} x}, and @kbd{C-[ x} are all equivalent.)
Sometimes the @key{RET} key is not shown when it is ``obvious''
To begin, start Emacs if necessary (usually the command @code{emacs}
does this), and type @kbd{M-# c} (or @kbd{@key{ESC} # c}) to start the
-Calculator. (@xref{Starting Calc}, if this doesn't work for you.)
+Calculator. (You can also use @kbd{M-x calc} if this doesn't work.
+@xref{Starting Calc}, for various ways of starting the Calculator.)
Be sure to type all the sample input exactly, especially noting the
difference between lower-case and upper-case letters. Remember,
Control or @key{CTRL} while typing a left square bracket
(that's @kbd{C-[} in Emacs notation).
-@kbd{M-#} is a @dfn{prefix key}; when you press it, 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 which Calc interface you
-want to use.
+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
+which Calc interface you want to use.
To get Calc's standard interface, type @kbd{M-# c}. To get
Keypad mode, type @kbd{M-# k}. Type @kbd{M-# ?} to get a brief
@end smallexample
To leave Embedded mode, type @kbd{M-# e} again. The mode line
-and keyboard will revert to the way they were before. (If you have
-actually been trying this as you read along, you'll want to press
-@kbd{M-# 0} [with the digit zero] now to reset the modes you changed.)
+and keyboard will revert to the way they were before.
The related command @kbd{M-# w} operates on a single word, which
generally means a single number, inside text. It uses any
@item 0
(This is the ``zero'' digit key.) Reset the Calculator to
-its default state: Empty stack, and default mode settings.
-With any prefix argument, reset everything but the stack.
+its initial state: Empty stack, and initial mode settings.
@end table
@node History and Acknowledgements, , Using Calc, Getting Started
features, large and small. A few deserve special mention: Tim Peters,
who helped develop the ideas that led to the selection commands, rewrite
rules, and many other algebra features;
-@texline Fran\c cois
+@texline Fran\c{c}ois
@infoline Francois
Pinard, who contributed an early prototype of the Calc Summary appendix
as well as providing valuable suggestions in many other areas of Calc;
If your system has the GNUPLOT program, you can see graphs of your
data and your straight line to see how well they match. (If you have
-GNUPLOT 3.0, the following instructions will work regardless of the
-kind of display you have. Some GNUPLOT 2.0, non-X-windows systems
+GNUPLOT 3.0 or higher, the following instructions will work regardless
+of the kind of display you have. Some GNUPLOT 2.0, non-X-windows systems
may require additional steps to view the graphs.)
Let's start by plotting the original data. Recall the ``@var{x}'' and ``@var{y}''
get a special ``dimensioned'' Matrix mode in which matrices of
unknown size are assumed to be @var{n}x@var{n} square matrices.
Then, the function call @samp{idn(1)} will expand into an actual
-matrix rather than representing a ``generic'' matrix.
+matrix rather than representing a ``generic'' matrix. Simply typing
+@kbd{C-u m v} will get you a square Matrix mode, in which matrices of
+unknown size are assumed to be square matrices of unspecified size.
@cindex Declaring scalar variables
Of course these modes are approximations to the true state of
The value is a vector.
@item matrix
The value is a matrix (a rectangular vector of vectors).
+@item sqmatrix
+The value is a square matrix.
@end table
These type symbols can be combined with the other type symbols
@item
Matrix/Scalar mode. Default value is @mathit{-1}. Value is 0 for Scalar
-mode, @mathit{-2} for Matrix mode, or @var{N} for
+mode, @mathit{-2} for Matrix mode, @mathit{-3} for square Matrix mode,
+or @var{N} for
@texline @math{N\times N}
@infoline @var{N}x@var{N}
Matrix mode. Command is @kbd{m v}.
Matrix mode (@kbd{m v}; @pxref{Matrix Mode}).
@item Matrix@var{n}
-Dimensioned Matrix mode (@kbd{C-u @var{n} m v}).
+Dimensioned Matrix mode (@kbd{C-u @var{n} m v}; @pxref{Matrix Mode}).
+
+@item SqMatrix
+Square Matrix mode (@kbd{C-u m v}; @pxref{Matrix Mode}).
@item Scalar
Scalar mode (@kbd{m v}; @pxref{Matrix Mode}).
falls in this hour results in a time value for the following hour,
from 3 a.m.@: to 4 a.m. At the end of daylight savings time, the
hour from 1 a.m.@: to 2 a.m.@: repeats itself; converting a date/time
-form that falls in in this hour results in a time value for the first
+form that falls in this hour results in a time value for the first
manifestation of that time (@emph{not} the one that occurs one hour later).
If @code{math-daylight-savings-hook} is @code{nil}, then the
@tindex integ
The @kbd{a i} (@code{calc-integral}) [@code{integ}] command computes the
indefinite integral of the expression on the top of the stack with
-respect to a variable. The integrator is not guaranteed to work for
-all integrable functions, but it is able to integrate several large
-classes of formulas. In particular, any polynomial or rational function
-(a polynomial divided by a polynomial) is acceptable. (Rational functions
-don't have to be in explicit quotient form, however;
+respect to a prompted-for variable. The integrator is not guaranteed to
+work for all integrable functions, but it is able to integrate several
+large classes of formulas. In particular, any polynomial or rational
+function (a polynomial divided by a polynomial) is acceptable.
+(Rational functions don't have to be in explicit quotient form, however;
@texline @math{x/(1+x^{-2})}
@infoline @expr{x/(1+x^-2)}
is not strictly a quotient of polynomials, but it is equivalent to
integrated. Finally, rational functions involving trigonometric or
hyperbolic functions can be integrated.
+With an argument (@kbd{C-u a i}), this command will compute the definite
+integral of the expression on top of the stack. In this case, the
+command will again prompt for an integration variable, then prompt for a
+lower limit and an upper limit.
+
@ifinfo
If you use the @code{integ} function directly in an algebraic formula,
you can also write @samp{integ(f,x,v)} which expresses the resulting
variable and the lefthand side is a number (as in @samp{2.34 = x}), then
Calc keeps the lefthand side instead. Finally, this command works with
assignments @samp{x := 2.34} as well as equations, always taking the
-the righthand side, and for @samp{=>} (evaluates-to) operators, always
+righthand side, and for @samp{=>} (evaluates-to) operators, always
taking the lefthand side.
@kindex a &
@noindent
The commands for graphing data begin with the @kbd{g} prefix key. Calc
-uses GNUPLOT 2.0 or 3.0 to do graphics. These commands will only work
+uses GNUPLOT 2.0 or later to do graphics. These commands will only work
if GNUPLOT is available on your system. (While GNUPLOT sounds like
a relative of GNU Emacs, it is actually completely unrelated.
-However, it is free software and can be obtained from the Free
-Software Foundation's machine @samp{prep.ai.mit.edu}.)
+However, it is free software. It can be obtained from
+@samp{http://www.gnuplot.info}.)
@vindex calc-gnuplot-name
If you have GNUPLOT installed on your system but Calc is unable to
variables to show Calc how to run GNUPLOT on your system; these
are described under @kbd{g D} and @kbd{g O} below. If you are
using the X window system, Calc will configure GNUPLOT for you
-automatically. If you have GNUPLOT 3.0 and you are not using X,
+automatically. If you have GNUPLOT 3.0 or later and you are not using X,
Calc will configure GNUPLOT to display graphs using simple character
graphics that will work on any terminal.
at coordinate @expr{(x_i, y_j)} on the surface. The 3D graph will
be displayed from a certain default viewpoint; you can change this
viewpoint by adding a @samp{set view} to the @samp{*Gnuplot Commands*}
-buffer as described later. See the GNUPLOT 3.0 documentation for a
+buffer as described later. See the GNUPLOT documentation for a
description of the @samp{set view} command.
Each point in the matrix will be displayed as a dot in the graph,
on their own separate lines or in-line with the formula.
If you give a positive or negative numeric prefix argument, Calc
-instead uses the current point as one end of the formula, and moves
-forward or backward (respectively) by that many lines to find the
-other end. Explicit delimiters are not necessary in this case.
+instead uses the current point as one end of the formula, and includes
+that many lines forward or backward (respectively, including the current
+line). Explicit delimiters are not necessary in this case.
-With a prefix argument of zero, Calc uses the current region
-(delimited by point and mark) instead of formula delimiters.
+With a prefix argument of zero, Calc uses the current region (delimited
+by point and mark) instead of formula delimiters. With a prefix
+argument of @kbd{C-u} only, Calc uses the current line as the formula.
@kindex M-# w
@pindex calc-embedded-word
-With a prefix argument of @kbd{C-u} only, Calc scans for the first
-non-numeric character (i.e., the first character that is not a
-digit, sign, decimal point, or upper- or lower-case @samp{e})
-forward and backward to delimit the formula. @kbd{M-# w}
-(@code{calc-embedded-word}) is equivalent to @kbd{C-u M-# e}.
+The @kbd{M-# w} (@code{calc-embedded-word}) command will start Embedded
+mode on the current ``word''; in this case Calc will scan for the first
+non-numeric character (i.e., the first character that is not a digit,
+sign, decimal point, or upper- or lower-case @samp{e}) forward and
+backward to delimit the formula.
When you enable Embedded mode for a formula, Calc reads the text
between the delimiters and tries to interpret it as a Calc formula.
by default. This notation has the advantage that the @samp{%}
character begins a comment in @TeX{} and La@TeX{}, so if your formula is
embedded in a @TeX{} or La@TeX{} document its plain version will be
-invisible in the final printed copy. @xref{Customizing
-Embedded Mode}, to see how to change the ``plain'' formula
-delimiters, say to something that @dfn{eqn} or some other
-formatter will treat as a comment.
+invisible in the final printed copy. Certain major modes have different
+delimiters to ensure that the ``plain'' version will be
+in a comment for those modes, also.
+See @ref{Customizing Embedded Mode} to see how to change the ``plain''
+formula delimiters.
There are several notations which Calc's parser for ``big''
formatted formulas can't yet recognize. In particular, it can't
@kindex M-# u
@kindex M-# =
-@pindex calc-embedded-update
+@pindex calc-embedded-update-formula
Another way to change the assignment to @code{foo} would simply be
to edit the number using regular Emacs editing rather than Embedded
mode. Then, we have to find a way to get Embedded mode to notice
below).
The scan does not look for the leading @samp{% }, only for the
-square brackets and the text they enclose. You can edit the mode
-annotations to a style that works better in context if you wish.
+square brackets and the text they enclose. In fact, the leading
+characters are different for different major modes. You can edit the
+mode annotations to a style that works better in context if you wish.
@xref{Customizing Embedded Mode}, to see how to change the style
that Calc uses when it generates the annotations. You can write
mode annotations into the file yourself if you know the syntax;
variables described here. These variables are customizable
(@pxref{Customizable Variables}), or you can use @kbd{M-x set-variable}
or @kbd{M-x edit-options} to adjust a variable on the fly.
-(Another possibility would
-be to use a file-local variable annotation at the end of the
-file; @pxref{File Variables, , Local Variables in Files, emacs, the
-Emacs manual}.)
-
-While none of these variables will be buffer-local by default, you
-can make any of them local to any Embedded mode buffer. (Their
-values in the @samp{*Calculator*} buffer are never used.)
+(Another possibility would be to use a file-local variable annotation at
+the end of the file;
+@pxref{File Variables, , Local Variables in Files, emacs, the Emacs manual}.)
+Many of the variables given mentioned here can be set to depend on the
+major mode of the editing buffer (@pxref{Customizable Variables}).
@vindex calc-embedded-open-formula
The @code{calc-embedded-open-formula} variable holds a regular
formula when @kbd{d p} mode is turned on. Note that this is an
actual string, not a regular expression, because Calc must be able
to write this string into a buffer as well as to recognize it.
-The default string is @code{"%%% "} (note the trailing space).
+The default string is @code{"%%% "} (note the trailing space), but may
+be different for certain major modes.
@vindex calc-embedded-close-plain
The @code{calc-embedded-close-plain} variable is a string which
-ends a ``plain'' formula. The default is @code{" %%%\n"}. Without
+ends a ``plain'' formula. The default is @code{" %%%\n"}, but may be
+different for different major modes. Without
the trailing newline here, the first line of a Big mode formula
that followed might be shifted over with respect to the other lines.
all, blank lines are considered formula delimiters by default!
But if your language includes a delimiter which can only occur
actually in front of a formula, you can take advantage of it here.
-The default pattern is @code{"%Embed\n\\(% .*\n\\)*"}, which
-checks for @samp{%Embed} followed by any number of lines beginning
-with @samp{%} and a space. This last is important to make Calc
-consider mode annotations part of the pattern, so that the formula's
-opening delimiter really is sure to follow the pattern.
+The default pattern is @code{"%Embed\n\\(% .*\n\\)*"}, but may be
+different for different major modes.
+This pattern will check for @samp{%Embed} followed by any number of
+lines beginning with @samp{%} and a space. This last is important to
+make Calc consider mode annotations part of the pattern, so that the
+formula's opening delimiter really is sure to follow the pattern.
@vindex calc-embedded-open-mode
The @code{calc-embedded-open-mode} variable is a string (not a
Calc never scans for this string; Calc always looks for the
annotation itself. But this is the string that is inserted before
the opening bracket when Calc adds an annotation on its own.
-The default is @code{"% "}.
+The default is @code{"% "}, but may be different for different major
+modes.
@vindex calc-embedded-close-mode
The @code{calc-embedded-close-mode} variable is a string which
follows a mode annotation written by Calc. Its default value
-is simply a newline, @code{"\n"}. If you change this, it is a
-good idea still to end with a newline so that mode annotations
-will appear on lines by themselves.
+is simply a newline, @code{"\n"}, but may be different for different
+major modes. If you change this, it is a good idea still to end with a
+newline so that mode annotations will appear on lines by themselves.
@node Programming, Customizable Variables, Embedded Mode, Top
@chapter Programming
accept numbers or formulas as interactive input.
As an example,
-@kbd{2 @key{RET} "Power: " @key{RET} Z # 3 @key{RET}} will prompt for
+@kbd{2 @key{RET} "Power: " @key{RET} Z # 3 @key{RET} ^} will prompt for
input with ``Power: '' in the minibuffer, then return 2 to the provided
power. (The response to the prompt that's given, 3 in this example,
will not be part of the macro.)
the absolute values of the components.
@end defun
-@findex two-pi
+@findex e
+@findex gamma-const
+@findex ln-2
+@findex ln-10
+@findex phi
@findex pi-over-2
@findex pi-over-4
@findex pi-over-180
@findex sqrt-two-pi
@findex sqrt-e
-@findex e
-@findex ln-2
-@findex ln-10
+@findex two-pi
@defun pi
The function @samp{(pi)} computes @samp{pi} to the current precision.
Other related constant-generating functions are @code{two-pi},
@code{pi-over-2}, @code{pi-over-4}, @code{pi-over-180}, @code{sqrt-two-pi},
-@code{e}, @code{sqrt-e}, @code{ln-2}, and @code{ln-10}. Each function
-returns a floating-point value in the current precision, and each uses
-caching so that all calls after the first are essentially free.
+@code{e}, @code{sqrt-e}, @code{ln-2}, @code{ln-10}, @code{phi} and
+@code{gamma-const}. Each function returns a floating-point value in the
+current precision, and each uses caching so that all calls after the
+first are essentially free.
@end defun
@defmac math-defcache @var{func} @var{initial} @var{form}
@end defvar
@defvar calc-window-hook
-If this hook exists, it is called to create the Calc window.
+If this hook is non-@code{nil}, it is called to create the Calc window.
Upon return, this new Calc window should be the current window.
(The Calc buffer will already be the current buffer when the
hook is called.) If the hook is not defined, Calc will
@end defvar
@defvar calc-trail-window-hook
-If this hook exists, it is called to create the Calc Trail window.
-The variable @code{calc-trail-buffer} will contain the buffer
-which the window should use. Unlike @code{calc-window-hook},
-this hook must @emph{not} switch into the new window.
+If this hook is non-@code{nil}, it is called to create the Calc Trail
+window. The variable @code{calc-trail-buffer} will contain the buffer
+which the window should use. Unlike @code{calc-window-hook}, this hook
+must @emph{not} switch into the new window.
+@end defvar
+
+@defvar calc-embedded-mode-hook
+This hook is called the first time that Embedded mode is entered.
+@end defvar
+
+@defvar calc-embedded-new-buffer-hook
+This hook is called each time that Embedded mode is entered in a
+new buffer.
+@end defvar
+
+@defvar calc-embedded-new-formula-hook
+This hook is called each time that Embedded mode is enabled for a
+new formula.
@end defvar
@defvar calc-edit-mode-hook
See @ref{Regexp Search,, Regular Expression Search, emacs, The GNU Emacs Manual}
to see how regular expressions work.
-@table @code
-
-@item calc-settings-file
-
-@vindex calc-settings-file
+@defvar calc-settings-file
The variable @code{calc-settings-file} holds the file name in
which commands like @kbd{m m} and @kbd{Z P} store ``permanent''
definitions.
exists) the first time Calc is invoked.
The default value for this variable is @code{"~/.calc.el"}.
+@end defvar
-@item calc-gnuplot-name
-
+@defvar calc-gnuplot-name
See @ref{Graphics}.@*
The variable @code{calc-gnuplot-name} should be the name of the
GNUPLOT program (a string). If you have GNUPLOT installed on your
You may also need to set some Lisp variables to show Calc how to run
GNUPLOT on your system, see @ref{Devices, ,Graphical Devices} . The default value
of @code{calc-gnuplot-name} is @code{"gnuplot"}.
+@end defvar
-@item calc-gnuplot-plot-command
-@itemx calc-gnuplot-print-command
-
+@defvar calc-gnuplot-plot-command
+@defvarx calc-gnuplot-print-command
See @ref{Devices, ,Graphical Devices}.@*
The variables @code{calc-gnuplot-plot-command} and
@code{calc-gnuplot-print-command} represent system commands to
The default value of @code{calc-gnuplot-plot-command} is @code{nil},
and the default value of @code{calc-gnuplot-print-command} is
@code{"lp %s"}.
+@end defvar
-@item calc-language-alist
-
+@defvar calc-language-alist
See @ref{Basic Embedded Mode}.@*
The variable @code{calc-language-alist} controls the languages that
Calc will associate with major modes. When Calc embedded mode is
(fortran-mode . fortran)
(f90-mode . fortran))
@end example
+@end defvar
-@item calc-embedded-announce-formula
-
+@defvar calc-embedded-announce-formula
+@defvarx calc-embedded-announce-formula-alist
See @ref{Customizing Embedded Mode}.@*
The variable @code{calc-embedded-announce-formula} helps determine
what formulas @kbd{M-# a} will activate in a buffer. It is a
for @samp{%Embed} followed by any number of lines beginning with
@samp{%} and a space.
-@item calc-embedded-open-formula
-@itemx calc-embedded-close-formula
+The variable @code{calc-embedded-announce-formula-alist} is used to
+set @code{calc-embedded-announce-formula} to different regular
+expressions depending on the major mode of the editing buffer.
+It consists of a list of pairs of the form @code{(@var{MAJOR-MODE} .
+@var{REGEXP})}, and its default value is
+@example
+ ((c++-mode . "//Embed\n\\(// .*\n\\)*")
+ (c-mode . "/\\*Embed\\*/\n\\(/\\* .*\\*/\n\\)*")
+ (f90-mode . "!Embed\n\\(! .*\n\\)*")
+ (fortran-mode . "C Embed\n\\(C .*\n\\)*")
+ (html-helper-mode . "<!-- Embed -->\n\\(<!-- .* -->\n\\)*")
+ (html-mode . "<!-- Embed -->\n\\(<!-- .* -->\n\\)*")
+ (nroff-mode . "\\\\\"Embed\n\\(\\\\\" .*\n\\)*")
+ (pascal-mode . "@{Embed@}\n\\(@{.*@}\n\\)*")
+ (sgml-mode . "<!-- Embed -->\n\\(<!-- .* -->\n\\)*")
+ (xml-mode . "<!-- Embed -->\n\\(<!-- .* -->\n\\)*")
+ (texinfo-mode . "@@c Embed\n\\(@@c .*\n\\)*"))
+@end example
+Any major modes added to @code{calc-embedded-announce-formula-alist}
+should also be added to @code{calc-embedded-open-close-plain-alist}
+and @code{calc-embedded-open-close-mode-alist}.
+@end defvar
+@defvar calc-embedded-open-formula
+@defvarx calc-embedded-close-formula
+@defvarx calc-embedded-open-close-formula-alist
See @ref{Customizing Embedded Mode}.@*
The variables @code{calc-embedded-open-formula} and
@code{calc-embedded-open-formula} control the region that Calc will
Lines containing a single @samp{%} or @samp{.\"} symbol and nothing else.
@end enumerate
-@item calc-embedded-open-word
-@itemx calc-embedded-close-word
+The variable @code{calc-embedded-open-close-formula-alist} is used to
+set @code{calc-embedded-open-formula} and
+@code{calc-embedded-close-formula} to different regular
+expressions depending on the major mode of the editing buffer.
+It consists of a list of lists of the form
+@code{(@var{MAJOR-MODE} @var{OPEN-FORMULA-REGEXP}
+@var{CLOSE-FORMULA-REGEXP})}, and its default value is
+@code{nil}.
+@end defvar
+@defvar calc-embedded-open-word
+@defvarx calc-embedded-close-word
+@defvarx calc-embedded-open-close-word-alist
See @ref{Customizing Embedded Mode}.@*
The variables @code{calc-embedded-open-word} and
@code{calc-embedded-close-word} control the region that Calc will
@code{calc-embedded-close-word} are @code{"^\\|[^-+0-9.eE]"} and
@code{"$\\|[^-+0-9.eE]"} respectively.
-@item calc-embedded-open-plain
-@itemx calc-embedded-close-plain
+The variable @code{calc-embedded-open-close-word-alist} is used to
+set @code{calc-embedded-open-word} and
+@code{calc-embedded-close-word} to different regular
+expressions depending on the major mode of the editing buffer.
+It consists of a list of lists of the form
+@code{(@var{MAJOR-MODE} @var{OPEN-WORD-REGEXP}
+@var{CLOSE-WORD-REGEXP})}, and its default value is
+@code{nil}.
+@end defvar
+@defvar calc-embedded-open-plain
+@defvarx calc-embedded-close-plain
+@defvarx calc-embedded-open-close-plain-alist
See @ref{Customizing Embedded Mode}.@*
The variables @code{calc-embedded-open-plain} and
@code{calc-embedded-open-plain} are used to delimit ``plain''
the trailing newline here, the first line of a Big mode formula
that followed might be shifted over with respect to the other lines.
-@item calc-embedded-open-new-formula
-@itemx calc-embedded-close-new-formula
+The variable @code{calc-embedded-open-close-plain-alist} is used to
+set @code{calc-embedded-open-plain} and
+@code{calc-embedded-close-plain} to different strings
+depending on the major mode of the editing buffer.
+It consists of a list of lists of the form
+@code{(@var{MAJOR-MODE} @var{OPEN-PLAIN-STRING}
+@var{CLOSE-PLAIN-STRING})}, and its default value is
+@example
+ ((c++-mode "// %% " " %%\n")
+ (c-mode "/* %% " " %% */\n")
+ (f90-mode "! %% " " %%\n")
+ (fortran-mode "C %% " " %%\n")
+ (html-helper-mode "<!-- %% " " %% -->\n")
+ (html-mode "<!-- %% " " %% -->\n")
+ (nroff-mode "\\\" %% " " %%\n")
+ (pascal-mode "@{%% " " %%@}\n")
+ (sgml-mode "<!-- %% " " %% -->\n")
+ (xml-mode "<!-- %% " " %% -->\n")
+ (texinfo-mode "@@c %% " " %%\n"))
+@end example
+Any major modes added to @code{calc-embedded-open-close-plain-alist}
+should also be added to @code{calc-embedded-announce-formula-alist}
+and @code{calc-embedded-open-close-mode-alist}.
+@end defvar
+@defvar calc-embedded-open-new-formula
+@defvarx calc-embedded-close-new-formula
+@defvarx calc-embedded-open-close-new-formula-alist
See @ref{Customizing Embedded Mode}.@*
The variables @code{calc-embedded-open-new-formula} and
@code{calc-embedded-close-new-formula} are strings which are
typed on a blank line, both a leading opening newline and a trailing
closing newline are omitted.)
-@item calc-embedded-open-mode
-@itemx calc-embedded-close-mode
+The variable @code{calc-embedded-open-close-new-formula-alist} is used to
+set @code{calc-embedded-open-new-formula} and
+@code{calc-embedded-close-new-formula} to different strings
+depending on the major mode of the editing buffer.
+It consists of a list of lists of the form
+@code{(@var{MAJOR-MODE} @var{OPEN-NEW-FORMULA-STRING}
+@var{CLOSE-NEW-FORMULA-STRING})}, and its default value is
+@code{nil}.
+@end defvar
+@defvar calc-embedded-open-mode
+@defvarx calc-embedded-close-mode
+@defvarx calc-embedded-open-close-mode-alist
See @ref{Customizing Embedded Mode}.@*
The variables @code{calc-embedded-open-mode} and
@code{calc-embedded-close-mode} are strings which Calc will place before
idea still to end with a newline so that mode annotations will appear on
lines by themselves.
-@end table
+The variable @code{calc-embedded-open-close-mode-alist} is used to
+set @code{calc-embedded-open-mode} and
+@code{calc-embedded-close-mode} to different strings
+expressions depending on the major mode of the editing buffer.
+It consists of a list of lists of the form
+@code{(@var{MAJOR-MODE} @var{OPEN-MODE-STRING}
+@var{CLOSE-MODE-STRING})}, and its default value is
+@example
+ ((c++-mode "// " "\n")
+ (c-mode "/* " " */\n")
+ (f90-mode "! " "\n")
+ (fortran-mode "C " "\n")
+ (html-helper-mode "<!-- " " -->\n")
+ (html-mode "<!-- " " -->\n")
+ (nroff-mode "\\\" " "\n")
+ (pascal-mode "@{ " " @}\n")
+ (sgml-mode "<!-- " " -->\n")
+ (xml-mode "<!-- " " -->\n")
+ (texinfo-mode "@@c " "\n"))
+@end example
+Any major modes added to @code{calc-embedded-open-close-mode-alist}
+should also be added to @code{calc-embedded-announce-formula-alist}
+and @code{calc-embedded-open-close-plain-alist}.
+@end defvar
@node Reporting Bugs, Summary, Customizable Variables, Top
@appendix Reporting Bugs
@r{ @: M-# r @: @: 36 @:calc-grab-rectangle@:}
@r{ @: M-# s @: @: @:calc-info-summary@:}
@r{ @: M-# t @: @: @:calc-tutorial@:}
-@r{ @: M-# u @: @: @:calc-embedded-update@:}
+@r{ @: M-# u @: @: @:calc-embedded-update-formula@:}
@r{ @: M-# w @: @: @:calc-embedded-word@:}
@r{ @: M-# x @: @: @:calc-quit@:}
@r{ @: M-# y @: @:1,28,49 @:calc-copy-to-buffer@:}
@r{ @: M-# z @: @: @:calc-user-invocation@:}
+@r{ @: M-# = @: @: @:calc-embedded-update-formula@:}
@r{ @: M-# : @: @: 36 @:calc-grab-sum-down@:}
@r{ @: M-# _ @: @: 36 @:calc-grab-sum-across@:}
@r{ @: M-# ` @:editing @: 30 @:calc-embedded-edit@:}