File: calc.el.html

Calc is split into many files. This file is the main entry point.

This file includes autoload commands for various other basic Calc facilities. The more advanced features are based in calc-ext, which in turn contains autoloads for the rest of the Calc files. This odd set of interactions is designed to make Calc's loading time be as short as possible when only simple calculations are needed.

Original author's address:
 Dave Gillespie, daveg@synaptics.com, uunet!synaptx!daveg.
 Synaptics, Inc., 2698 Orchard Parkway, San Jose, CA 95134.

The old address daveg@csvax.cs.caltech.edu will continue to work for the foreseeable future.

Bug reports and suggestions are always welcome! (Type M-x
report-emacs-bug to send them).

All functions, macros, and Lisp variables defined here begin with one of the prefixes "math", "Math", or "calc", with the exceptions of
"full-calc", "full-calc-keypad", "another-calc", "quick-calc",
and "defmath". User-accessible variables begin with "var-".

Defined variables (169)

calc-Y-help-msgsList of strings for Y prefix help.
calc-algebraic-modeIf non-nil, numeric entry accepts whole algebraic expressions.
calc-always-load-extensionsIf non-nil, load the calc-ext module automatically when Calc is loaded.
calc-angle-modeIf deg, angles are in degrees; if rad, angles are in radians.
calc-any-selectionsNon-nil if there are selections present.
calc-assoc-selectionsIf non-nil, selection hides deep structure of associative formulas.
calc-auto-recomputeIf non-nil, recompute evalto’s automatically when necessary.
calc-auto-whyIf non-nil, automatically execute a "why" command to explain odd results.
calc-autorange-unitsIf non-nil, automatically set unit prefixes to keep units in a reasonable range.
calc-break-vectorsIf non-nil, display vectors one element per line.
calc-buffer-listA list of all Calc buffers.
calc-bug-addressAddress of mailing list for GNU Emacs bugs.
calc-complex-formatFormat to use for display of complex numbers in calc-mode. Must be one of:
calc-complex-modePreferred form, either ‘cplx’ or ‘polar’, for complex numbers.
calc-context-sensitive-enterIf non-nil, the stack element under the cursor will be copied by ‘calc-enter’
calc-date-formatFormat of displayed date forms.
calc-digit-after-pointIf t, display at least one digit after the decimal point, as in ‘12.0’.
calc-digit-mapThe key map for entering Calc digits.
calc-dispatch-mapThe key map for starting Calc.
calc-display-dirtyNon-nil if the stack display might not reflect the latest mode settings.
calc-display-justIf nil, stack display is left-justified.
calc-display-originHorizontal origin of displayed stack entries.
calc-display-rawIf non-nil, display shows unformatted Lisp exprs. (For debugging)
calc-display-sci-highFloating-point numbers with this positive exponent or higher above the
calc-display-sci-lowFloating-point numbers with this negative exponent or lower are displayed
calc-display-stringsIf non-nil, display vectors of byte-sized integers as strings.
calc-display-trailIf non-nil, M-x calc creates a window to display Calculator trail.
calc-display-working-messageIf non-nil, display "Working..." for potentially slow Calculator commands.
calc-dollar-usedThe highest order of ‘$’ that occurred.
calc-dollar-valuesValues to be used for ‘$’.
calc-embedded-announce-formulaA regular expression which is sure to be followed by a ‘calc-embedded’ formula.
calc-embedded-announce-formula-alistAlist of major modes for ‘calc-embedded-announce-formula’.
calc-embedded-close-formulaRegexp for the closing delimiter of a formula used by ‘calc-embedded’.
calc-embedded-close-modeA string which should follow ‘calc-embedded’ mode annotations.
calc-embedded-close-new-formulaA string which is inserted at end of formula by calc-embedded-new-formula.
calc-embedded-close-plainA string which is the closing delimiter for a "plain" formula.
calc-embedded-infoIf non-nil, a vector consisting of information for embedded mode.
calc-embedded-mode-hookHook run when starting embedded mode.
calc-embedded-new-buffer-hookHook run when starting embedded mode in a new buffer.
calc-embedded-new-formula-hookHook run when starting embedded mode in a new formula.
calc-embedded-open-close-formula-alistAlist of major modes with pairs of formula delimiters used by ‘calc-embedded’.
calc-embedded-open-close-mode-alistAlist of major modes with pairs of strings to delimit annotations.
calc-embedded-open-close-new-formula-alistAlist of major modes with pairs of new formula delimiters used by calc-embedded.
calc-embedded-open-close-plain-alistAlist of major modes with pairs of delimiters for "plain" formulas.
calc-embedded-open-formulaRegexp for the opening delimiter of a formula used by ‘calc-embedded’.
calc-embedded-open-modeA string which should precede ‘calc-embedded’ mode annotations.
calc-embedded-open-new-formulaA string which is inserted at front of formula by calc-embedded-new-formula.
calc-embedded-open-plainA string which is the opening delimiter for a "plain" formula.
calc-embedded-word-regexpA regular expression determining a word for calc-embedded-word.
calc-embedded-word-regexp-alistAlist of major modes with word regexps used by calc-embedded-word.
calc-end-hookHook run when calc is quit.
calc-ensure-consistent-unitsIf non-nil, ensure new units are consistent with current units when converting.
calc-executing-macroNon-nil if a keyboard macro is executing from the "K" key.
calc-float-formatFormat to use for display of floating-point numbers in calc-mode.
calc-frac-formatFormat of displayed fractions; a string of one or two of ":" or "/".
calc-full-float-formatFormat to use when full precision must be displayed.
calc-full-help-flagNon-nil if ‘calc-full-help’ is being executed.
calc-full-modeNon-nil if Calc was last invoked in full-screen mode.
calc-full-trail-vectorsIf non-nil, display long vectors in full in the trail.
calc-full-vectorsIf non-nil, display long vectors in full. If nil, use abbreviated form.
calc-function-closeClose-parenthesis string for function call notation.
calc-function-openOpen-parenthesis string for function call notation.
calc-gnuplot-default-deviceThe default device name for GNUPLOT plotting.
calc-gnuplot-default-outputThe default output file for GNUPLOT plotting.
calc-gnuplot-geometryThe default geometry for the GNUPLOT window.
calc-gnuplot-nameName of GNUPLOT program, for calc-graph features.
calc-gnuplot-plot-commandName of command for displaying GNUPLOT output; %s = file name to print.
calc-gnuplot-print-commandName of command for printing GNUPLOT output; %s = file name to print.
calc-gnuplot-print-deviceThe default device name for GNUPLOT printing.
calc-gnuplot-print-outputThe default output for GNUPLOT printing.
calc-graph-default-resolutionThe default number of data points when plotting curves.
calc-graph-default-resolution-3dThe default number of x- and y- data points when plotting surfaces.
calc-gregorian-switchThe first day the Gregorian calendar is used by Calc’s date forms.
calc-group-charThe character (in the form of a string) to be used for grouping digits.
calc-group-digitsIf non-nil, group digits in large displayed integers by inserting spaces.
calc-hashes-usedThe highest order of ‘#’ that occurred.
calc-help-phaseThe number of consecutive "?" keystrokes.
calc-highlight-selections-with-facesIf non-nil, use a separate face to indicate selected sub-formulas.
calc-hms-formatFormat of displayed hours-minutes-seconds angles, a format string.
calc-hyperbolic-flagIf non-nil, next operation is Hyperbolic.
calc-incomplete-algebraic-modeLike calc-algebraic-mode except only affects ( and [ keys.
calc-infinite-modeIf nil, 1 / 0 is left unsimplified.
calc-inhibit-startup-messageIf non-nil, inhibit the Calc startup message.
calc-internal-precNumber of digits of internal precision for calc-mode calculations.
calc-inverse-flagIf non-nil, next operation is Inverse.
calc-invocation-macroA user defined macro for starting Calc.
calc-keep-args-flagIf non-nil, next operation should not remove its arguments from stack.
calc-kill-line-numberingIf non-nil, calculator kills include any line numbering.
calc-lang-allow-percentsignsA list of languages which allow percent signs in variable names.
calc-lang-allow-underscoresA list of languages which allow underscores in variable names.
calc-lang-brackets-are-subscriptsLanguages in which subscripts are indicated by brackets.
calc-lang-c-type-hexLanguages in which octal and hex numbers are written with leading 0 and 0x.
calc-lang-parens-are-subscriptsLanguages in which subscripts are indicated by parentheses.
calc-lang-slash-idivA list of languages in which / might represent integer division.
calc-languageLanguage or format for entry and display of stack values. Must be one of:
calc-language-alistAlist of major modes with appropriate Calc languages.
calc-language-input-filterFunction through which to pass strings before parsing.
calc-language-optionNumeric prefix argument for the command that set ‘calc-language’.
calc-language-output-filterFunction through which to pass strings after formatting.
calc-last-killThe last number killed in calc-mode.
calc-leading-zerosIf non-nil, leading zeros are provided to pad integers to calc-word-size.
calc-left-labelLabel to display at left of formula.
calc-line-breakingIf non-nil, break long values across multiple lines in Calculator stack.
calc-line-numberingIf non-nil, display line numbers in Calculator stack.
calc-load-hookHook run when calc.el is loaded.
calc-loaded-settings-fileReturn t if ‘calc-settings-file’ has been loaded yet.
calc-lu-field-referenceThe default reference level for logarithmic units (field).
calc-lu-power-referenceThe default reference level for logarithmic units (power).
calc-main-bufferA pointer to Calculator buffer.
calc-make-windows-dedicatedIf non-nil, windows displaying Calc buffers will be marked dedicated.
calc-matrix-bracketsA list of code-letter symbols that control "big" matrix display.
calc-matrix-justIf nil, vector elements are left-justified.
calc-matrix-modeIf ‘matrix’, variables are assumed to be matrix-valued.
calc-mode-hookHook run when entering calc-mode.
calc-mode-mapThe key map for Calc.
calc-mode-var-listList of variables used in customizing GNU Calc.
calc-multiplication-has-precedenceIf non-nil, multiplication has precedence over division in normal mode.
calc-note-thresholdThe number of cents that a frequency should be near a note
calc-number-radixRadix for entry and display of numbers in calc-mode, 2-36.
calc-option-flagIf non-nil, next operation has Optional behavior.
calc-other-modesList of used-defined strings to append to Calculator mode line.
calc-point-charThe character (in the form of a string) to be used as a decimal point.
calc-prefer-fracIf non-nil, prefer fractional over floating-point results.
calc-previous-moduloMost recently used value of M in a modulo form.
calc-quick-prev-resultsPrevious results from Quick Calc.
calc-radix-formatterFormatting function used for non-decimal numbers.
calc-redo-listThe list of recent undo operations.
calc-refresh-countThe number of ‘calc-refresh’ calls.
calc-right-labelLabel to display at right of formula.
calc-said-helloNon-nil if the welcome message has been displayed.
calc-scan-for-delsIf t, scan keymaps to find all DEL-like keys.
calc-settings-fileFile in which to record permanent settings.
calc-shift-prefixIf non-nil, shifted letter keys are prefix keys rather than normal meanings.
calc-show-bannerIf non-nil, show a friendly greeting above the stack.
calc-show-selectionsIf non-nil, selected sub-formulas are shown by obscuring rest of formula.
calc-simplify-modeType of simplification applied to results.
calc-stackCalculator stack.
calc-stack-topIndex into ‘calc-stack’ of "top" of stack.
calc-standalone-flagNon-nil if Emacs started with standalone Calc.
calc-start-hookHook run when calc is started.
calc-string-maximum-characterMaximum value of vector contents to be displayed as a string.
calc-symbolic-modeIf non-nil, inexact numeric computations like sqrt(2) are postponed.
calc-timingIf non-nil, display timing information on each slow command.
calc-trail-bufferA pointer to Calc Trail buffer.
calc-trail-mode-abbrev-tableAbbrev table for ‘calc-trail-mode’.
calc-trail-mode-hookHook run when entering calc-trail-mode.
calc-trail-mode-mapKeymap for ‘calc-trail-mode’.
calc-trail-mode-syntax-tableSyntax table for ‘calc-trail-mode’.
calc-trail-overlayThe value of ‘overlay-arrow-string’.
calc-trail-pointerThe "current" entry in trail buffer.
calc-trail-window-hookHook called to create the Calc trail window.
calc-twos-complement-modeIf non-nil, display integers in two’s complement mode.
calc-undo-lengthThe number of undo steps that will be preserved when Calc is quit.
calc-undo-listThe list of previous operations for undo.
calc-use-selectionsIf non-nil, commands operate only on selected portions of formulas.
calc-user-parse-tablesAlist of languages with user-defined parse rules.
calc-vector-bracketsIf non-nil, surround displayed vectors with these characters.
calc-vector-commasIf non-nil, separate elements of displayed vectors with this string.
calc-was-keypad-modeNon-nil if Calc was last invoked in keypad mode.
calc-whyExplanations of most recent errors.
calc-window-heightInitial height of Calculator window.
calc-window-hookHook called to create the Calc window.
calc-word-sizeMinimum number of bits per word, if any, for binary operations in calc-mode.
math-2-word-sizeTwo to the power of ‘calc-word-size’.
math-expr-function-mappingAlist of language specific functions with Calc functions.
math-expr-variable-mappingAlist of language specific variables with Calc variables.
math-half-2-word-sizeOne-half of two to the power of ‘calc-word-size’.
math-normalize-errorNon-nil if the last call the ‘math-normalize’ returned an error.
var-EvalRulesUser defined rules that Calc will apply automatically.

Defined functions (90)

calc(&optional ARG FULL-DISPLAY INTERACTIVE)
calc--header-line(LONG SHORT WIDTH &optional FUDGE)
calc-binary-op(NAME FUNC ARG &optional IDENT UNARY FUNC2)
calc-change-sign(ARG)
calc-check-stack(N)
calc-count-lines(S)
calc-create-buffer()
calc-cursor-stack-index(&optional INDEX)
calc-dispatch(&optional ARG)
calc-divide(ARG)
calc-do(DO-BODY &optional DO-SLOW)
calc-do-dispatch(&optional ARG)
calc-embedded(ARG &optional END OBEG OEND)
calc-embedded-activate(&optional ARG CBUF)
calc-enter(N)
calc-enter-result(N PREFIX VALS &optional M)
calc-eval(STR &optional SEPARATOR &rest ARGS)
calc-get-stack-element(X &optional SEL-MODE)
calc-grab-rectangle(TOP BOT ARG)
calc-grab-region(TOP BOT ARG)
calc-grab-sum-across(TOP BOT ARG)
calc-grab-sum-down(TOP BOT ARG)
calc-keypad(&optional INTERACTIVE)
calc-kill-stack-buffer()
calc-left-divide(ARG)
calc-minibuffer-contains(REX)
calc-minus(ARG)
calc-mode()
calc-mode-var-list-restore-default-values()
calc-mode-var-list-restore-saved-values()
calc-normalize(VAL)
calc-plus(ARG)
calc-pop(N)
calc-pop-push-list(N VALS &optional M SELS)
calc-pop-push-record-list(N PREFIX VALS &optional M SELS)
calc-pop-stack(&optional N M SEL-OK)
calc-push-list(VALS &optional M SELS)
calc-quit(&optional NON-FATAL INTERACTIVE)
calc-read-key(&optional OPTKEY)
calc-read-key-sequence(PROMPT MAP)
calc-record(VAL &optional PREFIX)
calc-record-undo(REC)
calc-refresh(&optional ALIGN)
calc-same-interface(ARG)
calc-set-command-flag(F)
calc-substack-height(N)
calc-times(ARG)
calc-top(&optional N SEL-MODE)
calc-top-list(&optional N M SEL-MODE)
calc-top-list-n(&optional N M SEL-MODE)
calc-top-n(&optional N SEL-MODE)
calc-trail-display(FLAG &optional NO-REFRESH INTERACTIVE)
calc-trail-mode()
calc-unary-op(NAME FUNC ARG &optional FUNC2)
calc-unread-command(&optional INPUT)
defcalcmodevar(VAR DEFVAL &optional DOC)
defmath(FUNC ARGS &rest BODY)
full-calc(&optional INTERACTIVE)
full-calc-keypad(&optional INTERACTIVE)
math-add(A B)
math-add-float(A B)
math-check-complete(A)
math-comp-concat(C1 C2)
math-div(A B)
math-div-float(A B)
math-float(A)
math-floatp(A)
math-format-flat-expr(A PREC)
math-format-number(A &optional PREC)
math-format-stack-value(ENTRY)
math-format-value(A &optional W)
math-idivmod(A B)
math-infinitep(A &optional UNDIR)
math-make-float(MANT EXP)
math-match-substring(S N)
math-mul(A B)
math-neg(A)
math-normalize(A)
math-numdigs(A)
math-quotient(A B)
math-read-number(S &optional DECIMAL)
math-read-number-simple(S)
math-scale-int(A N)
math-scale-left(A N)
math-scale-right(A N)
math-scale-rounding(A N)
math-stack-value-offset(C)
math-sub(A B)
math-sub-float(A B)
quick-calc(&optional INSERT)

Defined faces (2)

calc-nonselected-faceFace used to show the non-selected portion of a formula.
calc-selected-faceFace used to show the selected portion of a formula.