The s e (calc-edit-variable
) command edits the stored
value of a variable without ever putting that value on the stack
or simplifying or evaluating the value. It prompts for the name of
the variable to edit. If the variable has no stored value, the
editing buffer will start out empty. If the editing buffer is
empty when you press M-# M-# to finish, the variable will
be made void. See section Editing Stack Entries, for a general
description of editing.
The s e command is especially useful for creating and editing
rewrite rules which are stored in variables. Sometimes these rules
contain formulas which must not be evaluated until the rules are
actually used. (For example, they may refer to `deriv(x,y)',
where x
will someday become some expression involving y
;
if you let Calc evaluate the rule while you are defining it, Calc will
replace `deriv(x,y)' with 0 because the formula x
does
not itself refer to y
.) By contrast, recalling the variable,
editing with `, and storing will evaluate the variable's value
as a side effect of putting the value on the stack.
There are several special-purpose variable-editing commands that use the s prefix followed by a shifted letter:
AlgSimpRules
. See section Algebraic Simplifications.
Decls
. See section Declarations.
EvalRules
. See section Default Simplifications.
FitRules
. See section Curve Fitting.
GenCount
. See section Solving Equations.
Holidays
. See section Business Days.
IntegLimit
. See section Calculus.
LineStyles
. See section Graphics.
PointStyles
. See section Graphics.
PlotRejects
. See section Graphics.
TimeZone
. See section Time Zones.
Units
. See section User-Defined Units.
ExtSimpRules
. See section "Unsafe" Simplifications.
These commands are just versions of s e that use fixed variable names rather than prompting for the variable name.
The s p (calc-permanent-variable
) command saves a
variable's value permanently in your `.emacs' file, so that its
value will still be available in future Emacs sessions. You can
re-execute s p later on to update the saved value, but the
only way to remove a saved variable is to edit your `.emacs' file
by hand. (See section General Mode Commands, for a way to tell Calc to
use a different file instead of `.emacs'.)
If you do not specify the name of a variable to save (i.e.,
s p RET), all `var-' variables with defined values
are saved except for the special constants pi
, e
,
i
, phi
, and gamma
; the variables TimeZone
and PlotRejects
;
FitRules
, DistribRules
, and other built-in rewrite
rules; and PlotDatan
variables generated
by the graphics commands. (You can still save these variables by
explicitly naming them in an s p command.)
The s i (calc-insert-variables
) command writes
the values of all `var-' variables into a specified buffer.
The variables are written in the form of Lisp setq
commands
which store the values in string form. You can place these commands
in your `.emacs' buffer if you wish, though in this case it
would be easier to use s p RET. (Note that s i
omits the same set of variables as s p RET; the difference
is that s i will store the variables in any buffer, and it also
stores in a more human-readable format.)