calc-ext.el 128 KB
Newer Older
1 2
;;; calc-ext.el --- various extension functions for Calc

Jay Belanger's avatar
Jay Belanger committed
3
;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
Glenn Morris's avatar
Glenn Morris committed
4
;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 6

;; Author: David Gillespie <daveg@synaptics.com>
Jay Belanger's avatar
Jay Belanger committed
7
;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
Eli Zaretskii's avatar
Eli Zaretskii committed
8 9 10

;; This file is part of GNU Emacs.

11
;; GNU Emacs is free software: you can redistribute it and/or modify
12
;; it under the terms of the GNU General Public License as published by
13 14
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
15

Eli Zaretskii's avatar
Eli Zaretskii committed
16
;; GNU Emacs is distributed in the hope that it will be useful,
17 18 19 20 21
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
22
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
Eli Zaretskii's avatar
Eli Zaretskii committed
23

24
;;; Commentary:
Eli Zaretskii's avatar
Eli Zaretskii committed
25

26
;;; Code:
Eli Zaretskii's avatar
Eli Zaretskii committed
27

Eli Zaretskii's avatar
Eli Zaretskii committed
28
(require 'calc)
Eli Zaretskii's avatar
Eli Zaretskii committed
29 30
(require 'calc-macs)

31 32 33 34 35 36 37 38 39 40 41 42 43
;; Declare functions which are defined elsewhere.
(declare-function math-clip "calc-bin" (a &optional w))
(declare-function math-round "calc-arith" (a &optional prec))
(declare-function math-simplify "calc-alg" (top-expr))
(declare-function math-simplify-extended "calc-alg" (a))
(declare-function math-simplify-units "calc-units" (a))
(declare-function calc-set-language "calc-lang" (lang &optional option no-refresh))
(declare-function calc-flush-caches "calc-stuff" (&optional inhibit-msg))
(declare-function calc-save-modes "calc-mode" ())
(declare-function calc-embedded-modes-change "calc-embed" (vars))
(declare-function calc-embedded-var-change "calc-embed" (var &optional buf))
(declare-function math-mul-float "calc-arith" (a b))
(declare-function math-arctan-raw "calc-math" (x))
44
(declare-function math-sqrt-raw "calc-math" (a &optional guess))
45 46 47 48 49 50 51 52 53 54 55 56 57 58
(declare-function math-sqrt-float "calc-math" (a &optional guess))
(declare-function math-exp-minus-1-raw "calc-math" (x))
(declare-function math-normalize-polar "calc-cplx" (a))
(declare-function math-normalize-hms "calc-forms" (a))
(declare-function math-normalize-mod "calc-forms" (a))
(declare-function math-make-sdev "calc-forms" (x sigma))
(declare-function math-make-intv "calc-forms" (mask lo hi))
(declare-function math-normalize-logical-op "calc-prog" (a))
(declare-function math-possible-signs "calc-arith" (a &optional origin))
(declare-function math-infinite-dir "calc-math" (a &optional inf))
(declare-function math-calcFunc-to-var "calc-map" (f))
(declare-function calc-embedded-evaluate-expr "calc-embed" (x))
(declare-function math-known-nonzerop "calc-arith" (a))
(declare-function math-read-expr-level "calc-aent" (exp-prec &optional exp-term))
59
(declare-function math-read-big-rec "calc-lang" (math-rb-h1 math-rb-v1 math-rb-h2 math-rb-v2 &optional baseline prec short))
60 61 62 63 64 65 66 67 68 69 70 71
(declare-function math-read-big-balance "calc-lang" (h v what &optional commas))
(declare-function math-format-date "calc-forms" (math-fd-date))
(declare-function math-vector-is-string "calccomp" (a))
(declare-function math-vector-to-string "calccomp" (a &optional quoted))
(declare-function math-format-radix-float "calc-bin" (a prec))
(declare-function math-compose-expr "calccomp" (a prec))
(declare-function math-abs "calc-arith" (a))
(declare-function math-format-bignum-binary "calc-bin" (a))
(declare-function math-format-bignum-octal "calc-bin" (a))
(declare-function math-format-bignum-hex "calc-bin" (a))
(declare-function math-format-bignum-radix "calc-bin" (a))
(declare-function math-compute-max-digits "calc-bin" (w r))
72 73 74
(declare-function math-map-vec "calc-vec" (f a))
(declare-function math-make-frac "calc-frac" (num den))

75

76 77 78 79 80 81 82 83 84 85 86 87 88 89
(defvar math-simplifying nil)
(defvar math-living-dangerously nil)   ; true if unsafe simplifications are okay.
(defvar math-integrating nil)

(defvar math-rewrite-selections nil)

(defvar math-compose-level 0)
(defvar math-comp-selected nil)
(defvar math-comp-tagged nil)
(defvar math-comp-sel-hpos nil)
(defvar math-comp-sel-vpos nil)
(defvar math-comp-sel-cpos nil)
(defvar math-compose-hash-args nil)

90 91 92
(defvar calc-alg-map)
(defvar calc-alg-esc-map)

Eli Zaretskii's avatar
Eli Zaretskii committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106
;;; The following was made a function so that it could be byte-compiled.
(defun calc-init-extensions ()

  (define-key calc-mode-map ":" 'calc-fdiv)
  (define-key calc-mode-map "\\" 'calc-idiv)
  (define-key calc-mode-map "|" 'calc-concat)
  (define-key calc-mode-map "!" 'calc-factorial)
  (define-key calc-mode-map "C" 'calc-cos)
  (define-key calc-mode-map "E" 'calc-exp)
  (define-key calc-mode-map "H" 'calc-hyperbolic)
  (define-key calc-mode-map "I" 'calc-inverse)
  (define-key calc-mode-map "J" 'calc-conj)
  (define-key calc-mode-map "L" 'calc-ln)
  (define-key calc-mode-map "N" 'calc-eval-num)
107
  (define-key calc-mode-map "O" 'calc-option)
Eli Zaretskii's avatar
Eli Zaretskii committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
  (define-key calc-mode-map "P" 'calc-pi)
  (define-key calc-mode-map "Q" 'calc-sqrt)
  (define-key calc-mode-map "R" 'calc-round)
  (define-key calc-mode-map "S" 'calc-sin)
  (define-key calc-mode-map "T" 'calc-tan)
  (define-key calc-mode-map "U" 'calc-undo)
  (define-key calc-mode-map "X" 'calc-call-last-kbd-macro)
  (define-key calc-mode-map "o" 'calc-realign)
  (define-key calc-mode-map "p" 'calc-precision)
  (define-key calc-mode-map "w" 'calc-why)
  (define-key calc-mode-map "x" 'calc-execute-extended-command)
  (define-key calc-mode-map "y" 'calc-copy-to-buffer)

  (define-key calc-mode-map "(" 'calc-begin-complex)
  (define-key calc-mode-map ")" 'calc-end-complex)
  (define-key calc-mode-map "[" 'calc-begin-vector)
  (define-key calc-mode-map "]" 'calc-end-vector)
  (define-key calc-mode-map "," 'calc-comma)
  (define-key calc-mode-map ";" 'calc-semi)
  (define-key calc-mode-map "`" 'calc-edit)
  (define-key calc-mode-map "=" 'calc-evaluate)
  (define-key calc-mode-map "~" 'calc-num-prefix)
  (define-key calc-mode-map "<" 'calc-scroll-left)
  (define-key calc-mode-map ">" 'calc-scroll-right)
  (define-key calc-mode-map "{" 'calc-scroll-down)
  (define-key calc-mode-map "}" 'calc-scroll-up)
  (define-key calc-mode-map "\C-k" 'calc-kill)
  (define-key calc-mode-map "\M-k" 'calc-copy-as-kill)
  (define-key calc-mode-map "\C-w" 'calc-kill-region)
  (define-key calc-mode-map "\M-w" 'calc-copy-region-as-kill)
138
  (define-key calc-mode-map "\M-\C-w" 'kill-ring-save)
Eli Zaretskii's avatar
Eli Zaretskii committed
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
  (define-key calc-mode-map "\C-_" 'calc-undo)
  (define-key calc-mode-map "\C-xu" 'calc-undo)
  (define-key calc-mode-map "\M-\C-m" 'calc-last-args)

  (define-key calc-mode-map "a" nil)
  (define-key calc-mode-map "a?" 'calc-a-prefix-help)
  (define-key calc-mode-map "aa" 'calc-apart)
  (define-key calc-mode-map "ab" 'calc-substitute)
  (define-key calc-mode-map "ac" 'calc-collect)
  (define-key calc-mode-map "ad" 'calc-derivative)
  (define-key calc-mode-map "ae" 'calc-simplify-extended)
  (define-key calc-mode-map "af" 'calc-factor)
  (define-key calc-mode-map "ag" 'calc-poly-gcd)
  (define-key calc-mode-map "ai" 'calc-integral)
  (define-key calc-mode-map "am" 'calc-match)
  (define-key calc-mode-map "an" 'calc-normalize-rat)
  (define-key calc-mode-map "ap" 'calc-poly-interp)
  (define-key calc-mode-map "ar" 'calc-rewrite)
  (define-key calc-mode-map "as" 'calc-simplify)
  (define-key calc-mode-map "at" 'calc-taylor)
  (define-key calc-mode-map "av" 'calc-alg-evaluate)
  (define-key calc-mode-map "ax" 'calc-expand)
  (define-key calc-mode-map "aA" 'calc-abs)
  (define-key calc-mode-map "aF" 'calc-curve-fit)
  (define-key calc-mode-map "aI" 'calc-num-integral)
  (define-key calc-mode-map "aM" 'calc-map-equation)
  (define-key calc-mode-map "aN" 'calc-find-minimum)
  (define-key calc-mode-map "aP" 'calc-poly-roots)
  (define-key calc-mode-map "aS" 'calc-solve-for)
  (define-key calc-mode-map "aR" 'calc-find-root)
  (define-key calc-mode-map "aT" 'calc-tabulate)
  (define-key calc-mode-map "aX" 'calc-find-maximum)
  (define-key calc-mode-map "a+" 'calc-summation)
  (define-key calc-mode-map "a-" 'calc-alt-summation)
  (define-key calc-mode-map "a*" 'calc-product)
  (define-key calc-mode-map "a\\" 'calc-poly-div)
  (define-key calc-mode-map "a%" 'calc-poly-rem)
  (define-key calc-mode-map "a/" 'calc-poly-div-rem)
  (define-key calc-mode-map "a=" 'calc-equal-to)
  (define-key calc-mode-map "a#" 'calc-not-equal-to)
  (define-key calc-mode-map "a<" 'calc-less-than)
  (define-key calc-mode-map "a>" 'calc-greater-than)
  (define-key calc-mode-map "a[" 'calc-less-equal)
  (define-key calc-mode-map "a]" 'calc-greater-equal)
  (define-key calc-mode-map "a." 'calc-remove-equal)
  (define-key calc-mode-map "a{" 'calc-in-set)
  (define-key calc-mode-map "a&" 'calc-logical-and)
  (define-key calc-mode-map "a|" 'calc-logical-or)
  (define-key calc-mode-map "a!" 'calc-logical-not)
  (define-key calc-mode-map "a:" 'calc-logical-if)
  (define-key calc-mode-map "a_" 'calc-subscript)
  (define-key calc-mode-map "a\"" 'calc-expand-formula)

  (define-key calc-mode-map "b" nil)
  (define-key calc-mode-map "b?" 'calc-b-prefix-help)
  (define-key calc-mode-map "ba" 'calc-and)
  (define-key calc-mode-map "bc" 'calc-clip)
  (define-key calc-mode-map "bd" 'calc-diff)
  (define-key calc-mode-map "bl" 'calc-lshift-binary)
  (define-key calc-mode-map "bn" 'calc-not)
  (define-key calc-mode-map "bo" 'calc-or)
  (define-key calc-mode-map "bp" 'calc-pack-bits)
  (define-key calc-mode-map "br" 'calc-rshift-binary)
  (define-key calc-mode-map "bt" 'calc-rotate-binary)
  (define-key calc-mode-map "bu" 'calc-unpack-bits)
  (define-key calc-mode-map "bw" 'calc-word-size)
  (define-key calc-mode-map "bx" 'calc-xor)
  (define-key calc-mode-map "bB" 'calc-log)
  (define-key calc-mode-map "bD" 'calc-fin-ddb)
  (define-key calc-mode-map "bF" 'calc-fin-fv)
  (define-key calc-mode-map "bI" 'calc-fin-irr)
  (define-key calc-mode-map "bL" 'calc-lshift-arith)
  (define-key calc-mode-map "bM" 'calc-fin-pmt)
  (define-key calc-mode-map "bN" 'calc-fin-npv)
  (define-key calc-mode-map "bP" 'calc-fin-pv)
  (define-key calc-mode-map "bR" 'calc-rshift-arith)
  (define-key calc-mode-map "bS" 'calc-fin-sln)
  (define-key calc-mode-map "bT" 'calc-fin-rate)
  (define-key calc-mode-map "bY" 'calc-fin-syd)
  (define-key calc-mode-map "b#" 'calc-fin-nper)
  (define-key calc-mode-map "b%" 'calc-percent-change)

  (define-key calc-mode-map "c" nil)
  (define-key calc-mode-map "c?" 'calc-c-prefix-help)
  (define-key calc-mode-map "cc" 'calc-clean)
  (define-key calc-mode-map "cd" 'calc-to-degrees)
  (define-key calc-mode-map "cf" 'calc-float)
  (define-key calc-mode-map "ch" 'calc-to-hms)
  (define-key calc-mode-map "cp" 'calc-polar)
  (define-key calc-mode-map "cr" 'calc-to-radians)
  (define-key calc-mode-map "cC" 'calc-cos)
  (define-key calc-mode-map "cF" 'calc-fraction)
  (define-key calc-mode-map "c%" 'calc-convert-percent)

  (define-key calc-mode-map "d" nil)
  (define-key calc-mode-map "d?" 'calc-d-prefix-help)
  (define-key calc-mode-map "d0" 'calc-decimal-radix)
  (define-key calc-mode-map "d2" 'calc-binary-radix)
  (define-key calc-mode-map "d6" 'calc-hex-radix)
  (define-key calc-mode-map "d8" 'calc-octal-radix)
  (define-key calc-mode-map "db" 'calc-line-breaking)
  (define-key calc-mode-map "dc" 'calc-complex-notation)
  (define-key calc-mode-map "dd" 'calc-date-notation)
  (define-key calc-mode-map "de" 'calc-eng-notation)
  (define-key calc-mode-map "df" 'calc-fix-notation)
  (define-key calc-mode-map "dg" 'calc-group-digits)
  (define-key calc-mode-map "dh" 'calc-hms-notation)
  (define-key calc-mode-map "di" 'calc-i-notation)
  (define-key calc-mode-map "dj" 'calc-j-notation)
  (define-key calc-mode-map "dl" 'calc-line-numbering)
  (define-key calc-mode-map "dn" 'calc-normal-notation)
  (define-key calc-mode-map "do" 'calc-over-notation)
  (define-key calc-mode-map "dp" 'calc-show-plain)
  (define-key calc-mode-map "dr" 'calc-radix)
  (define-key calc-mode-map "ds" 'calc-sci-notation)
  (define-key calc-mode-map "dt" 'calc-truncate-stack)
  (define-key calc-mode-map "dw" 'calc-auto-why)
  (define-key calc-mode-map "dz" 'calc-leading-zeros)
257
  (define-key calc-mode-map "dA" 'calc-giac-language)
Eli Zaretskii's avatar
Eli Zaretskii committed
258 259 260 261 262 263 264 265 266 267
  (define-key calc-mode-map "dB" 'calc-big-language)
  (define-key calc-mode-map "dD" 'calc-redo)
  (define-key calc-mode-map "dC" 'calc-c-language)
  (define-key calc-mode-map "dE" 'calc-eqn-language)
  (define-key calc-mode-map "dF" 'calc-fortran-language)
  (define-key calc-mode-map "dM" 'calc-mathematica-language)
  (define-key calc-mode-map "dN" 'calc-normal-language)
  (define-key calc-mode-map "dO" 'calc-flat-language)
  (define-key calc-mode-map "dP" 'calc-pascal-language)
  (define-key calc-mode-map "dT" 'calc-tex-language)
268
  (define-key calc-mode-map "dL" 'calc-latex-language)
Eli Zaretskii's avatar
Eli Zaretskii committed
269 270
  (define-key calc-mode-map "dU" 'calc-unformatted-language)
  (define-key calc-mode-map "dW" 'calc-maple-language)
271 272
  (define-key calc-mode-map "dX" 'calc-maxima-language)
  (define-key calc-mode-map "dY" 'calc-yacas-language)
Eli Zaretskii's avatar
Eli Zaretskii committed
273 274 275 276 277 278 279 280 281 282 283 284 285
  (define-key calc-mode-map "d[" 'calc-truncate-up)
  (define-key calc-mode-map "d]" 'calc-truncate-down)
  (define-key calc-mode-map "d." 'calc-point-char)
  (define-key calc-mode-map "d," 'calc-group-char)
  (define-key calc-mode-map "d\"" 'calc-display-strings)
  (define-key calc-mode-map "d<" 'calc-left-justify)
  (define-key calc-mode-map "d=" 'calc-center-justify)
  (define-key calc-mode-map "d>" 'calc-right-justify)
  (define-key calc-mode-map "d{" 'calc-left-label)
  (define-key calc-mode-map "d}" 'calc-right-label)
  (define-key calc-mode-map "d'" 'calc-display-raw)
  (define-key calc-mode-map "d " 'calc-refresh)
  (define-key calc-mode-map "d\r" 'calc-refresh-top)
286
  (define-key calc-mode-map "d@" 'calc-toggle-banner)
Eli Zaretskii's avatar
Eli Zaretskii committed
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430

  (define-key calc-mode-map "f" nil)
  (define-key calc-mode-map "f?" 'calc-f-prefix-help)
  (define-key calc-mode-map "fb" 'calc-beta)
  (define-key calc-mode-map "fe" 'calc-erf)
  (define-key calc-mode-map "fg" 'calc-gamma)
  (define-key calc-mode-map "fh" 'calc-hypot)
  (define-key calc-mode-map "fi" 'calc-im)
  (define-key calc-mode-map "fj" 'calc-bessel-J)
  (define-key calc-mode-map "fn" 'calc-min)
  (define-key calc-mode-map "fr" 'calc-re)
  (define-key calc-mode-map "fs" 'calc-sign)
  (define-key calc-mode-map "fx" 'calc-max)
  (define-key calc-mode-map "fy" 'calc-bessel-Y)
  (define-key calc-mode-map "fA" 'calc-abssqr)
  (define-key calc-mode-map "fB" 'calc-inc-beta)
  (define-key calc-mode-map "fE" 'calc-expm1)
  (define-key calc-mode-map "fF" 'calc-floor)
  (define-key calc-mode-map "fG" 'calc-inc-gamma)
  (define-key calc-mode-map "fI" 'calc-ilog)
  (define-key calc-mode-map "fL" 'calc-lnp1)
  (define-key calc-mode-map "fM" 'calc-mant-part)
  (define-key calc-mode-map "fQ" 'calc-isqrt)
  (define-key calc-mode-map "fS" 'calc-scale-float)
  (define-key calc-mode-map "fT" 'calc-arctan2)
  (define-key calc-mode-map "fX" 'calc-xpon-part)
  (define-key calc-mode-map "f[" 'calc-decrement)
  (define-key calc-mode-map "f]" 'calc-increment)

  (define-key calc-mode-map "g" nil)
  (define-key calc-mode-map "g?" 'calc-g-prefix-help)
  (define-key calc-mode-map "ga" 'calc-graph-add)
  (define-key calc-mode-map "gb" 'calc-graph-border)
  (define-key calc-mode-map "gc" 'calc-graph-clear)
  (define-key calc-mode-map "gd" 'calc-graph-delete)
  (define-key calc-mode-map "gf" 'calc-graph-fast)
  (define-key calc-mode-map "gg" 'calc-graph-grid)
  (define-key calc-mode-map "gh" 'calc-graph-header)
  (define-key calc-mode-map "gk" 'calc-graph-key)
  (define-key calc-mode-map "gj" 'calc-graph-juggle)
  (define-key calc-mode-map "gl" 'calc-graph-log-x)
  (define-key calc-mode-map "gn" 'calc-graph-name)
  (define-key calc-mode-map "gp" 'calc-graph-plot)
  (define-key calc-mode-map "gq" 'calc-graph-quit)
  (define-key calc-mode-map "gr" 'calc-graph-range-x)
  (define-key calc-mode-map "gs" 'calc-graph-line-style)
  (define-key calc-mode-map "gt" 'calc-graph-title-x)
  (define-key calc-mode-map "gv" 'calc-graph-view-commands)
  (define-key calc-mode-map "gx" 'calc-graph-display)
  (define-key calc-mode-map "gz" 'calc-graph-zero-x)
  (define-key calc-mode-map "gA" 'calc-graph-add-3d)
  (define-key calc-mode-map "gC" 'calc-graph-command)
  (define-key calc-mode-map "gD" 'calc-graph-device)
  (define-key calc-mode-map "gF" 'calc-graph-fast-3d)
  (define-key calc-mode-map "gG" 'calc-argument)
  (define-key calc-mode-map "gH" 'calc-graph-hide)
  (define-key calc-mode-map "gK" 'calc-graph-kill)
  (define-key calc-mode-map "gL" 'calc-graph-log-y)
  (define-key calc-mode-map "gN" 'calc-graph-num-points)
  (define-key calc-mode-map "gO" 'calc-graph-output)
  (define-key calc-mode-map "gP" 'calc-graph-print)
  (define-key calc-mode-map "gR" 'calc-graph-range-y)
  (define-key calc-mode-map "gS" 'calc-graph-point-style)
  (define-key calc-mode-map "gT" 'calc-graph-title-y)
  (define-key calc-mode-map "gV" 'calc-graph-view-trail)
  (define-key calc-mode-map "gX" 'calc-graph-geometry)
  (define-key calc-mode-map "gZ" 'calc-graph-zero-y)
  (define-key calc-mode-map "g\C-l" 'calc-graph-log-z)
  (define-key calc-mode-map "g\C-r" 'calc-graph-range-z)
  (define-key calc-mode-map "g\C-t" 'calc-graph-title-z)

  (define-key calc-mode-map "h" 'calc-help-prefix)

  (define-key calc-mode-map "j" nil)
  (define-key calc-mode-map "j?" 'calc-j-prefix-help)
  (define-key calc-mode-map "ja" 'calc-select-additional)
  (define-key calc-mode-map "jb" 'calc-break-selections)
  (define-key calc-mode-map "jc" 'calc-clear-selections)
  (define-key calc-mode-map "jd" 'calc-show-selections)
  (define-key calc-mode-map "je" 'calc-enable-selections)
  (define-key calc-mode-map "jl" 'calc-select-less)
  (define-key calc-mode-map "jm" 'calc-select-more)
  (define-key calc-mode-map "jn" 'calc-select-next)
  (define-key calc-mode-map "jo" 'calc-select-once)
  (define-key calc-mode-map "jp" 'calc-select-previous)
  (define-key calc-mode-map "jr" 'calc-rewrite-selection)
  (define-key calc-mode-map "js" 'calc-select-here)
  (define-key calc-mode-map "jv" 'calc-sel-evaluate)
  (define-key calc-mode-map "ju" 'calc-unselect)
  (define-key calc-mode-map "jC" 'calc-sel-commute)
  (define-key calc-mode-map "jD" 'calc-sel-distribute)
  (define-key calc-mode-map "jE" 'calc-sel-jump-equals)
  (define-key calc-mode-map "jI" 'calc-sel-isolate)
  (define-key calc-mode-map "jJ" 'calc-conj)
  (define-key calc-mode-map "jL" 'calc-commute-left)
  (define-key calc-mode-map "jM" 'calc-sel-merge)
  (define-key calc-mode-map "jN" 'calc-sel-negate)
  (define-key calc-mode-map "jO" 'calc-select-once-maybe)
  (define-key calc-mode-map "jR" 'calc-commute-right)
  (define-key calc-mode-map "jS" 'calc-select-here-maybe)
  (define-key calc-mode-map "jU" 'calc-sel-unpack)
  (define-key calc-mode-map "j&" 'calc-sel-invert)
  (define-key calc-mode-map "j\r" 'calc-copy-selection)
  (define-key calc-mode-map "j\n" 'calc-copy-selection)
  (define-key calc-mode-map "j\010" 'calc-del-selection)
  (define-key calc-mode-map "j\177" 'calc-del-selection)
  (define-key calc-mode-map "j'" 'calc-enter-selection)
  (define-key calc-mode-map "j`" 'calc-edit-selection)
  (define-key calc-mode-map "j+" 'calc-sel-add-both-sides)
  (define-key calc-mode-map "j-" 'calc-sel-sub-both-sides)
  (define-key calc-mode-map "j*" 'calc-sel-mult-both-sides)
  (define-key calc-mode-map "j/" 'calc-sel-div-both-sides)
  (define-key calc-mode-map "j\"" 'calc-sel-expand-formula)

  (define-key calc-mode-map "k" nil)
  (define-key calc-mode-map "k?" 'calc-k-prefix-help)
  (define-key calc-mode-map "ka" 'calc-random-again)
  (define-key calc-mode-map "kb" 'calc-bernoulli-number)
  (define-key calc-mode-map "kc" 'calc-choose)
  (define-key calc-mode-map "kd" 'calc-double-factorial)
  (define-key calc-mode-map "ke" 'calc-euler-number)
  (define-key calc-mode-map "kf" 'calc-prime-factors)
  (define-key calc-mode-map "kg" 'calc-gcd)
  (define-key calc-mode-map "kh" 'calc-shuffle)
  (define-key calc-mode-map "kl" 'calc-lcm)
  (define-key calc-mode-map "km" 'calc-moebius)
  (define-key calc-mode-map "kn" 'calc-next-prime)
  (define-key calc-mode-map "kp" 'calc-prime-test)
  (define-key calc-mode-map "kr" 'calc-random)
  (define-key calc-mode-map "ks" 'calc-stirling-number)
  (define-key calc-mode-map "kt" 'calc-totient)
  (define-key calc-mode-map "kB" 'calc-utpb)
  (define-key calc-mode-map "kC" 'calc-utpc)
  (define-key calc-mode-map "kE" 'calc-extended-gcd)
  (define-key calc-mode-map "kF" 'calc-utpf)
  (define-key calc-mode-map "kK" 'calc-keep-args)
  (define-key calc-mode-map "kN" 'calc-utpn)
  (define-key calc-mode-map "kP" 'calc-utpp)
  (define-key calc-mode-map "kT" 'calc-utpt)

  (define-key calc-mode-map "m" nil)
  (define-key calc-mode-map "m?" 'calc-m-prefix-help)
  (define-key calc-mode-map "ma" 'calc-algebraic-mode)
  (define-key calc-mode-map "md" 'calc-degrees-mode)
431
  (define-key calc-mode-map "me" 'calc-embedded-preserve-modes)
Eli Zaretskii's avatar
Eli Zaretskii committed
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
  (define-key calc-mode-map "mf" 'calc-frac-mode)
  (define-key calc-mode-map "mg" 'calc-get-modes)
  (define-key calc-mode-map "mh" 'calc-hms-mode)
  (define-key calc-mode-map "mi" 'calc-infinite-mode)
  (define-key calc-mode-map "mm" 'calc-save-modes)
  (define-key calc-mode-map "mp" 'calc-polar-mode)
  (define-key calc-mode-map "mr" 'calc-radians-mode)
  (define-key calc-mode-map "ms" 'calc-symbolic-mode)
  (define-key calc-mode-map "mt" 'calc-total-algebraic-mode)
  (define-key calc-mode-map "\emt" 'calc-total-algebraic-mode)
  (define-key calc-mode-map "\em\et" 'calc-total-algebraic-mode)
  (define-key calc-mode-map "mv" 'calc-matrix-mode)
  (define-key calc-mode-map "mw" 'calc-working)
  (define-key calc-mode-map "mx" 'calc-always-load-extensions)
  (define-key calc-mode-map "mA" 'calc-alg-simplify-mode)
  (define-key calc-mode-map "mB" 'calc-bin-simplify-mode)
  (define-key calc-mode-map "mC" 'calc-auto-recompute)
  (define-key calc-mode-map "mD" 'calc-default-simplify-mode)
  (define-key calc-mode-map "mE" 'calc-ext-simplify-mode)
  (define-key calc-mode-map "mF" 'calc-settings-file-name)
  (define-key calc-mode-map "mM" 'calc-more-recursion-depth)
  (define-key calc-mode-map "mN" 'calc-num-simplify-mode)
  (define-key calc-mode-map "mO" 'calc-no-simplify-mode)
  (define-key calc-mode-map "mR" 'calc-mode-record-mode)
  (define-key calc-mode-map "mS" 'calc-shift-prefix)
  (define-key calc-mode-map "mU" 'calc-units-simplify-mode)
  (define-key calc-mode-map "mX" 'calc-load-everything)

  (define-key calc-mode-map "r" nil)
461 462
  (define-key calc-mode-map "ri" 'calc-insert-register)
  (define-key calc-mode-map "rs" 'calc-copy-to-register)
Eli Zaretskii's avatar
Eli Zaretskii committed
463 464 465 466 467 468 469 470
  (define-key calc-mode-map "r?" 'calc-r-prefix-help)

  (define-key calc-mode-map "s" nil)
  (define-key calc-mode-map "s?" 'calc-s-prefix-help)
  (define-key calc-mode-map "sc" 'calc-copy-variable)
  (define-key calc-mode-map "sd" 'calc-declare-variable)
  (define-key calc-mode-map "se" 'calc-edit-variable)
  (define-key calc-mode-map "si" 'calc-insert-variables)
471
  (define-key calc-mode-map "sk" 'calc-copy-special-constant)
Eli Zaretskii's avatar
Eli Zaretskii committed
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593
  (define-key calc-mode-map "sl" 'calc-let)
  (define-key calc-mode-map "sm" 'calc-store-map)
  (define-key calc-mode-map "sn" 'calc-store-neg)
  (define-key calc-mode-map "sp" 'calc-permanent-variable)
  (define-key calc-mode-map "sr" 'calc-recall)
  (define-key calc-mode-map "ss" 'calc-store)
  (define-key calc-mode-map "st" 'calc-store-into)
  (define-key calc-mode-map "su" 'calc-unstore)
  (define-key calc-mode-map "sx" 'calc-store-exchange)
  (define-key calc-mode-map "sA" 'calc-edit-AlgSimpRules)
  (define-key calc-mode-map "sD" 'calc-edit-Decls)
  (define-key calc-mode-map "sE" 'calc-edit-EvalRules)
  (define-key calc-mode-map "sF" 'calc-edit-FitRules)
  (define-key calc-mode-map "sG" 'calc-edit-GenCount)
  (define-key calc-mode-map "sH" 'calc-edit-Holidays)
  (define-key calc-mode-map "sI" 'calc-edit-IntegLimit)
  (define-key calc-mode-map "sL" 'calc-edit-LineStyles)
  (define-key calc-mode-map "sP" 'calc-edit-PointStyles)
  (define-key calc-mode-map "sR" 'calc-edit-PlotRejects)
  (define-key calc-mode-map "sS" 'calc-sin)
  (define-key calc-mode-map "sT" 'calc-edit-TimeZone)
  (define-key calc-mode-map "sU" 'calc-edit-Units)
  (define-key calc-mode-map "sX" 'calc-edit-ExtSimpRules)
  (define-key calc-mode-map "s+" 'calc-store-plus)
  (define-key calc-mode-map "s-" 'calc-store-minus)
  (define-key calc-mode-map "s*" 'calc-store-times)
  (define-key calc-mode-map "s/" 'calc-store-div)
  (define-key calc-mode-map "s^" 'calc-store-power)
  (define-key calc-mode-map "s|" 'calc-store-concat)
  (define-key calc-mode-map "s&" 'calc-store-inv)
  (define-key calc-mode-map "s[" 'calc-store-decr)
  (define-key calc-mode-map "s]" 'calc-store-incr)
  (define-key calc-mode-map "s:" 'calc-assign)
  (define-key calc-mode-map "s=" 'calc-evalto)

  (define-key calc-mode-map "t" nil)
  (define-key calc-mode-map "t?" 'calc-t-prefix-help)
  (define-key calc-mode-map "tb" 'calc-trail-backward)
  (define-key calc-mode-map "td" 'calc-trail-display)
  (define-key calc-mode-map "tf" 'calc-trail-forward)
  (define-key calc-mode-map "th" 'calc-trail-here)
  (define-key calc-mode-map "ti" 'calc-trail-in)
  (define-key calc-mode-map "tk" 'calc-trail-kill)
  (define-key calc-mode-map "tm" 'calc-trail-marker)
  (define-key calc-mode-map "tn" 'calc-trail-next)
  (define-key calc-mode-map "to" 'calc-trail-out)
  (define-key calc-mode-map "tp" 'calc-trail-previous)
  (define-key calc-mode-map "tr" 'calc-trail-isearch-backward)
  (define-key calc-mode-map "ts" 'calc-trail-isearch-forward)
  (define-key calc-mode-map "ty" 'calc-trail-yank)
  (define-key calc-mode-map "t[" 'calc-trail-first)
  (define-key calc-mode-map "t]" 'calc-trail-last)
  (define-key calc-mode-map "t<" 'calc-trail-scroll-left)
  (define-key calc-mode-map "t>" 'calc-trail-scroll-right)
  (define-key calc-mode-map "t{" 'calc-trail-backward)
  (define-key calc-mode-map "t}" 'calc-trail-forward)
  (define-key calc-mode-map "t." 'calc-full-trail-vectors)
  (define-key calc-mode-map "tC" 'calc-convert-time-zones)
  (define-key calc-mode-map "tD" 'calc-date)
  (define-key calc-mode-map "tI" 'calc-inc-month)
  (define-key calc-mode-map "tJ" 'calc-julian)
  (define-key calc-mode-map "tM" 'calc-new-month)
  (define-key calc-mode-map "tN" 'calc-now)
  (define-key calc-mode-map "tP" 'calc-date-part)
  (define-key calc-mode-map "tT" 'calc-tan)
  (define-key calc-mode-map "tU" 'calc-unix-time)
  (define-key calc-mode-map "tW" 'calc-new-week)
  (define-key calc-mode-map "tY" 'calc-new-year)
  (define-key calc-mode-map "tZ" 'calc-time-zone)
  (define-key calc-mode-map "t+" 'calc-business-days-plus)
  (define-key calc-mode-map "t-" 'calc-business-days-minus)

  (define-key calc-mode-map "u" 'nil)
  (define-key calc-mode-map "u?" 'calc-u-prefix-help)
  (define-key calc-mode-map "ua" 'calc-autorange-units)
  (define-key calc-mode-map "ub" 'calc-base-units)
  (define-key calc-mode-map "uc" 'calc-convert-units)
  (define-key calc-mode-map "ud" 'calc-define-unit)
  (define-key calc-mode-map "ue" 'calc-explain-units)
  (define-key calc-mode-map "ug" 'calc-get-unit-definition)
  (define-key calc-mode-map "up" 'calc-permanent-units)
  (define-key calc-mode-map "ur" 'calc-remove-units)
  (define-key calc-mode-map "us" 'calc-simplify-units)
  (define-key calc-mode-map "ut" 'calc-convert-temperature)
  (define-key calc-mode-map "uu" 'calc-undefine-unit)
  (define-key calc-mode-map "uv" 'calc-enter-units-table)
  (define-key calc-mode-map "ux" 'calc-extract-units)
  (define-key calc-mode-map "uV" 'calc-view-units-table)
  (define-key calc-mode-map "uC" 'calc-vector-covariance)
  (define-key calc-mode-map "uG" 'calc-vector-geometric-mean)
  (define-key calc-mode-map "uM" 'calc-vector-mean)
  (define-key calc-mode-map "uN" 'calc-vector-min)
  (define-key calc-mode-map "uS" 'calc-vector-sdev)
  (define-key calc-mode-map "uU" 'calc-undo)
  (define-key calc-mode-map "uX" 'calc-vector-max)
  (define-key calc-mode-map "u#" 'calc-vector-count)
  (define-key calc-mode-map "u+" 'calc-vector-sum)
  (define-key calc-mode-map "u*" 'calc-vector-product)

  (define-key calc-mode-map "v" 'nil)
  (define-key calc-mode-map "v?" 'calc-v-prefix-help)
  (define-key calc-mode-map "va" 'calc-arrange-vector)
  (define-key calc-mode-map "vb" 'calc-build-vector)
  (define-key calc-mode-map "vc" 'calc-mcol)
  (define-key calc-mode-map "vd" 'calc-diag)
  (define-key calc-mode-map "ve" 'calc-expand-vector)
  (define-key calc-mode-map "vf" 'calc-vector-find)
  (define-key calc-mode-map "vh" 'calc-head)
  (define-key calc-mode-map "vi" 'calc-ident)
  (define-key calc-mode-map "vk" 'calc-cons)
  (define-key calc-mode-map "vl" 'calc-vlength)
  (define-key calc-mode-map "vm" 'calc-mask-vector)
  (define-key calc-mode-map "vn" 'calc-rnorm)
  (define-key calc-mode-map "vp" 'calc-pack)
  (define-key calc-mode-map "vr" 'calc-mrow)
  (define-key calc-mode-map "vs" 'calc-subvector)
  (define-key calc-mode-map "vt" 'calc-transpose)
  (define-key calc-mode-map "vu" 'calc-unpack)
  (define-key calc-mode-map "vv" 'calc-reverse-vector)
  (define-key calc-mode-map "vx" 'calc-index)
  (define-key calc-mode-map "vA" 'calc-apply)
  (define-key calc-mode-map "vC" 'calc-cross)
594
  (define-key calc-mode-map "vK" 'calc-kron)
Eli Zaretskii's avatar
Eli Zaretskii committed
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630
  (define-key calc-mode-map "vD" 'calc-mdet)
  (define-key calc-mode-map "vE" 'calc-set-enumerate)
  (define-key calc-mode-map "vF" 'calc-set-floor)
  (define-key calc-mode-map "vG" 'calc-grade)
  (define-key calc-mode-map "vH" 'calc-histogram)
  (define-key calc-mode-map "vI" 'calc-inner-product)
  (define-key calc-mode-map "vJ" 'calc-conj-transpose)
  (define-key calc-mode-map "vL" 'calc-mlud)
  (define-key calc-mode-map "vM" 'calc-map)
  (define-key calc-mode-map "vN" 'calc-cnorm)
  (define-key calc-mode-map "vO" 'calc-outer-product)
  (define-key calc-mode-map "vR" 'calc-reduce)
  (define-key calc-mode-map "vS" 'calc-sort)
  (define-key calc-mode-map "vT" 'calc-mtrace)
  (define-key calc-mode-map "vU" 'calc-accumulate)
  (define-key calc-mode-map "vV" 'calc-set-union)
  (define-key calc-mode-map "vX" 'calc-set-xor)
  (define-key calc-mode-map "v^" 'calc-set-intersect)
  (define-key calc-mode-map "v-" 'calc-set-difference)
  (define-key calc-mode-map "v~" 'calc-set-complement)
  (define-key calc-mode-map "v:" 'calc-set-span)
  (define-key calc-mode-map "v#" 'calc-set-cardinality)
  (define-key calc-mode-map "v+" 'calc-remove-duplicates)
  (define-key calc-mode-map "v&" 'calc-inv)
  (define-key calc-mode-map "v<" 'calc-matrix-left-justify)
  (define-key calc-mode-map "v=" 'calc-matrix-center-justify)
  (define-key calc-mode-map "v>" 'calc-matrix-right-justify)
  (define-key calc-mode-map "v." 'calc-full-vectors)
  (define-key calc-mode-map "v/" 'calc-break-vectors)
  (define-key calc-mode-map "v," 'calc-vector-commas)
  (define-key calc-mode-map "v[" 'calc-vector-brackets)
  (define-key calc-mode-map "v]" 'calc-matrix-brackets)
  (define-key calc-mode-map "v{" 'calc-vector-braces)
  (define-key calc-mode-map "v}" 'calc-matrix-brackets)
  (define-key calc-mode-map "v(" 'calc-vector-parens)
  (define-key calc-mode-map "v)" 'calc-matrix-brackets)
Stefan Monnier's avatar
Stefan Monnier committed
631 632 633
  ;; We can't rely on the automatic upper->lower conversion because
  ;; in the global map V is explicitly bound, so we need to bind it
  ;; explicitly as well :-(  --stef
Eli Zaretskii's avatar
Eli Zaretskii committed
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669
  (define-key calc-mode-map "V" (lookup-key calc-mode-map "v"))

  (define-key calc-mode-map "z" 'nil)
  (define-key calc-mode-map "z?" 'calc-z-prefix-help)

  (define-key calc-mode-map "Z" 'nil)
  (define-key calc-mode-map "Z?" 'calc-shift-Z-prefix-help)
  (define-key calc-mode-map "ZC" 'calc-user-define-composition)
  (define-key calc-mode-map "ZD" 'calc-user-define)
  (define-key calc-mode-map "ZE" 'calc-user-define-edit)
  (define-key calc-mode-map "ZF" 'calc-user-define-formula)
  (define-key calc-mode-map "ZG" 'calc-get-user-defn)
  (define-key calc-mode-map "ZI" 'calc-user-define-invocation)
  (define-key calc-mode-map "ZK" 'calc-user-define-kbd-macro)
  (define-key calc-mode-map "ZP" 'calc-user-define-permanent)
  (define-key calc-mode-map "ZS" 'calc-edit-user-syntax)
  (define-key calc-mode-map "ZT" 'calc-timing)
  (define-key calc-mode-map "ZU" 'calc-user-undefine)
  (define-key calc-mode-map "Z[" 'calc-kbd-if)
  (define-key calc-mode-map "Z:" 'calc-kbd-else)
  (define-key calc-mode-map "Z|" 'calc-kbd-else-if)
  (define-key calc-mode-map "Z]" 'calc-kbd-end-if)
  (define-key calc-mode-map "Z<" 'calc-kbd-repeat)
  (define-key calc-mode-map "Z>" 'calc-kbd-end-repeat)
  (define-key calc-mode-map "Z(" 'calc-kbd-for)
  (define-key calc-mode-map "Z)" 'calc-kbd-end-for)
  (define-key calc-mode-map "Z{" 'calc-kbd-loop)
  (define-key calc-mode-map "Z}" 'calc-kbd-end-loop)
  (define-key calc-mode-map "Z/" 'calc-kbd-break)
  (define-key calc-mode-map "Z`" 'calc-kbd-push)
  (define-key calc-mode-map "Z'" 'calc-kbd-pop)
  (define-key calc-mode-map "Z=" 'calc-kbd-report)
  (define-key calc-mode-map "Z#" 'calc-kbd-query)

  (calc-init-prefixes)

670 671 672 673 674 675 676 677 678
  (mapc (function
	 (lambda (x)
	  (define-key calc-mode-map (format "c%c" x) 'calc-clean-num)
	  (define-key calc-mode-map (format "j%c" x) 'calc-select-part)
	  (define-key calc-mode-map (format "r%c" x) 'calc-recall-quick)
	  (define-key calc-mode-map (format "s%c" x) 'calc-store-quick)
	  (define-key calc-mode-map (format "t%c" x) 'calc-store-into-quick)
	  (define-key calc-mode-map (format "u%c" x) 'calc-quick-units)))
	"0123456789")
Eli Zaretskii's avatar
Eli Zaretskii committed
679 680

  (let ((i ?A))
681 682 683 684 685
    (while (<= i ?z)
      (if (eq (car-safe (aref (nth 1 calc-mode-map) i)) 'keymap)
	  (aset (nth 1 calc-mode-map) i
		(cons 'keymap (cons (cons ?\e (aref (nth 1 calc-mode-map) i))
				    (cdr (aref (nth 1 calc-mode-map) i))))))
Eli Zaretskii's avatar
Eli Zaretskii committed
686
      (setq i (1+ i))))
687

688 689
  (setq calc-alg-map (copy-keymap calc-mode-map)
	calc-alg-esc-map (copy-keymap esc-map))
Eli Zaretskii's avatar
Eli Zaretskii committed
690 691 692
  (let ((i 32))
    (while (< i 127)
      (or (memq i '(?' ?` ?= ??))
693
	  (aset (nth 1 calc-alg-map) i 'calc-auto-algebraic-entry))
Eli Zaretskii's avatar
Eli Zaretskii committed
694
      (or (memq i '(?# ?x ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9))
695
	  (aset (nth 1 calc-alg-esc-map) i (aref (nth 1 calc-mode-map) i)))
Eli Zaretskii's avatar
Eli Zaretskii committed
696 697 698 699 700
      (setq i (1+ i))))
  (define-key calc-alg-map "\e" calc-alg-esc-map)
  (define-key calc-alg-map "\e\t" 'calc-roll-up)
  (define-key calc-alg-map "\e\C-m" 'calc-last-args-stub)
  (define-key calc-alg-map "\e\177" 'calc-pop-above)
701

Eli Zaretskii's avatar
Eli Zaretskii committed
702
;;;; (Autoloads here)
703
  (mapc (function (lambda (x)
Eli Zaretskii's avatar
Eli Zaretskii committed
704 705 706 707
    (mapcar (function (lambda (func)
      (autoload func (car x)))) (cdr x))))
    '(

708
 ("calc-alg" calc-has-rules math-defsimplify
Eli Zaretskii's avatar
Eli Zaretskii committed
709 710
calc-modify-simplify-mode calcFunc-collect calcFunc-esimplify
calcFunc-islin calcFunc-islinnt calcFunc-lin calcFunc-linnt
711
calcFunc-simplify calcFunc-subst calcFunc-powerexpand math-beforep
Eli Zaretskii's avatar
Eli Zaretskii committed
712 713 714 715
math-build-polynomial-expr math-expand-formula math-expr-contains
math-expr-contains-count math-expr-depends math-expr-height
math-expr-subst math-expr-weight math-integer-plus math-is-linear
math-is-multiple math-is-polynomial math-linear-in math-multiple-of
716
math-poly-depends math-poly-mix math-poly-mul
Eli Zaretskii's avatar
Eli Zaretskii committed
717 718 719 720 721
math-poly-simplify math-poly-zerop math-polynomial-base
math-polynomial-p math-recompile-eval-rules math-simplify
math-simplify-exp math-simplify-extended math-simplify-sqrt
math-to-simple-fraction)

722
 ("calcalg2" calcFunc-asum calcFunc-deriv
Eli Zaretskii's avatar
Eli Zaretskii committed
723 724 725 726 727 728 729 730
calcFunc-ffinv calcFunc-finv calcFunc-fsolve calcFunc-gpoly
calcFunc-integ calcFunc-poly calcFunc-prod calcFunc-roots
calcFunc-solve calcFunc-sum calcFunc-table calcFunc-taylor
calcFunc-tderiv math-expr-calls math-integral-q02 math-integral-q12
math-integral-rational-funcs math-lcm-denoms math-looks-evenp
math-poly-all-roots math-prod-rec math-reject-solution math-solve-eqn
math-solve-for math-sum-rec math-try-integral)

731
 ("calcalg3" calcFunc-efit calcFunc-fit
Eli Zaretskii's avatar
Eli Zaretskii committed
732 733 734 735 736 737 738
calcFunc-fitdummy calcFunc-fitparam calcFunc-fitvar
calcFunc-hasfitparams calcFunc-hasfitvars calcFunc-maximize
calcFunc-minimize calcFunc-ninteg calcFunc-polint calcFunc-ratint
calcFunc-root calcFunc-wmaximize calcFunc-wminimize calcFunc-wroot
calcFunc-xfit math-find-minimum math-find-root math-ninteg-evaluate
math-ninteg-midpoint math-ninteg-romberg math-poly-interp)

739
 ("calc-arith" calcFunc-abs calcFunc-abssqr
Eli Zaretskii's avatar
Eli Zaretskii committed
740 741 742 743 744 745
calcFunc-add calcFunc-ceil calcFunc-decr calcFunc-deven calcFunc-dimag
calcFunc-dint calcFunc-div calcFunc-dnatnum calcFunc-dneg
calcFunc-dnonneg calcFunc-dnonzero calcFunc-dnumint calcFunc-dodd
calcFunc-dpos calcFunc-drange calcFunc-drat calcFunc-dreal
calcFunc-dscalar calcFunc-fceil calcFunc-ffloor calcFunc-float
calcFunc-fround calcFunc-frounde calcFunc-froundu calcFunc-ftrunc
746
calcFunc-idiv calcFunc-incr calcFunc-ldiv calcFunc-mant calcFunc-max calcFunc-min
Eli Zaretskii's avatar
Eli Zaretskii committed
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764
calcFunc-mod calcFunc-mul calcFunc-neg calcFunc-percent calcFunc-pow
calcFunc-relch calcFunc-round calcFunc-rounde calcFunc-roundu
calcFunc-scf calcFunc-sub calcFunc-xpon math-abs math-abs-approx
math-add-objects-fancy math-add-or-sub math-add-symb-fancy
math-ceiling math-combine-prod math-combine-sum math-div-by-zero
math-div-objects-fancy math-div-symb-fancy math-div-zero
math-float-fancy math-floor-fancy math-floor-special math-guess-if-neg
math-intv-constp math-known-evenp math-known-imagp math-known-integerp
math-known-matrixp math-known-negp math-known-nonnegp
math-known-nonposp math-known-nonzerop math-known-num-integerp
math-known-oddp math-known-posp math-known-realp math-known-scalarp
math-max math-min math-mod-fancy math-mul-float math-mul-objects-fancy
math-mul-or-div math-mul-symb-fancy math-mul-zero math-neg-fancy
math-neg-float math-okay-neg math-possible-signs math-possible-types
math-pow-fancy math-pow-mod math-pow-of-zero math-pow-zero
math-quarter-integer math-round math-setup-declarations math-sqr
math-sqr-float math-trunc-fancy math-trunc-special)

765
 ("calc-bin" calcFunc-and calcFunc-ash
766
calcFunc-clip calcFunc-diff calcFunc-lsh calcFunc-not calcFunc-or
Eli Zaretskii's avatar
Eli Zaretskii committed
767 768 769 770 771 772 773
calcFunc-rash calcFunc-rot calcFunc-rsh calcFunc-xor math-clip
math-compute-max-digits math-convert-radix-digits math-float-parts
math-format-bignum-binary math-format-bignum-hex
math-format-bignum-octal math-format-bignum-radix math-format-binary
math-format-radix math-format-radix-float math-integer-log2
math-power-of-2 math-radix-float-power)

774
 ("calc-comb"  calc-report-prime-test
Eli Zaretskii's avatar
Eli Zaretskii committed
775 776 777 778 779 780 781
calcFunc-choose calcFunc-dfact calcFunc-egcd calcFunc-fact
calcFunc-gcd calcFunc-lcm calcFunc-moebius calcFunc-nextprime
calcFunc-perm calcFunc-prevprime calcFunc-prfac calcFunc-prime
calcFunc-random calcFunc-shuffle calcFunc-stir1 calcFunc-stir2
calcFunc-totient math-init-random-base math-member math-prime-test
math-random-base)

782
 ("calccomp" calcFunc-cascent calcFunc-cdescent
Eli Zaretskii's avatar
Eli Zaretskii committed
783 784 785 786 787
calcFunc-cheight calcFunc-cwidth math-comp-ascent math-comp-descent
math-comp-height math-comp-width math-compose-expr
math-composition-to-string math-stack-value-offset-fancy
math-vector-is-string math-vector-to-string)

788
 ("calc-cplx" calcFunc-arg calcFunc-conj
Eli Zaretskii's avatar
Eli Zaretskii committed
789 790 791 792
calcFunc-im calcFunc-polar calcFunc-re calcFunc-rect math-complex
math-fix-circular math-imaginary math-imaginary-i math-normalize-polar
math-polar math-want-polar)

793
 ("calc-embed" calc-do-embedded
Eli Zaretskii's avatar
Eli Zaretskii committed
794
calc-do-embedded-activate calc-embedded-evaluate-expr
795 796
calc-embedded-modes-change calc-embedded-var-change
calc-embedded-preserve-modes)
Eli Zaretskii's avatar
Eli Zaretskii committed
797

798
 ("calc-fin" calc-to-percentage calcFunc-ddb
Eli Zaretskii's avatar
Eli Zaretskii committed
799 800 801 802 803
calcFunc-fv calcFunc-fvb calcFunc-fvl calcFunc-irr calcFunc-irrb
calcFunc-nper calcFunc-nperb calcFunc-nperl calcFunc-npv calcFunc-npvb
calcFunc-pmt calcFunc-pmtb calcFunc-pv calcFunc-pvb calcFunc-pvl
calcFunc-rate calcFunc-rateb calcFunc-ratel calcFunc-sln calcFunc-syd)

804
 ("calc-forms" calcFunc-badd calcFunc-bsub
Eli Zaretskii's avatar
Eli Zaretskii committed
805 806 807 808 809 810 811 812 813 814 815 816 817 818
calcFunc-date calcFunc-day calcFunc-dsadj calcFunc-hms
calcFunc-holiday calcFunc-hour calcFunc-incmonth calcFunc-incyear
calcFunc-intv calcFunc-julian calcFunc-makemod calcFunc-minute
calcFunc-month calcFunc-newmonth calcFunc-newweek calcFunc-newyear
calcFunc-now calcFunc-pwday calcFunc-sdev calcFunc-second
calcFunc-time calcFunc-tzconv calcFunc-tzone calcFunc-unixtime
calcFunc-weekday calcFunc-year calcFunc-yearday math-combine-intervals
math-date-parts math-date-to-dt math-div-mod math-dt-to-date
math-format-date math-from-business-day math-from-hms math-make-intv
math-make-mod math-make-sdev math-mod-intv math-normalize-hms
math-normalize-mod math-parse-date math-read-angle-brackets
math-setup-add-holidays math-setup-holidays math-setup-year-holidays
math-sort-intv math-to-business-day math-to-hms)

819
 ("calc-frac" calc-add-fractions
Eli Zaretskii's avatar
Eli Zaretskii committed
820 821 822
calc-div-fractions calc-mul-fractions calcFunc-fdiv calcFunc-frac
math-make-frac)

823
 ("calc-funcs" calc-prob-dist calcFunc-bern
Eli Zaretskii's avatar
Eli Zaretskii committed
824 825 826 827 828 829 830 831
calcFunc-besJ calcFunc-besY calcFunc-beta calcFunc-betaB
calcFunc-betaI calcFunc-erf calcFunc-erfc calcFunc-euler
calcFunc-gamma calcFunc-gammaG calcFunc-gammaP calcFunc-gammaQ
calcFunc-gammag calcFunc-ltpb calcFunc-ltpc calcFunc-ltpf
calcFunc-ltpn calcFunc-ltpp calcFunc-ltpt calcFunc-utpb calcFunc-utpc
calcFunc-utpf calcFunc-utpn calcFunc-utpp calcFunc-utpt
math-bernoulli-number math-gammap1-raw)

832
 ("calc-graph" calc-graph-show-tty)
Eli Zaretskii's avatar
Eli Zaretskii committed
833

834
 ("calc-incom" calc-digit-dots)
Eli Zaretskii's avatar
Eli Zaretskii committed
835

836
 ("calc-keypd" calc-do-keypad
Eli Zaretskii's avatar
Eli Zaretskii committed
837 838 839
calc-keypad-x-left-click calc-keypad-x-middle-click
calc-keypad-x-right-click)

840
 ("calc-lang" calc-set-language
Eli Zaretskii's avatar
Eli Zaretskii committed
841 842
math-read-big-balance math-read-big-rec)

843
 ("calc-map" calc-get-operator calcFunc-accum
Eli Zaretskii's avatar
Eli Zaretskii committed
844 845 846 847 848 849 850 851 852 853
calcFunc-afixp calcFunc-anest calcFunc-apply calcFunc-call
calcFunc-fixp calcFunc-inner calcFunc-map calcFunc-mapa calcFunc-mapc
calcFunc-mapd calcFunc-mapeq calcFunc-mapeqp calcFunc-mapeqr
calcFunc-mapr calcFunc-nest calcFunc-outer calcFunc-raccum
calcFunc-reduce calcFunc-reducea calcFunc-reducec calcFunc-reduced
calcFunc-reducer calcFunc-rreduce calcFunc-rreducea calcFunc-rreducec
calcFunc-rreduced calcFunc-rreducer math-build-call
math-calcFunc-to-var math-multi-subst math-multi-subst-rec
math-var-to-calcFunc)

854
 ("calc-mtx" calcFunc-det calcFunc-lud calcFunc-tr
Eli Zaretskii's avatar
Eli Zaretskii committed
855 856 857
math-col-matrix math-lud-solve math-matrix-inv-raw math-matrix-lud
math-mul-mat-vec math-mul-mats math-row-matrix)

858
 ("calc-math" calcFunc-alog calcFunc-arccos
Eli Zaretskii's avatar
Eli Zaretskii committed
859
calcFunc-arccosh calcFunc-arcsin calcFunc-arcsincos calcFunc-arcsinh
Jay Belanger's avatar
Jay Belanger committed
860 861 862
calcFunc-arctan calcFunc-arctan2 calcFunc-arctanh calcFunc-csc
calcFunc-csch calcFunc-cos calcFunc-cosh calcFunc-cot calcFunc-coth
calcFunc-deg calcFunc-exp calcFunc-exp10 calcFunc-expm1
Eli Zaretskii's avatar
Eli Zaretskii committed
863
calcFunc-hypot calcFunc-ilog calcFunc-isqrt calcFunc-ln calcFunc-lnp1
Jay Belanger's avatar
Jay Belanger committed
864 865
calcFunc-log calcFunc-log10 calcFunc-nroot calcFunc-rad calcFunc-sec
calcFunc-sech calcFunc-sin
Eli Zaretskii's avatar
Eli Zaretskii committed
866 867
calcFunc-sincos calcFunc-sinh calcFunc-sqr calcFunc-sqrt calcFunc-tan
calcFunc-tanh math-arccos-raw math-arcsin-raw math-arctan-raw
Jay Belanger's avatar
Jay Belanger committed
868 869
math-arctan2-raw math-cos-raw math-cot-raw math-csc-raw
math-exp-minus-1-raw math-exp-raw
Eli Zaretskii's avatar
Eli Zaretskii committed
870 871 872 873 874 875
math-from-radians math-from-radians-2 math-hypot math-infinite-dir
math-isqrt-small math-ln-raw math-nearly-equal math-nearly-equal-float
math-nearly-zerop math-nearly-zerop-float math-nth-root
math-sin-cos-raw math-sin-raw math-sqrt math-sqrt-float math-sqrt-raw
math-tan-raw math-to-radians math-to-radians-2)

876
 ("calc-mode" math-get-modes-vec)
Eli Zaretskii's avatar
Eli Zaretskii committed
877

878
 ("calc-poly" calcFunc-apart calcFunc-expand
Eli Zaretskii's avatar
Eli Zaretskii committed
879 880 881 882 883 884 885 886 887 888 889 890
calcFunc-expandpow calcFunc-factor calcFunc-factors calcFunc-nrat
calcFunc-pcont calcFunc-pdeg calcFunc-pdiv calcFunc-pdivide
calcFunc-pdivrem calcFunc-pgcd calcFunc-plead calcFunc-pprim
calcFunc-prem math-accum-factors math-atomic-factorp
math-div-poly-const math-div-thru math-expand-power math-expand-term
math-factor-contains math-factor-expr math-factor-expr-part
math-factor-expr-try math-factor-finish math-factor-poly-coefs
math-factor-protect math-mul-thru math-padded-polynomial
math-partial-fractions math-poly-degree math-poly-deriv-coefs
math-poly-gcd-frac-list math-poly-modulus-rec math-ratpoly-p
math-to-ratpoly math-to-ratpoly-rec)

891
 ("calc-prog" calc-default-formula-arglist
Eli Zaretskii's avatar
Eli Zaretskii committed
892 893 894 895 896 897 898 899 900 901 902 903
calc-execute-kbd-macro calc-finish-user-syntax-edit
calc-fix-token-name calc-fix-user-formula calc-read-parse-table
calc-read-parse-table-part calc-subsetp calc-write-parse-table
calc-write-parse-table-part calcFunc-constant calcFunc-eq calcFunc-geq
calcFunc-gt calcFunc-if calcFunc-in calcFunc-integer calcFunc-istrue
calcFunc-land calcFunc-leq calcFunc-lnot calcFunc-lor calcFunc-lt
calcFunc-negative calcFunc-neq calcFunc-nonvar calcFunc-real
calcFunc-refers calcFunc-rmeq calcFunc-typeof calcFunc-variable
math-body-refers-to math-break math-composite-inequalities
math-do-defmath math-handle-for math-handle-foreach
math-normalize-logical-op math-return)

904
 ("calc-rewr" calcFunc-match calcFunc-matches
Eli Zaretskii's avatar
Eli Zaretskii committed
905 906 907 908 909 910 911
calcFunc-matchnot calcFunc-rewrite calcFunc-vmatches
math-apply-rewrites math-compile-patterns math-compile-rewrites
math-flatten-lands math-match-patterns math-rewrite
math-rewrite-heads)

 ("calc-rules" calc-CommuteRules calc-DistribRules calc-FactorRules
calc-FitRules calc-IntegAfterRules calc-InvertRules calc-JumpRules
912
calc-MergeRules calc-NegateRules
Eli Zaretskii's avatar
Eli Zaretskii committed
913 914
calc-compile-rule-set)

915
 ("calc-sel" calc-auto-selection
Eli Zaretskii's avatar
Eli Zaretskii committed
916 917 918 919 920 921
calc-delete-selection calc-encase-atoms calc-find-assoc-parent-formula
calc-find-parent-formula calc-find-sub-formula calc-prepare-selection
calc-preserve-point calc-replace-selections calc-replace-sub-formula
calc-roll-down-with-selections calc-roll-up-with-selections
calc-sel-error)

922
 ("calc-stat" calc-vector-op calcFunc-agmean
Eli Zaretskii's avatar
Eli Zaretskii committed
923 924 925 926 927 928
calcFunc-vcorr calcFunc-vcount calcFunc-vcov calcFunc-vflat
calcFunc-vgmean calcFunc-vhmean calcFunc-vmax calcFunc-vmean
calcFunc-vmeane calcFunc-vmedian calcFunc-vmin calcFunc-vpcov
calcFunc-vprod calcFunc-vpsdev calcFunc-vpvar calcFunc-vsdev
calcFunc-vsum calcFunc-vvar math-flatten-many-vecs)

929
 ("calc-store" calc-read-var-name
Eli Zaretskii's avatar
Eli Zaretskii committed
930 931
calc-store-value calc-var-name)

932
 ("calc-stuff" calc-explain-why calcFunc-clean
Eli Zaretskii's avatar
Eli Zaretskii committed
933 934
calcFunc-pclean calcFunc-pfloat calcFunc-pfrac)

935
 ("calc-units" calcFunc-usimplify
Eli Zaretskii's avatar
Eli Zaretskii committed
936 937 938 939 940 941
math-build-units-table math-build-units-table-buffer
math-check-unit-name math-convert-temperature math-convert-units
math-extract-units math-remove-units math-simplify-units
math-single-units-in-expr-p math-to-standard-units
math-units-in-expr-p)

942
 ("calc-vec" calcFunc-append calcFunc-appendrev
Eli Zaretskii's avatar
Eli Zaretskii committed
943
calcFunc-arrange calcFunc-cnorm calcFunc-cons calcFunc-cross
944
calcFunc-kron calcFunc-ctrn calcFunc-cvec calcFunc-diag calcFunc-find
Eli Zaretskii's avatar
Eli Zaretskii committed
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960
calcFunc-getdiag calcFunc-grade calcFunc-head calcFunc-histogram
calcFunc-idn calcFunc-index calcFunc-mcol calcFunc-mdims
calcFunc-mrcol calcFunc-mrow calcFunc-mrrow calcFunc-pack
calcFunc-rcons calcFunc-rdup calcFunc-rev calcFunc-rgrade
calcFunc-rhead calcFunc-rnorm calcFunc-rsort calcFunc-rsubvec
calcFunc-rtail calcFunc-sort calcFunc-subscr calcFunc-subvec
calcFunc-tail calcFunc-trn calcFunc-unpack calcFunc-unpackt
calcFunc-vcard calcFunc-vcompl calcFunc-vconcat calcFunc-vconcatrev
calcFunc-vdiff calcFunc-vec calcFunc-venum calcFunc-vexp
calcFunc-vfloor calcFunc-vint calcFunc-vlen calcFunc-vmask
calcFunc-vpack calcFunc-vspan calcFunc-vunion calcFunc-vunpack
calcFunc-vxor math-check-for-commas math-clean-set math-copy-matrix
math-dimension-error math-dot-product math-flatten-vector math-map-vec
math-map-vec-2 math-mat-col math-mimic-ident math-prepare-set
math-read-brackets math-reduce-cols math-reduce-vec math-transpose)

961
 ("calc-yank" calc-alg-edit calc-clean-newlines
Eli Zaretskii's avatar
Eli Zaretskii committed
962
calc-do-grab-rectangle calc-do-grab-region calc-finish-stack-edit
963 964
calc-copy-to-register calc-insert-register 
calc-append-to-register calc-prepend-to-register
Eli Zaretskii's avatar
Eli Zaretskii committed
965 966 967 968 969 970 971 972 973 974 975 976
calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer)

))

  (mapcar (function (lambda (x)
    (mapcar (function (lambda (cmd)
      (autoload cmd (car x) nil t))) (cdr x))))
    '(

 ("calc-alg" calc-alg-evaluate calc-apart calc-collect calc-expand
calc-expand-formula calc-factor calc-normalize-rat calc-poly-div
calc-poly-div-rem calc-poly-gcd calc-poly-rem calc-simplify
977
calc-simplify-extended calc-substitute calc-powerexpand)
Eli Zaretskii's avatar
Eli Zaretskii committed
978

979
 ("calcalg2" calc-alt-summation calc-derivative
Eli Zaretskii's avatar
Eli Zaretskii committed
980 981 982 983
calc-dump-integral-cache calc-integral calc-num-integral
calc-poly-roots calc-product calc-solve-for calc-summation
calc-tabulate calc-taylor)

984
 ("calcalg3" calc-curve-fit calc-find-maximum calc-find-minimum
Eli Zaretskii's avatar
Eli Zaretskii committed
985 986 987 988 989 990
calc-find-root calc-poly-interp)

 ("calc-arith" calc-abs calc-abssqr calc-ceiling calc-decrement
calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min
calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part)

991
 ("calc-bin" calc-and calc-binary-radix calc-clip calc-twos-complement-mode
992
calc-decimal-radix calc-diff calc-hex-radix calc-leading-zeros 
993
calc-lshift-arith calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix
Eli Zaretskii's avatar
Eli Zaretskii committed
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size
calc-xor)

 ("calc-comb" calc-choose calc-double-factorial calc-extended-gcd
calc-factorial calc-gamma calc-gcd calc-lcm calc-moebius
calc-next-prime calc-perm calc-prev-prime calc-prime-factors
calc-prime-test calc-random calc-random-again calc-rrandom
calc-shuffle calc-totient)

 ("calc-cplx" calc-argument calc-complex-notation calc-i-notation
calc-im calc-j-notation calc-polar calc-polar-mode calc-re)

 ("calc-embed" calc-embedded-copy-formula-as-kill
calc-embedded-duplicate calc-embedded-edit calc-embedded-forget
calc-embedded-kill-formula calc-embedded-mark-formula
calc-embedded-new-formula calc-embedded-next calc-embedded-previous
calc-embedded-select calc-embedded-update-formula calc-embedded-word
calc-find-globals calc-show-plain)

 ("calc-fin" calc-convert-percent calc-fin-ddb calc-fin-fv
calc-fin-irr calc-fin-nper calc-fin-npv calc-fin-pmt calc-fin-pv
calc-fin-rate calc-fin-sln calc-fin-syd calc-percent-change)

 ("calc-forms" calc-business-days-minus calc-business-days-plus
calc-convert-time-zones calc-date calc-date-notation calc-date-part
calc-from-hms calc-hms-mode calc-hms-notation calc-inc-month
calc-julian calc-new-month calc-new-week calc-new-year calc-now
calc-time calc-time-zone calc-to-hms calc-unix-time)

 ("calc-frac" calc-fdiv calc-frac-mode calc-fraction
calc-over-notation calc-slash-notation)

 ("calc-funcs" calc-bernoulli-number calc-bessel-J calc-bessel-Y
calc-beta calc-erf calc-erfc calc-euler-number calc-inc-beta
calc-inc-gamma calc-stirling-number calc-utpb calc-utpc calc-utpf
calc-utpn calc-utpp calc-utpt)

 ("calc-graph" calc-graph-add calc-graph-add-3d calc-graph-border
calc-graph-clear calc-graph-command calc-graph-delete
calc-graph-device calc-graph-display calc-graph-fast
calc-graph-fast-3d calc-graph-geometry calc-graph-grid
calc-graph-header calc-graph-hide calc-graph-juggle calc-graph-key
calc-graph-kill calc-graph-line-style calc-graph-log-x
calc-graph-log-y calc-graph-log-z calc-graph-name
calc-graph-num-points calc-graph-output calc-graph-plot
calc-graph-point-style calc-graph-print calc-graph-quit
calc-graph-range-x calc-graph-range-y calc-graph-range-z
calc-graph-show-dumb calc-graph-title-x calc-graph-title-y
calc-graph-title-z calc-graph-view-commands calc-graph-view-trail
calc-graph-zero-x calc-graph-zero-y)

 ("calc-help" calc-a-prefix-help calc-b-prefix-help calc-c-prefix-help
calc-d-prefix-help calc-describe-function calc-describe-key
calc-describe-key-briefly calc-describe-variable calc-f-prefix-help
calc-full-help calc-g-prefix-help calc-help-prefix
1049
calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help calc-option-prefix-help
Eli Zaretskii's avatar
Eli Zaretskii committed
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
calc-inverse-prefix-help calc-j-prefix-help calc-k-prefix-help
calc-m-prefix-help calc-r-prefix-help calc-s-prefix-help
calc-t-prefix-help calc-u-prefix-help calc-v-prefix-help)

 ("calc-incom" calc-begin-complex calc-begin-vector calc-comma
calc-dots calc-end-complex calc-end-vector calc-semi)

 ("calc-keypd" calc-keypad-menu calc-keypad-menu-back
calc-keypad-press)

 ("calc-lang" calc-big-language calc-c-language calc-eqn-language
calc-flat-language calc-fortran-language calc-maple-language
1062
calc-yacas-language calc-maxima-language calc-giac-language
Eli Zaretskii's avatar
Eli Zaretskii committed
1063
calc-mathematica-language calc-normal-language calc-pascal-language
1064
calc-tex-language calc-latex-language calc-unformatted-language)
Eli Zaretskii's avatar
Eli Zaretskii committed
1065 1066 1067 1068

 ("calc-map" calc-accumulate calc-apply calc-inner-product calc-map
calc-map-equation calc-map-stack calc-outer-product calc-reduce)

1069
 ("calc-mtx" calc-mdet calc-mlud calc-mtrace)
Eli Zaretskii's avatar
Eli Zaretskii committed
1070 1071 1072

 ("calc-math" calc-arccos calc-arccosh calc-arcsin calc-arcsinh
calc-arctan calc-arctan2 calc-arctanh calc-conj calc-cos calc-cosh
Jay Belanger's avatar
Jay Belanger committed
1073
calc-cot calc-coth calc-csc calc-csch
Eli Zaretskii's avatar
Eli Zaretskii committed
1074 1075
calc-degrees-mode calc-exp calc-expm1 calc-hypot calc-ilog
calc-imaginary calc-isqrt calc-ln calc-lnp1 calc-log calc-log10
1076
calc-pi calc-radians-mode calc-sec calc-sech
Jay Belanger's avatar
Jay Belanger committed
1077
calc-sin calc-sincos calc-sinh calc-sqrt
Eli Zaretskii's avatar
Eli Zaretskii committed
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122
calc-tan calc-tanh calc-to-degrees calc-to-radians)

 ("calc-mode" calc-alg-simplify-mode calc-algebraic-mode
calc-always-load-extensions calc-auto-recompute calc-auto-why
calc-bin-simplify-mode calc-break-vectors calc-center-justify
calc-default-simplify-mode calc-display-raw calc-eng-notation
calc-ext-simplify-mode calc-fix-notation calc-full-trail-vectors
calc-full-vectors calc-get-modes calc-group-char calc-group-digits
calc-infinite-mode calc-left-justify calc-left-label
calc-line-breaking calc-line-numbering calc-matrix-brackets
calc-matrix-center-justify calc-matrix-left-justify calc-matrix-mode
calc-matrix-right-justify calc-mode-record-mode calc-no-simplify-mode
calc-normal-notation calc-num-simplify-mode calc-point-char
calc-right-justify calc-right-label calc-save-modes calc-sci-notation
calc-settings-file-name calc-shift-prefix calc-symbolic-mode
calc-total-algebraic-mode calc-truncate-down calc-truncate-stack
calc-truncate-up calc-units-simplify-mode calc-vector-braces
calc-vector-brackets calc-vector-commas calc-vector-parens
calc-working)

 ("calc-prog" calc-call-last-kbd-macro calc-edit-user-syntax
calc-equal-to calc-get-user-defn calc-greater-equal calc-greater-than
calc-in-set calc-kbd-break calc-kbd-else calc-kbd-else-if
calc-kbd-end-for calc-kbd-end-if calc-kbd-end-loop calc-kbd-end-repeat
calc-kbd-for calc-kbd-if calc-kbd-loop calc-kbd-pop calc-kbd-push
calc-kbd-query calc-kbd-repeat calc-kbd-report calc-less-equal
calc-less-than calc-logical-and calc-logical-if calc-logical-not
calc-logical-or calc-not-equal-to calc-pass-errors calc-remove-equal
calc-timing calc-user-define calc-user-define-composition
calc-user-define-edit calc-user-define-formula
calc-user-define-invocation calc-user-define-kbd-macro
calc-user-define-permanent calc-user-undefine)

 ("calc-rewr" calc-match calc-rewrite calc-rewrite-selection)

 ("calc-sel" calc-break-selections calc-clear-selections
calc-copy-selection calc-del-selection calc-edit-selection
calc-enable-selections calc-enter-selection calc-sel-add-both-sides
calc-sel-div-both-sides calc-sel-evaluate calc-sel-expand-formula
calc-sel-mult-both-sides calc-sel-sub-both-sides
calc-select-additional calc-select-here calc-select-here-maybe
calc-select-less calc-select-more calc-select-next calc-select-once
calc-select-once-maybe calc-select-part calc-select-previous
calc-show-selections calc-unselect)

1123
 ("calcsel2" calc-commute-left calc-commute-right calc-sel-commute
Eli Zaretskii's avatar
Eli Zaretskii committed
1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134
calc-sel-distribute calc-sel-invert calc-sel-isolate
calc-sel-jump-equals calc-sel-merge calc-sel-negate calc-sel-unpack)

 ("calc-stat" calc-vector-correlation calc-vector-count
calc-vector-covariance calc-vector-geometric-mean
calc-vector-harmonic-mean calc-vector-max calc-vector-mean
calc-vector-mean-error calc-vector-median calc-vector-min
calc-vector-pop-covariance calc-vector-pop-sdev
calc-vector-pop-variance calc-vector-product calc-vector-sdev
calc-vector-sum calc-vector-variance)

1135 1136
 ("calc-store" calc-assign calc-copy-special-constant
calc-copy-variable calc-declare-variable
Eli Zaretskii's avatar
Eli Zaretskii committed
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150
calc-edit-AlgSimpRules calc-edit-Decls calc-edit-EvalRules
calc-edit-ExtSimpRules calc-edit-FitRules calc-edit-GenCount
calc-edit-Holidays calc-edit-IntegLimit calc-edit-LineStyles
calc-edit-PlotRejects calc-edit-PointStyles calc-edit-TimeZone
calc-edit-Units calc-edit-variable calc-evalto calc-insert-variables
calc-let calc-permanent-variable calc-recall calc-recall-quick
calc-store calc-store-concat calc-store-decr calc-store-div
calc-store-exchange calc-store-incr calc-store-into
calc-store-into-quick calc-store-inv calc-store-map calc-store-minus
calc-store-neg calc-store-plus calc-store-power calc-store-quick
calc-store-times calc-subscript calc-unstore)

 ("calc-stuff" calc-clean calc-clean-num calc-flush-caches
calc-less-recursion-depth calc-more-recursion-depth calc-num-prefix
1151
calc-why)
Eli Zaretskii's avatar
Eli Zaretskii committed
1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168

 ("calc-trail" calc-trail-backward calc-trail-first calc-trail-forward
calc-trail-in calc-trail-isearch-backward calc-trail-isearch-forward
calc-trail-kill calc-trail-last calc-trail-marker calc-trail-next
calc-trail-out calc-trail-previous calc-trail-scroll-left
calc-trail-scroll-right calc-trail-yank)

 ("calc-undo" calc-last-args calc-redo calc-undo)

 ("calc-units" calc-autorange-units calc-base-units
calc-convert-temperature calc-convert-units calc-define-unit
calc-enter-units-table calc-explain-units calc-extract-units
calc-get-unit-definition calc-permanent-units calc-quick-units
calc-remove-units calc-simplify-units calc-undefine-unit
calc-view-units-table)

 ("calc-vec" calc-arrange-vector calc-build-vector calc-cnorm
1169
calc-conj-transpose calc-cons calc-cross calc-kron calc-diag
Eli Zaretskii's avatar
Eli Zaretskii committed
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180
calc-display-strings calc-expand-vector calc-grade calc-head
calc-histogram calc-ident calc-index calc-mask-vector calc-mcol
calc-mrow calc-pack calc-pack-bits calc-remove-duplicates
calc-reverse-vector calc-rnorm calc-set-cardinality
calc-set-complement calc-set-difference calc-set-enumerate
calc-set-floor calc-set-intersect calc-set-span calc-set-union
calc-set-xor calc-sort calc-subvector calc-tail calc-transpose
calc-unpack calc-unpack-bits calc-vector-find calc-vlength)

 ("calc-yank" calc-copy-as-kill calc-copy-region-as-kill
calc-copy-to-buffer calc-edit calc-edit-cancel calc-edit-mode
1181
calc-kill calc-kill-region calc-yank))))
Eli Zaretskii's avatar
Eli Zaretskii committed
1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208

(defun calc-init-prefixes ()
  (if calc-shift-prefix
      (progn
	(define-key calc-mode-map "A" (lookup-key calc-mode-map "a"))
	(define-key calc-mode-map "B" (lookup-key calc-mode-map "b"))
	(define-key calc-mode-map "C" (lookup-key calc-mode-map "c"))
	(define-key calc-mode-map "D" (lookup-key calc-mode-map "d"))
	(define-key calc-mode-map "F" (lookup-key calc-mode-map "f"))
	(define-key calc-mode-map "G" (lookup-key calc-mode-map "g"))
	(define-key calc-mode-map "J" (lookup-key calc-mode-map "j"))
	(define-key calc-mode-map "K" (lookup-key calc-mode-map "k"))
	(define-key calc-mode-map "M" (lookup-key calc-mode-map "m"))
	(define-key calc-mode-map "S" (lookup-key calc-mode-map "s"))
	(define-key calc-mode-map "T" (lookup-key calc-mode-map "t"))
	(define-key calc-mode-map "U" (lookup-key calc-mode-map "u")))
    (define-key calc-mode-map "A" 'calc-abs)
    (define-key calc-mode-map "B" 'calc-log)
    (define-key calc-mode-map "C" 'calc-cos)
    (define-key calc-mode-map "D" 'calc-redo)
    (define-key calc-mode-map "F" 'calc-floor)
    (define-key calc-mode-map "G" 'calc-argument)
    (define-key calc-mode-map "J" 'calc-conj)
    (define-key calc-mode-map "K" 'calc-keep-args)
    (define-key calc-mode-map "M" 'calc-more-recursion-depth)
    (define-key calc-mode-map "S" 'calc-sin)
    (define-key calc-mode-map "T" 'calc-tan)
1209
    (define-key calc-mode-map "U" 'calc-undo)))
Eli Zaretskii's avatar
Eli Zaretskii committed
1210 1211 1212 1213 1214 1215 1216 1217

(calc-init-extensions)




;;;; Miscellaneous.

1218 1219 1220
;; calc-command-flags is declared in calc.el
(defvar calc-command-flags)

Eli Zaretskii's avatar
Eli Zaretskii committed
1221
(defun calc-clear-command-flag (f)
1222
  (setq calc-command-flags (delq f calc-command-flags)))
Eli Zaretskii's avatar
Eli Zaretskii committed
1223 1224 1225 1226 1227 1228


(defun calc-record-message (tag &rest args)
  (let ((msg (apply 'format args)))
    (message "%s" msg)
    (calc-record msg tag))
1229
  (calc-clear-command-flag 'clear-message))
Eli Zaretskii's avatar
Eli Zaretskii committed
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247


(defun calc-normalize-fancy (val)
  (let ((simp (if (consp calc-simplify-mode)
		  (car calc-simplify-mode)
		calc-simplify-mode)))
    (cond ((eq simp 'binary)
	   (let ((s (math-normalize val)))
	     (if (math-realp s)
		 (math-clip (math-round s))
	       s)))
	  ((eq simp 'alg)
	   (math-simplify val))
	  ((eq simp 'ext)
	   (math-simplify-extended val))
	  ((eq simp 'units)
	   (math-simplify-units val))
	  (t  ; nil, none, num
1248
	   (math-normalize val)))))
Eli Zaretskii's avatar
Eli Zaretskii committed
1249 1250


1251
(defvar calc-help-map nil)
Eli Zaretskii's avatar
Eli Zaretskii committed
1252

1253
(if calc-help-map
Eli Zaretskii's avatar
Eli Zaretskii committed
1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
    nil
  (setq calc-help-map (make-keymap))
  (define-key calc-help-map "b" 'calc-describe-bindings)
  (define-key calc-help-map "c" 'calc-describe-key-briefly)
  (define-key calc-help-map "f" 'calc-describe-function)
  (define-key calc-help-map "h" 'calc-full-help)
  (define-key calc-help-map "i" 'calc-info)
  (define-key calc-help-map "k" 'calc-describe-key)
  (define-key calc-help-map "n" 'calc-view-news)
  (define-key calc-help-map "s" 'calc-info-summary)
  (define-key calc-help-map "t" 'calc-tutorial)
  (define-key calc-help-map "v" 'calc-describe-variable)
  (define-key calc-help-map "\C-c" 'calc-describe-copying)
  (define-key calc-help-map "\C-d" 'calc-describe-distribution)
  (define-key calc-help-map "\C-n" 'calc-view-news)
  (define-key calc-help-map "\C-w" 'calc-describe-no-warranty)
  (define-key calc-help-map "?" 'calc-help-for-help)
1271
  (define-key calc-help-map "\C-h" 'calc-help-for-help))
Eli Zaretskii's avatar
Eli Zaretskii committed
1272

1273
(defvar calc-prefix-help-phase 0)
Eli Zaretskii's avatar
Eli Zaretskii committed
1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298
(defun calc-do-prefix-help (msgs group key)
  (if calc-full-help-flag
      (list msgs group key)
    (if (cdr msgs)
	(progn
	  (setq calc-prefix-help-phase
		(if (eq this-command last-command)
		    (% (1+ calc-prefix-help-phase) (1+ (length msgs)))
		  0))
	  (let ((msg (nth calc-prefix-help-phase msgs)))
	    (message "%s" (if msg
			      (concat group ": " msg ":"
				      (make-string
				       (- (apply 'max (mapcar 'length msgs))
					  (length msg)) 32)
				      "  [MORE]"
				      (if key
					  (concat "  " (char-to-string key)
						  "-")
					""))
			    (if key (format "%c-" key) "")))))
      (setq calc-prefix-help-phase 0)
      (if key
	  (if msgs
	      (message "%s: %s: %c-" group (car msgs) key)
1299
	    (message "%s: (none)  %c-" group key))
Eli Zaretskii's avatar
Eli Zaretskii committed
1300
	(message "%s: %s" group (car msgs))))
1301
    (and key (calc-unread-command key))))
Eli Zaretskii's avatar
Eli Zaretskii committed
1302 1303 1304 1305 1306 1307 1308 1309

;;;; Commands.


;;; General.

(defun calc-reset (arg)
  (interactive "P")
1310
  (setq arg (if arg (prefix-numeric-value arg) nil))
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331
  (cond
   ((and
     calc-embedded-info
     (equal (aref calc-embedded-info 0) (current-buffer))
     (<= (point) (aref calc-embedded-info 5))
     (>= (point) (aref calc-embedded-info 4)))
    (let ((cbuf (aref calc-embedded-info 1))
          (calc-embedded-quiet t))
      (save-window-excursion
        (calc-embedded nil)
        (set-buffer cbuf)
        (calc-reset arg))
      (calc-embedded nil)))
   ((eq major-mode 'calc-mode)
    (save-excursion
      (unless (and arg (> (abs arg) 0))
        (setq calc-stack nil))
      (setq calc-undo-list nil
            calc-redo-list nil)
      (let (calc-stack calc-user-parse-tables calc-standard-date-formats
                       calc-invocation-macro)
1332
        (mapc (function (lambda (v) (set v nil))) calc-local-var-list)
1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346
        (if (and arg (<= arg 0))
            (calc-mode-var-list-restore-default-values)
          (calc-mode-var-list-restore-saved-values)))
      (calc-set-language nil nil t)
      (calc-mode)
      (calc-flush-caches t)
      (run-hooks 'calc-reset-