home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume13 / gmcalc / patch01 < prev    next >
Encoding:
Text File  |  1990-06-15  |  44.4 KB  |  1,316 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v13i053: Patch for GNU Emacs Calc, version 1.01 -> 1.02
  3. from: daveg@csvax.caltech.edu (David Gillespie)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 13, Issue 53
  7. Submitted-by: daveg@csvax.caltech.edu (David Gillespie)
  8. Archive-name: gmcalc/patch01
  9.  
  10. The following patches convert Calc version 1.01 into Calc
  11. version 1.02.  To apply them automatically with Patch v2.0,
  12. first cd into your Calc distribution directory, then execute
  13. "patch -p0 <calc.patch", where "calc.patch" is name of this file.
  14. You will want to re-byte-compile both parts, and re-format the
  15. manual, as explained in the INSTALL file.
  16.  
  17. These patches do not cover the README and INSTALL files.  The
  18. INSTALL file is just a copy of the "Installation" chapter of
  19. calc.texinfo, which is updated by this patch.
  20.  
  21. Patches and complete tar files are also available from anonymous FTP
  22. on csvax.caltech.edu, in the "pub" subdirectory.
  23.  
  24. Enjoy!
  25.                             -- Dave
  26.  
  27. Dave Gillespie
  28. 256-80 Caltech, Pasadena CA 91125
  29. daveg@csvax.caltech.edu, ...!cit-vax!daveg
  30.  
  31.  
  32.  
  33. *** calc.el    Mon Jun  4 15:20:13 1990
  34. --- ../dist/calc.el    Wed Jun 13 14:08:38 1990
  35. ***************
  36. *** 1,4 ****
  37. ! ;; Calculator for GNU Emacs
  38.   ;; Copyright (C) 1990 Dave Gillespie
  39.   
  40.   ;; This file is part of GNU Emacs.
  41. --- 1,4 ----
  42. ! ;; Calculator for GNU Emacs version 1.02
  43.   ;; Copyright (C) 1990 Dave Gillespie
  44.   
  45.   ;; This file is part of GNU Emacs.
  46. ***************
  47. *** 60,66 ****
  48.   
  49.   (defmacro calc-record-compilation-date-macro ()
  50.     (` (setq calc-version (concat "Emacs Calc Mode"
  51. !                 " v1.01 by Dave Gillespie"
  52.                   ", installed "
  53.                   (, (current-time-string))
  54.                   " by "
  55. --- 60,66 ----
  56.   
  57.   (defmacro calc-record-compilation-date-macro ()
  58.     (` (setq calc-version (concat "Emacs Calc Mode"
  59. !                 " v1.02 by Dave Gillespie"
  60.                   ", installed "
  61.                   (, (current-time-string))
  62.                   " by "
  63. ***************
  64. *** 92,103 ****
  65.   ;;;      Together, Apart, Cancel, Factor, GCD, quotient/remainder.
  66.   ;;;   Automatically generate derivatives for functions defined with Z F.
  67.   ;;;   Handle commutativity and associativity among +, -, *, / in rewrite rules.
  68.   ;;;
  69.   ;;;   In no-simplify mode, have a key which executes the top-level call
  70.   ;;;      once, but does not execute any of the arguments' calls.
  71.   ;;;   Put a set of evaluations in the c-prefix menu, analogous to m-prefix.
  72.   ;;;
  73. ! ;;;   During numeric or algebraic entry, hit ` to switch to calc-edit entry.
  74.   ;;;
  75.   ;;;   When the stack is truncated, put the "." on the *second*-to-bottom line.
  76.   ;;;   When formatting formulas, suppress extra spaces inside vectors!
  77. --- 92,105 ----
  78.   ;;;      Together, Apart, Cancel, Factor, GCD, quotient/remainder.
  79.   ;;;   Automatically generate derivatives for functions defined with Z F.
  80.   ;;;   Handle commutativity and associativity among +, -, *, / in rewrite rules.
  81. + ;;;   Allow more powerful patterns, e.g., generic function names.
  82. + ;;;   Have a command that distributes function calls over equations.
  83.   ;;;
  84.   ;;;   In no-simplify mode, have a key which executes the top-level call
  85.   ;;;      once, but does not execute any of the arguments' calls.
  86.   ;;;   Put a set of evaluations in the c-prefix menu, analogous to m-prefix.
  87.   ;;;
  88. ! ;;;   During algebraic entry, hit ` to switch to calc-edit entry.
  89.   ;;;
  90.   ;;;   When the stack is truncated, put the "." on the *second*-to-bottom line.
  91.   ;;;   When formatting formulas, suppress extra spaces inside vectors!
  92. ***************
  93. *** 134,140 ****
  94.   ;;;   Implement dfact for large inputs using gamma function.
  95.   ;;;
  96.   ;;;   Provide more examples in the tutorial section of the manual.
  97. ! ;;;   Cover language modes, simplification modes, bitwise stuff in tutorial.
  98.   ;;;   Provide more Lisp programming examples in the manual.
  99.   ;;;   Finish the Internals section of the manual.
  100.   ;;;
  101. --- 136,143 ----
  102.   ;;;   Implement dfact for large inputs using gamma function.
  103.   ;;;
  104.   ;;;   Provide more examples in the tutorial section of the manual.
  105. ! ;;;   Cover in the tutorial:  language modes, simplification modes,
  106. ! ;;;       bitwise stuff, rewrite rules.
  107.   ;;;   Provide more Lisp programming examples in the manual.
  108.   ;;;   Finish the Internals section of the manual.
  109.   ;;;
  110. ***************
  111. *** 681,686 ****
  112. --- 684,690 ----
  113.     (if (or (not (eq major-mode 'calc-mode))
  114.         (and (boundp 'calc-defs) calc-defs))
  115.         (calc-mode))
  116. +   (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
  117.     (if calc-always-load-extensions
  118.         (calc-extensions))
  119.     (if calc-language
  120. ***************
  121. *** 689,695 ****
  122.       (calc-set-language calc-language calc-language-option t)))
  123.   )
  124.   
  125. ! (defun calc (&optional arg no-display)
  126.     "The Emacs Calculator.  Full documentation is listed under \"calc-mode\"."
  127.     (interactive "P")
  128.     (or (fboundp 'calc-extensions)
  129. --- 693,699 ----
  130.       (calc-set-language calc-language calc-language-option t)))
  131.   )
  132.   
  133. ! (defun calc (&optional arg full-display)
  134.     "The Emacs Calculator.  Full documentation is listed under \"calc-mode\"."
  135.     (interactive "P")
  136.     (or (fboundp 'calc-extensions)
  137. ***************
  138. *** 704,725 ****
  139.       (calc-quit)
  140.         (let ((oldbuf (current-buffer)))
  141.       (calc-create-buffer)
  142. !     (if (get-buffer-window (current-buffer))
  143. !         (select-window (get-buffer-window (current-buffer)))
  144. !       (if (and (boundp 'calc-window-hook) calc-window-hook)
  145. !           (run-hooks 'calc-window-hook)
  146. !         (let ((w (get-largest-window)))
  147. !           (if (and pop-up-windows
  148. !                (> (window-height w)
  149. !               (+ window-min-height calc-window-height 2)))
  150. !           (progn
  151. !             (setq w (split-window w
  152. !                       (- (window-height w)
  153. !                          calc-window-height 2)
  154. !                       nil))
  155. !             (set-window-buffer w (current-buffer))
  156. !             (select-window w))
  157. !         (pop-to-buffer (current-buffer))))))
  158.       (save-excursion
  159.         (let ((buf (current-buffer)))
  160.           (set-buffer (get-buffer-create "*Calc Trail*"))
  161. --- 708,731 ----
  162.       (calc-quit)
  163.         (let ((oldbuf (current-buffer)))
  164.       (calc-create-buffer)
  165. !     (if full-display
  166. !         (switch-to-buffer (current-buffer) t)
  167. !       (if (get-buffer-window (current-buffer))
  168. !           (select-window (get-buffer-window (current-buffer)))
  169. !         (if (and (boundp 'calc-window-hook) calc-window-hook)
  170. !         (run-hooks 'calc-window-hook)
  171. !           (let ((w (get-largest-window)))
  172. !         (if (and pop-up-windows
  173. !              (> (window-height w)
  174. !                 (+ window-min-height calc-window-height 2)))
  175. !             (progn
  176. !               (setq w (split-window w
  177. !                         (- (window-height w)
  178. !                            calc-window-height 2)
  179. !                         nil))
  180. !               (set-window-buffer w (current-buffer))
  181. !               (select-window w))
  182. !           (pop-to-buffer (current-buffer)))))))
  183.       (save-excursion
  184.         (let ((buf (current-buffer)))
  185.           (set-buffer (get-buffer-create "*Calc Trail*"))
  186. ***************
  187. *** 727,734 ****
  188.           (and calc-display-trail
  189.            (= (window-width) (screen-width))
  190.            (calc-trail-display 1 t))))
  191. !     (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
  192. !     (calc-summary)
  193.       (and calc-said-hello
  194.            (interactive-p)
  195.            (progn
  196. --- 733,739 ----
  197.           (and calc-display-trail
  198.            (= (window-width) (screen-width))
  199.            (calc-trail-display 1 t))))
  200. !     (calc-summary full-display)
  201.       (and calc-said-hello
  202.            (interactive-p)
  203.            (progn
  204. ***************
  205. *** 738,743 ****
  206. --- 743,754 ----
  207.       (run-hooks 'calc-start-hook))))
  208.   )
  209.   
  210. + (defun full-calc ()
  211. +   "Invoke the Calculator and give it a full-sized window."
  212. +   (interactive)
  213. +   (calc nil t)
  214. + )
  215.   (defun another-calc ()
  216.     "Create another, independent Calculator buffer."
  217.     (interactive)
  218. ***************
  219. *** 782,787 ****
  220. --- 793,799 ----
  221.                     'flat calc-language))
  222.          (calc-dollar-values calc-quick-prev-results)
  223.          (calc-dollar-used 0)
  224. +        (enable-recursive-minibuffers t)
  225.          (alg-exp (calc-do-alg-entry "" "Quick calc: ")))
  226.         (let ((buf ""))
  227.       (setq calc-quick-prev-results alg-exp)
  228. ***************
  229. *** 796,804 ****
  230.       (message buf))))
  231.   )
  232.   
  233. ! (defun calc-summary ()
  234.     (interactive)
  235. !   (message "Welcome to the GNU Emacs Calculator!  Press ? for help, q to quit.")
  236.   )
  237.   
  238.   (defun calc-info ()
  239. --- 808,818 ----
  240.       (message buf))))
  241.   )
  242.   
  243. ! (defun calc-summary (&optional full)
  244.     (interactive)
  245. !   (if full
  246. !       (message "Welcome to GNU Emacs Calc!  Press `?' or `i' for help, `C-x C-c' to quit.")
  247. !       (message "Welcome to the GNU Emacs Calculator!  Press `?' or `i' for help, `q' to quit."))
  248.   )
  249.   
  250.   (defun calc-info ()
  251. ***************
  252. *** 812,819 ****
  253.   (defun calc-help ()
  254.     (interactive)
  255.     (let ((msgs
  256. !      '("Letter keys: Help, Info, Why; Xtended cmd; Yank; Quit"
  257. !        "Letter keys: Negate; Precision; Store, Recall, Let"
  258.          "Letter keys: SHIFT + Undo, reDo, last-X; Inverse, Hyperbolic"
  259.          "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
  260.          "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
  261. --- 826,833 ----
  262.   (defun calc-help ()
  263.     (interactive)
  264.     (let ((msgs
  265. !      '("Letter keys: Help, Info (manual), Why; Xtended cmd; Quit"
  266. !        "Letter keys: Negate; Precision; Store, Recall, Let; Yank"
  267.          "Letter keys: SHIFT + Undo, reDo, last-X; Inverse, Hyperbolic"
  268.          "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
  269.          "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
  270. ***************
  271. *** 2514,2523 ****
  272.   )
  273.   
  274.   (defun math-div2-bignum (a)   ; [l l]
  275. !   (cond
  276. !    ((null (cdr a)) (list (/ (car a) 2)))
  277. !    (t (cons (+ (/ (car a) 2) (* (% (nth 1 a) 2) 500))
  278. !         (math-div2-bignum (cdr a)))))
  279.   )
  280.   
  281.   
  282. --- 2528,2537 ----
  283.   )
  284.   
  285.   (defun math-div2-bignum (a)   ; [l l]
  286. !   (if (cdr a)
  287. !       (cons (+ (/ (car a) 2) (* (% (nth 1 a) 2) 500))
  288. !         (math-div2-bignum (cdr a)))
  289. !     (list (/ (car a) 2)))
  290.   )
  291.   
  292.   
  293. ***************
  294. *** 2626,2635 ****
  295.   )
  296.   
  297.   (defun math-div10-bignum (a)   ; [l l]
  298. !   (cond
  299. !    ((null (cdr a)) (list (/ (car a) 10)))
  300. !    (t (cons (+ (/ (car a) 10) (* (% (nth 1 a) 10) 100))
  301. !         (math-div10-bignum (cdr a)))))
  302.   )
  303.   
  304.   ;;; Coerce A to be a float.  [F N; V V] [Public]
  305. --- 2640,2649 ----
  306.   )
  307.   
  308.   (defun math-div10-bignum (a)   ; [l l]
  309. !   (if (cdr a)
  310. !       (cons (+ (/ (car a) 10) (* (% (nth 1 a) 10) 100))
  311. !         (math-div10-bignum (cdr a)))
  312. !     (list (/ (car a) 10)))
  313.   )
  314.   
  315.   ;;; Coerce A to be a float.  [F N; V V] [Public]
  316. ***************
  317. *** 3053,3070 ****
  318.   
  319.   ;;; Multiply digit list A by digit D.  [L L D D; l l D D]
  320.   (defun math-mul-bignum-digit (a d c)
  321. !   (and a
  322. !        (if (<= d 1)
  323. !        (and (= d 1) a)
  324. !      (let* ((a (copy-sequence a)) (aa a) prod)
  325. !        (while (progn
  326. !             (setcar aa (% (setq prod (+ (* (car aa) d) c)) 1000))
  327. !             (cdr aa))
  328. !          (setq aa (cdr aa)
  329. !            c (/ prod 1000)))
  330. !        (if (>= prod 1000)
  331. !            (setcdr aa (list (/ prod 1000))))
  332. !        a)))
  333.   )
  334.   
  335.   
  336. --- 3067,3086 ----
  337.   
  338.   ;;; Multiply digit list A by digit D.  [L L D D; l l D D]
  339.   (defun math-mul-bignum-digit (a d c)
  340. !   (if a
  341. !       (if (<= d 1)
  342. !       (and (= d 1) a)
  343. !     (let* ((a (copy-sequence a)) (aa a) prod)
  344. !       (while (progn
  345. !            (setcar aa (% (setq prod (+ (* (car aa) d) c)) 1000))
  346. !            (cdr aa))
  347. !         (setq aa (cdr aa)
  348. !           c (/ prod 1000)))
  349. !       (if (>= prod 1000)
  350. !           (setcdr aa (list (/ prod 1000))))
  351. !       a))
  352. !     (and (> c 0)
  353. !      (list c)))
  354.   )
  355.   
  356.   
  357. ***************
  358. *** 3131,3160 ****
  359.   ;;; Divide a bignum digit list by another.  [l.l l L]
  360.   ;;; The following division algorithm is borrowed from Knuth vol. II, sec. 4.3.1
  361.   (defun math-div-bignum (a b)
  362. !   (if (null (cdr b))
  363. !       (let ((res (math-div-bignum-digit a (car b))))
  364. !     (cons (car res) (list (cdr res))))
  365. !     (let* ((alen (length a))
  366. !        (blen (length b))
  367. !        (d (/ 1000 (1+ (nth (1- blen) b))))
  368. !        (res (math-div-bignum-big (math-mul-bignum-digit a d 0)
  369. !                      (math-mul-bignum-digit b d 0)
  370. !                      alen blen)))
  371. !       (if (= d 1)
  372. !       res
  373. !     (cons (car res)
  374. !           (car (math-div-bignum-digit (cdr res) d))))))
  375.   )
  376.   
  377.   ;;; Divide a bignum digit list by a digit.  [l.D l D]
  378.   (defun math-div-bignum-digit (a b)
  379. !   (if (null a)
  380. !       '(nil . 0)
  381. !     (let* ((res (math-div-bignum-digit (cdr a) b))
  382. !        (num (+ (* (cdr res) 1000) (car a))))
  383. !       (cons
  384. !        (cons (/ num b) (car res))
  385. !        (% num b))))
  386.   )
  387.   
  388.   (defun math-div-bignum-big (a b alen blen)   ; [l.l l L]
  389. --- 3147,3176 ----
  390.   ;;; Divide a bignum digit list by another.  [l.l l L]
  391.   ;;; The following division algorithm is borrowed from Knuth vol. II, sec. 4.3.1
  392.   (defun math-div-bignum (a b)
  393. !   (if (cdr b)
  394. !       (let* ((alen (length a))
  395. !          (blen (length b))
  396. !          (d (/ 1000 (1+ (nth (1- blen) b))))
  397. !          (res (math-div-bignum-big (math-mul-bignum-digit a d 0)
  398. !                        (math-mul-bignum-digit b d 0)
  399. !                        alen blen)))
  400. !     (if (= d 1)
  401. !         res
  402. !       (cons (car res)
  403. !         (car (math-div-bignum-digit (cdr res) d)))))
  404. !     (let ((res (math-div-bignum-digit a (car b))))
  405. !       (cons (car res) (list (cdr res)))))
  406.   )
  407.   
  408.   ;;; Divide a bignum digit list by a digit.  [l.D l D]
  409.   (defun math-div-bignum-digit (a b)
  410. !   (if a
  411. !       (let* ((res (math-div-bignum-digit (cdr a) b))
  412. !          (num (+ (* (cdr res) 1000) (car a))))
  413. !     (cons
  414. !      (cons (/ num b) (car res))
  415. !      (% num b)))
  416. !     '(nil . 0))
  417.   )
  418.   
  419.   (defun math-div-bignum-big (a b alen blen)   ; [l.l l L]
  420. ***************
  421. *** 4056,4062 ****
  422.     (interactive "sBug Subject: ")
  423.     (mail nil calc-bug-address topic)
  424.     (goto-char (point-max))
  425. !   (insert "\nIn Calc 1.01, Emacs " (emacs-version) "\n\n")
  426.     (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
  427.   )
  428.   
  429. --- 4072,4078 ----
  430.     (interactive "sBug Subject: ")
  431.     (mail nil calc-bug-address topic)
  432.     (goto-char (point-max))
  433. !   (insert "\nIn Calc 1.02, Emacs " (emacs-version) "\n\n")
  434.     (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
  435.   )
  436.   
  437. *** calc-ext.el    Mon Jun  4 15:20:19 1990
  438. --- ../dist/calc-ext.el    Wed Jun 13 14:08:45 1990
  439. ***************
  440. *** 1,4 ****
  441. ! ;; Calculator for GNU Emacs, part II
  442.   ;; Copyright (C) 1990 Dave Gillespie
  443.   
  444.   ;; This file is part of GNU Emacs.
  445. --- 1,4 ----
  446. ! ;; Calculator for GNU Emacs version 1.02, part II
  447.   ;; Copyright (C) 1990 Dave Gillespie
  448.   
  449.   ;; This file is part of GNU Emacs.
  450. ***************
  451. *** 88,93 ****
  452. --- 88,94 ----
  453.     (define-key calc-mode-map "\M-w" 'calc-copy-region-as-kill)
  454.     (define-key calc-mode-map "\C-y" 'calc-yank)
  455.     (define-key calc-mode-map "\C-_" 'calc-undo)
  456. +   (define-key calc-mode-map "\C-xu" 'calc-undo)
  457.   
  458.     (define-key calc-mode-map "a" nil)
  459.     (define-key calc-mode-map "a?" 'calc-a-prefix-help)
  460. ***************
  461. *** 298,303 ****
  462. --- 299,305 ----
  463.     (define-key calc-mode-map "Ze" 'calc-user-define-edit)
  464.     (define-key calc-mode-map "Zf" 'calc-user-define-formula)
  465.     (define-key calc-mode-map "Zg" 'calc-get-user-defn)
  466. +   (define-key calc-mode-map "Zi" 'calc-insert-variables)
  467.     (define-key calc-mode-map "Zk" 'calc-user-define-kbd-macro)
  468.     (define-key calc-mode-map "Zp" 'calc-user-define-permanent)
  469.     (define-key calc-mode-map "Zu" 'calc-user-undefine)
  470. ***************
  471. *** 1212,1217 ****
  472. --- 1214,1221 ----
  473.            (set ivar (calc-top 1))
  474.          (if (null ival)
  475.              (error "No such variable"))
  476. +        (if (stringp ival)
  477. +            (setq ival (math-read-expr ival)))
  478.          (setq ival (calc-normalize ival))
  479.          (cond ((equal oper "+")
  480.             (set ivar (calc-normalize
  481. ***************
  482. *** 1294,1299 ****
  483. --- 1298,1307 ----
  484.        (if (not (and (boundp ivar) ivar))
  485.        (error "No such variable"))
  486.        (let ((ival (symbol-value ivar)))
  487. +        (if (stringp ival)
  488. +        (setq ival (math-read-expr ival)))
  489. +        (if (eq (car-safe ival) 'error)
  490. +        (error "Bad format in variable contents: %s" (nth 2 ival)))
  491.          (setq ival (calc-normalize ival))
  492.          (calc-record ival (concat "<"
  493.                    (if (string-match "\\`var-.+\\'" var)
  494. ***************
  495. *** 5150,5191 ****
  496.               (minibuffer-completion-confirm t)
  497.               (oper "r"))
  498.           (read-from-minibuffer
  499. !          "Save variable: " "var-" calc-store-var-map nil)))
  500.        pos)
  501. !      (if (equal var "")
  502. !      ()
  503. !        (or (and (boundp (intern var)) (intern var))
  504. !        (error "No such variable"))
  505. !        (set-buffer (find-file-noselect (substitute-in-file-name
  506. !                     calc-settings-file)))
  507. !        (goto-char (point-min))
  508. !        (if (search-forward (concat "(setq " var " '") nil t)
  509. !        (progn
  510. !          (setq pos (point-marker))
  511. !          (forward-line -1)
  512. !          (if (looking-at ";;; Variable .* stored by Calc on ")
  513. !          (progn
  514. !            (delete-region (match-end 0) (progn (end-of-line) (point)))
  515. !            (insert (current-time-string))))
  516. !          (goto-char (- pos 8 (length var)))
  517. !          (forward-sexp 1)
  518. !          (backward-char 1)
  519. !          (delete-region pos (point)))
  520. !      (goto-char (point-max))
  521. !      (insert "\n;;; Variable \""
  522. !          var
  523. !          "\" stored by Calc on "
  524. !          (current-time-string)
  525. !          "\n(setq "
  526. !          var
  527. !          " ')\n")
  528. !      (backward-char 2))
  529. !        (insert (prin1-to-string (symbol-value (intern var))))
  530. !        (forward-line 1)
  531. !        (save-buffer))))
  532.   )
  533.   
  534.   
  535.   
  536.   (defun calc-call-last-kbd-macro (arg)
  537.     "Execute the most recent keyboard macro."
  538. --- 5158,5233 ----
  539.               (minibuffer-completion-confirm t)
  540.               (oper "r"))
  541.           (read-from-minibuffer
  542. !          "Save variable (default=all): " "var-"
  543. !          calc-store-var-map nil)))
  544.        pos)
  545. !      (or (equal var "") (equal var "var-")
  546. !      (and (boundp (intern var)) (intern var))
  547. !      (error "No such variable"))
  548. !      (set-buffer (find-file-noselect (substitute-in-file-name
  549. !                       calc-settings-file)))
  550. !      (if (or (equal var "") (equal var "var-"))
  551. !      (mapatoms (function
  552. !             (lambda (x)
  553. !               (and (string-match "\\`var-" (symbol-name x))
  554. !                (boundp x)
  555. !                (symbol-value x)
  556. !                (not (eq (car-safe (symbol-value x))
  557. !                     'special-const))
  558. !                (calc-insert-permanent-variable x)))))
  559. !        (calc-insert-permanent-variable (intern var)))
  560. !      (save-buffer)))
  561. ! )
  562. ! (defun calc-insert-permanent-variable (var)
  563. !   (goto-char (point-min))
  564. !   (if (search-forward (concat "(setq " (symbol-name var) " '") nil t)
  565. !       (progn
  566. !     (setq pos (point-marker))
  567. !     (forward-line -1)
  568. !     (if (looking-at ";;; Variable .* stored by Calc on ")
  569. !         (progn
  570. !           (delete-region (match-end 0) (progn (end-of-line) (point)))
  571. !           (insert (current-time-string))))
  572. !     (goto-char (- pos 8 (length (symbol-name var))))
  573. !     (forward-sexp 1)
  574. !     (backward-char 1)
  575. !     (delete-region pos (point)))
  576. !     (goto-char (point-max))
  577. !     (insert "\n;;; Variable \""
  578. !         (symbol-name var)
  579. !         "\" stored by Calc on "
  580. !         (current-time-string)
  581. !         "\n(setq "
  582. !         (symbol-name var)
  583. !         " ')\n")
  584. !     (backward-char 2))
  585. !   (insert (prin1-to-string (symbol-value var)))
  586. !   (forward-line 1)
  587.   )
  588.   
  589.   
  590. + (defun calc-insert-variables (buf)
  591. +   "Insert all variables beginning with \"var-\" in the specified buffer."
  592. +   (interactive "bBuffer in which to save variable values: ")
  593. +   (save-excursion
  594. +     (set-buffer buf)
  595. +     (mapatoms (function
  596. +            (lambda (x)
  597. +          (and (string-match "\\`var-" (symbol-name x))
  598. +               (boundp x)
  599. +               (symbol-value x)
  600. +               (not (eq (car-safe (symbol-value x)) 'special-const))
  601. +               (insert "(setq "
  602. +                   (symbol-name x)
  603. +                   " "
  604. +                   (prin1-to-string
  605. +                    (if (stringp (symbol-value x))
  606. +                    (symbol-value x)
  607. +                  (math-format-value (symbol-value x) 1000)))
  608. +                   ")\n"))))))
  609. + )
  610.   
  611.   (defun calc-call-last-kbd-macro (arg)
  612.     "Execute the most recent keyboard macro."
  613. ***************
  614. *** 5236,5241 ****
  615. --- 5278,5286 ----
  616.                  (insert fmt "\n"))
  617.                (setq new-stack (cdr new-stack)))
  618.              (calc-renumber-stack))
  619. +            (while new-stack
  620. +          (calc-record-undo (list 'push 1))
  621. +          (setq new-stack (cdr new-stack)))
  622.              (calc-refresh))
  623.            (calc-record-undo (list 'set 'saved-stack-top 0))))))))
  624.   )
  625. ***************
  626. *** 10632,10642 ****
  627.              (not (eq (car-safe (symbol-value (nth 2 x)))
  628.               'incomplete)))
  629.         (let ((val (symbol-value (nth 2 x))))
  630. !         (if (eq (car-safe val) 'special-const)
  631. !         (if calc-symbolic-mode
  632. !             x
  633. !           val)
  634. !           val))
  635.       x)
  636.       x)
  637.   )
  638. --- 10677,10691 ----
  639.              (not (eq (car-safe (symbol-value (nth 2 x)))
  640.               'incomplete)))
  641.         (let ((val (symbol-value (nth 2 x))))
  642. !         (if (stringp val)
  643. !         (setq val (math-read-expr val)))
  644. !         (if (eq (car-safe val) 'error)
  645. !         x
  646. !           (if (eq (car-safe val) 'special-const)
  647. !           (if calc-symbolic-mode
  648. !               x
  649. !             val)
  650. !         val)))
  651.       x)
  652.       x)
  653.   )
  654. ***************
  655. *** 12795,12801 ****
  656.        ( Ang     "1e-10 m"         "Angstrom" )
  657.        
  658.        ;; Area
  659. !      ( hect    "1000 m^2"         "*Hectare" )
  660.        ( acre    "mi^2 / 640"         "Acre" )
  661.        ( b       "1e-28 m^2"         "Barn" )
  662.        
  663. --- 12844,12850 ----
  664.        ( Ang     "1e-10 m"         "Angstrom" )
  665.        
  666.        ;; Area
  667. !      ( hect    "10000 m^2"         "*Hectare" )
  668.        ( acre    "mi^2 / 640"         "Acre" )
  669.        ( b       "1e-28 m^2"         "Barn" )
  670.        
  671. *** calc.texinfo    Mon Jun  4 15:20:23 1990
  672. --- ../dist/calc.texinfo    Wed Jun 13 14:08:53 1990
  673. ***************
  674. *** 1,7 ****
  675.   \input texinfo                  @c -*-texinfo-*-
  676.   @comment %**start of header (This is for running Texinfo on a region.)
  677.   @setfilename calc-info
  678. ! @settitle GNU Emacs Calc 1.01 Manual
  679.   @setchapternewpage odd
  680.   @comment %**end of header (This is for running Texinfo on a region.)
  681.   
  682. --- 1,7 ----
  683.   \input texinfo                  @c -*-texinfo-*-
  684.   @comment %**start of header (This is for running Texinfo on a region.)
  685.   @setfilename calc-info
  686. ! @settitle GNU Emacs Calc 1.02 Manual
  687.   @setchapternewpage odd
  688.   @comment %**end of header (This is for running Texinfo on a region.)
  689.   
  690. ***************
  691. *** 38,46 ****
  692.   @sp 6
  693.   @center @titlefont{Calc Manual}
  694.   @sp 4
  695. ! @center GNU Emacs Calc Version 1.01
  696.   @sp 1
  697. ! @center May 1990
  698.   @sp 5
  699.   @center Dave Gillespie
  700.   @page
  701. --- 38,46 ----
  702.   @sp 6
  703.   @center @titlefont{Calc Manual}
  704.   @sp 4
  705. ! @center GNU Emacs Calc Version 1.02
  706.   @sp 1
  707. ! @center June 1990
  708.   @sp 5
  709.   @center Dave Gillespie
  710.   @page
  711. ***************
  712. *** 524,531 ****
  713.   a formula, @samp{$} represents the previously computed result.@refill
  714.   
  715.   The basic arithmetic operations are @kbd{+}, @kbd{-}, @kbd{*}, @kbd{/},
  716. ! @kbd{^} (raise to a power), @kbd{%} (modulo), and @kbd{n} (change
  717. ! sign).@refill
  718.   
  719.   Mathematical functions include @kbd{Q} (square root), @kbd{S} (sine),
  720.   @kbd{C} (cosine), @kbd{T} (tangent), @kbd{E} (exponential), and @kbd{L}
  721. --- 524,531 ----
  722.   a formula, @samp{$} represents the previously computed result.@refill
  723.   
  724.   The basic arithmetic operations are @kbd{+}, @kbd{-}, @kbd{*}, @kbd{/},
  725. ! @kbd{^} (raise to a power), @kbd{%} (modulo), @kbd{&} (reciprocal),
  726. ! and @kbd{n} (change sign).@refill
  727.   
  728.   Mathematical functions include @kbd{Q} (square root), @kbd{S} (sine),
  729.   @kbd{C} (cosine), @kbd{T} (tangent), @kbd{E} (exponential), and @kbd{L}
  730. ***************
  731. *** 758,770 ****
  732.   @key{RET} +}.  That's because if you type any operator name or
  733.   other non-numeric key when you are entering a number, the Calculator
  734.   automatically enters that number and then does the requested command.
  735. ! Thus @kbd{2 @key{RET} 3 +} will work just as well.
  736.   
  737.   The @key{DEL} key is called Backspace on some keyboards.  It is
  738.   whatever key you would use to correct a simple typing error when
  739.   regularly using Emacs.  The @key{DEL} key pops and throws away the
  740.   top value on the stack.  (You can still get that value back from
  741. ! the Trail if you should need it later on.)
  742.   
  743.   Since the @kbd{-} key is also an operator (it subtracts the top two
  744.   stack elements), how does one enter a negative number?  Calc uses
  745. --- 758,791 ----
  746.   @key{RET} +}.  That's because if you type any operator name or
  747.   other non-numeric key when you are entering a number, the Calculator
  748.   automatically enters that number and then does the requested command.
  749. ! Thus @kbd{2 @key{RET} 3 +} will work just as well.@refill
  750.   
  751. + Examples in this tutorial will often omit @key{RET} even when the
  752. + stack displays shown would only happen if you did press @key{RET}:
  753. + @group
  754. + @example
  755. + 1:  2          2:  2          1:  5
  756. +     .          1:  3              .
  757. +                    .
  758. +   2 RET            3              +
  759. + @end example
  760. + @end group
  761. + Here, after pressing @kbd{3} the stack would really show @samp{1:  2}
  762. + with @samp{Calc: 3} in the minibuffer.  In these situations, you can
  763. + press the optional @key{RET} to see the stack as the figure shows.
  764.   The @key{DEL} key is called Backspace on some keyboards.  It is
  765.   whatever key you would use to correct a simple typing error when
  766.   regularly using Emacs.  The @key{DEL} key pops and throws away the
  767.   top value on the stack.  (You can still get that value back from
  768. ! the Trail if you should need it later on.)  There are many places
  769. ! in this tutorial where we assume you have used @key{DEL} to erase the
  770. ! results of the previous example at the beginning of a new example.
  771. ! In the few places that it is really important to use @key{DEL} to
  772. ! clear away old results, the text will remind you to do so.
  773.   
  774.   Since the @kbd{-} key is also an operator (it subtracts the top two
  775.   stack elements), how does one enter a negative number?  Calc uses
  776. ***************
  777. *** 1204,1210 ****
  778.   @node Undo Tutorial, Modes Tutorial, Algebraic Tutorial, Basic Tutorial
  779.   @subsection Undo and Redo
  780.   
  781. ! If you make a mistake, you can usually correct it by pressing @kbd{U},
  782.   the ``undo'' command.  First, to get a clean slate, press @kbd{M-0 DEL}
  783.   to clear the stack, then @kbd{M-# M-#} to stop and start the Calculator
  784.   over.  Now:
  785. --- 1225,1231 ----
  786.   @node Undo Tutorial, Modes Tutorial, Algebraic Tutorial, Basic Tutorial
  787.   @subsection Undo and Redo
  788.   
  789. ! If you make a mistake, you can usually correct it by pressing shift-@kbd{U},
  790.   the ``undo'' command.  First, to get a clean slate, press @kbd{M-0 DEL}
  791.   to clear the stack, then @kbd{M-# M-#} to stop and start the Calculator
  792.   over.  Now:
  793. ***************
  794. *** 1324,1333 ****
  795.   directly, but you can press @kbd{`} (the backquote or accent grave)
  796.   to edit a stack entry.
  797.   
  798. ! Try entering @samp{3.141429} now.  If this is supposed to represent
  799.   @samp{pi}, it's got several errors.  Press @kbd{`} to edit this number.
  800.   Now use the normal Emacs cursor motion and editing keys to change
  801. ! the second 4 to a 5, and to transpose the 2 and the 9.  When you
  802.   press @key{RET}, the number of the stack will be replaced by your
  803.   new number.  This also works for formulas, vectors, and other types
  804.   of values you can put on the stack.
  805. --- 1345,1354 ----
  806.   directly, but you can press @kbd{`} (the backquote or accent grave)
  807.   to edit a stack entry.
  808.   
  809. ! Try entering @samp{3.141439} now.  If this is supposed to represent
  810.   @samp{pi}, it's got several errors.  Press @kbd{`} to edit this number.
  811.   Now use the normal Emacs cursor motion and editing keys to change
  812. ! the second 4 to a 5, and to transpose the 3 and the 9.  When you
  813.   press @key{RET}, the number of the stack will be replaced by your
  814.   new number.  This also works for formulas, vectors, and other types
  815.   of values you can put on the stack.
  816. ***************
  817. *** 1394,1410 ****
  818.   In fact, since we added a digit on the left, we had to lose one
  819.   digit on the right from even the 12-digit value of @samp{1/7}.
  820.   
  821. ! How come when we computed @samp{2^3^4} we got more than 12 digits?  The
  822.   answer is that Calc makes a distinction between @dfn{integers} and
  823.   @dfn{floating-point} numbers, or @dfn{floats}.  An integer is a number
  824.   that does not contain a decimal point.  There is no such thing as an
  825.   ``infinitely repeating fraction integer,'' so Calc doesn't have to limit
  826. ! itself.  If you ask for @kbd{2^10000}, you will have to wait a long time
  827. ! (in fact, we recommend that you not try this example!) but you will
  828. ! eventually get an exact answer.  If you ask for @samp{2.^10000}, you
  829. ! will quickly get an answer which is correct only to 12 places.  The
  830. ! decimal point tells Calc that it should use floating-point arithmetic to
  831. ! get the answer, not exact integer arithmetic.
  832.   
  833.   Let's try entering that last calculation:
  834.   
  835. --- 1415,1431 ----
  836.   In fact, since we added a digit on the left, we had to lose one
  837.   digit on the right from even the 12-digit value of @samp{1/7}.
  838.   
  839. ! How did we get more than 12 digits when we computed @samp{2^3^4}?  The
  840.   answer is that Calc makes a distinction between @dfn{integers} and
  841.   @dfn{floating-point} numbers, or @dfn{floats}.  An integer is a number
  842.   that does not contain a decimal point.  There is no such thing as an
  843.   ``infinitely repeating fraction integer,'' so Calc doesn't have to limit
  844. ! itself.  If you asked for @kbd{2^10000} (don't try this!), you would
  845. ! have to wait a long time but you would eventually get an exact answer.
  846. ! If you ask for @samp{2.^10000}, you will quickly get an answer which is
  847. ! correct only to 12 places.  The decimal point tells Calc that it should
  848. ! use floating-point arithmetic to get the answer, not exact integer
  849. ! arithmetic.
  850.   
  851.   Let's try entering that last calculation:
  852.   
  853. ***************
  854. *** 1414,1420 ****
  855.       .          1:  10000          .
  856.                      .
  857.   
  858. !   2. RET          10000           ^
  859.   @end example
  860.   @end group
  861.   
  862. --- 1435,1441 ----
  863.       .          1:  10000          .
  864.                      .
  865.   
  866. !   2.0 RET          10000 RET      ^
  867.   @end example
  868.   @end group
  869.   
  870. ***************
  871. *** 1429,1435 ****
  872.       .          1:  10000.         .
  873.                      .
  874.   
  875. !   2. RET           1e4            ^
  876.   @end example
  877.   @end group
  878.   
  879. --- 1450,1456 ----
  880.       .          1:  10000.         .
  881.                      .
  882.   
  883. !   2.0 RET          1e4 RET        ^
  884.   @end example
  885.   @end group
  886.   
  887. ***************
  888. *** 1476,1483 ****
  889.   notation}.  You get them by pressing @kbd{d n}, @kbd{d f},
  890.   @kbd{d s}, and @kbd{d e}, respectively.  In each case, you can
  891.   supply a numeric prefix argument which says how many digits
  892. ! should be displayed.  As an example, put the following numbers
  893. ! onto the stack, then try some different display modes:
  894.   
  895.   @group
  896.   @example
  897. --- 1497,1506 ----
  898.   notation}.  You get them by pressing @kbd{d n}, @kbd{d f},
  899.   @kbd{d s}, and @kbd{d e}, respectively.  In each case, you can
  900.   supply a numeric prefix argument which says how many digits
  901. ! should be displayed.  As an example, let's put a few numbers
  902. ! onto the stack and try some different display modes.  First,
  903. ! use @kbd{M-0 DEL} to clear the stack, then enter the four
  904. ! numbers shown here:
  905.   
  906.   @group
  907.   @example
  908. ***************
  909. *** 1507,1512 ****
  910. --- 1530,1537 ----
  911.   of the float formats.  Integers are integers, and are always
  912.   displayed exactly.
  913.   
  914. + Type @kbd{d n} now to return to the normal float format.
  915.   Large integers have their own problems.  Let's look back at
  916.   the result of @kbd{2^3^4}.
  917.   
  918. ***************
  919. *** 1622,1628 ****
  920.   @end group
  921.   
  922.   The shift-@kbd{S} command computes the sine of an angle.  The sine
  923. ! of 45 degrees is @samp{sqrt(2)/2}; squaring this yields {2/4 = 0.5}.
  924.   However, there has been a slight roundoff error because the
  925.   resentation of @samp{sqrt(2)/2} wasn't exact.  The @kbd{c 1}
  926.   command is a handy way to clean up numbers in this case; it
  927. --- 1647,1653 ----
  928.   @end group
  929.   
  930.   The shift-@kbd{S} command computes the sine of an angle.  The sine
  931. ! of 45 degrees is @samp{sqrt(2)/2}; squaring this yields @samp{2/4 = 0.5}.
  932.   However, there has been a slight roundoff error because the
  933.   resentation of @samp{sqrt(2)/2} wasn't exact.  The @kbd{c 1}
  934.   command is a handy way to clean up numbers in this case; it
  935. ***************
  936. *** 2258,2264 ****
  937.   @end group
  938.   
  939.   The vertical bar @kbd{|} @dfn{concatenates} numbers, vectors, and
  940. ! matrices together.  Here we have used it to add a new column onto
  941.   our matrix to make it square.
  942.   
  943.   We can multiply these two matrices in either order to get an identity.
  944. --- 2283,2289 ----
  945.   @end group
  946.   
  947.   The vertical bar @kbd{|} @dfn{concatenates} numbers, vectors, and
  948. ! matrices together.  Here we have used it to add a new row onto
  949.   our matrix to make it square.
  950.   
  951.   We can multiply these two matrices in either order to get an identity.
  952. ***************
  953. *** 2322,2328 ****
  954.   The result is 6.00001, reasonably correct considering that we cheated
  955.   and didn't type all the digits of @samp{c}.
  956.   
  957. ! @node List Tutorial, , Matrix Tutorial, , Vector/Matrix Tutorial
  958.   @subsection Vectors as Lists
  959.   
  960.   Although Calc has a number of features for manipulating vectors and
  961. --- 2347,2353 ----
  962.   The result is 6.00001, reasonably correct considering that we cheated
  963.   and didn't type all the digits of @samp{c}.
  964.   
  965. ! @node List Tutorial, , Matrix Tutorial, Vector/Matrix Tutorial
  966.   @subsection Vectors as Lists
  967.   
  968.   Although Calc has a number of features for manipulating vectors and
  969. ***************
  970. *** 2642,2648 ****
  971.   In this section, we'll experiment with each of these types in turn.
  972.   
  973.   The numbers we've been using so far have mainly been either @dfn{integers}
  974. ! or @dfn{floats}.  We saw that floats are a usually good approximation to
  975.   the mathematical concept of real numbers, but they are only approximations
  976.   and are susceptible to roundoff error.  Calc also supports @dfn{fractions},
  977.   which can exactly represent any rational number.
  978. --- 2667,2673 ----
  979.   In this section, we'll experiment with each of these types in turn.
  980.   
  981.   The numbers we've been using so far have mainly been either @dfn{integers}
  982. ! or @dfn{floats}.  We saw that floats are usually a good approximation to
  983.   the mathematical concept of real numbers, but they are only approximations
  984.   and are susceptible to roundoff error.  Calc also supports @dfn{fractions},
  985.   which can exactly represent any rational number.
  986. ***************
  987. *** 2742,2756 ****
  988.   
  989.   @group
  990.   @example
  991. ! 1:  30 +/- 1     2:  30 +/- 1     1:  3.75 +/- 0.156   1:  75.06 +/- 0.594
  992. !     .            1:  8 +/- 0.2        .                    .
  993.                        .
  994.   
  995. !     30 p 1           8 p .2           /                   I T
  996.   @end example
  997.   @end group
  998.   
  999. ! This means that the angle is about 75 degrees, and, assuming our
  1000.   original error estimates were valid standard deviations, there is about
  1001.   a 60% chance that the result is correct within 0.59 degrees.
  1002.   
  1003. --- 2767,2781 ----
  1004.   
  1005.   @group
  1006.   @example
  1007. ! 1:  8 +/- 0.2    2:  8 +/- 0.2    1:  0.266 +/- 0.011   1:  14.93 +/- 0.594
  1008. !     .            1:  30 +/- 1         .                     .
  1009.                        .
  1010.   
  1011. !     8 p .2           30 p 1           /                     I T
  1012.   @end example
  1013.   @end group
  1014.   
  1015. ! This means that the angle is about 15 degrees, and, assuming our
  1016.   original error estimates were valid standard deviations, there is about
  1017.   a 60% chance that the result is correct within 0.59 degrees.
  1018.   
  1019. ***************
  1020. *** 2762,2772 ****
  1021.   
  1022.   @group
  1023.   @example
  1024. ! 1:  [28 .. 31]   2:  [28 .. 31]    1:  [3.45 .. 4.02]  1:  [73.86 .. 76.05]
  1025. !     .            1:  [7.7 .. 8.1]      .                   .
  1026. !                      .
  1027.   
  1028. !   [ 28 .. 31 ]     [ 7.7 .. 8.1 ]      /                  I T
  1029.   @end example
  1030.   @end group
  1031.   
  1032. --- 2787,2797 ----
  1033.   
  1034.   @group
  1035.   @example
  1036. ! 1:  [7.7 .. 8.1]  2:  [7.7 .. 8.1]  1:  [0.24 .. 0.28]  1:  [13.9 .. 16.1]
  1037. !     .             1:  [28 .. 31]        .                   .
  1038. !                       .
  1039.   
  1040. !   [ 7.7 .. 8.1 ]    [ 28 .. 31 ]        /                   I T
  1041.   @end example
  1042.   @end group
  1043.   
  1044. ***************
  1045. *** 3279,3285 ****
  1046.   
  1047.   @group
  1048.   @example
  1049. ! 1:  x^6          2:  x^2        1: 360 x^2
  1050.       .            1:  4             .
  1051.                        .
  1052.   
  1053. --- 3304,3310 ----
  1054.   
  1055.   @group
  1056.   @example
  1057. ! 1:  x^6          2:  x^6        1: 360 x^2
  1058.       .            1:  4             .
  1059.                        .
  1060.   
  1061. ***************
  1062. *** 4423,4441 ****
  1063. --- 4448,4477 ----
  1064.   @display
  1065.   prefix @samp{+} and @samp{-} [@code{neg}] (as in @samp{-x})
  1066.     and prefix @samp{!} [@code{lnot}] (logical ``not,'' as in @samp{!x});
  1067.   @samp{+/-} [@code{sdev}] (the standard deviation symbol) and
  1068.     @samp{mod} [@code{makemod}] (the symbol for modulo forms);
  1069.   postfix @samp{!} [@code{fact}] (factorial, as in @samp{n!});
  1070.   @samp{^} [@code{pow}] (raised-to-the-power-of);
  1071.   @samp{*} [@code{mul}];
  1072.   @samp{/} [@code{div}], @samp{%} [@code{mod}] (modulo), and
  1073.     @samp{\} [@code{idiv}] (integer division);
  1074.   infix @samp{+} [@code{add}] and @samp{-} [@code{sub}] (as in @samp{x-y});
  1075.   @samp{|} [@code{vconcat}] (vector concatenation);
  1076.   relations @samp{=} [@code{eq}], @samp{!=} [@code{neq}], @samp{<} [@code{lt}], @samp{>} [@code{gt}],
  1077.     @samp{<=} [@code{leq}], and @samp{>=} [@code{geq}];
  1078.   @samp{&&} [@code{land}] (logical ``and'');
  1079.   @samp{||} [@code{lor}] (logical ``or'');
  1080.   the C-style ``if'' operator @samp{a?b:c} [@code{if}].
  1081.   @end display
  1082.   
  1083. ***************
  1084. *** 4703,4708 ****
  1085. --- 4739,4746 ----
  1086.   in the file include everything controlled by the @kbd{m} and @kbd{d}
  1087.   prefix keys, the current precision and binary word size, whether or not
  1088.   the trail is displayed, and the current height of the Calc window.
  1089. + If there were already saved mode settings in the file, they are replaced.
  1090. + Otherwise, the new mode information is appended to the end of the file.
  1091.   (You can change which file this uses; @pxref{Installation}.)@refill
  1092.   
  1093.   @kindex m x
  1094. ***************
  1095. *** 5807,5813 ****
  1096.   @tindex arg
  1097.   The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the
  1098.   ``argument'' or polar angle of a complex number.  For a number in polar
  1099. ! notation, this is simply the second component of the pair @samp{(r,theta)}.
  1100.   The result is expressed according to the current angular mode and will
  1101.   be in the range -180 degrees (exclusive) to +180 degrees (inclusive),
  1102.   or the equivalent range in radians.@refill
  1103. --- 5845,5851 ----
  1104.   @tindex arg
  1105.   The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the
  1106.   ``argument'' or polar angle of a complex number.  For a number in polar
  1107. ! notation, this is simply the second component of the pair @samp{(r;theta)}.
  1108.   The result is expressed according to the current angular mode and will
  1109.   be in the range -180 degrees (exclusive) to +180 degrees (inclusive),
  1110.   or the equivalent range in radians.@refill
  1111. ***************
  1112. *** 7056,7062 ****
  1113.   respectively, instead of square brackets.  For example, @kbd{v @{} might
  1114.   be used in preparation for yanking a matrix into a buffer running
  1115.   Mathematica.  (In fact, the Mathematica language mode uses this mode;
  1116. ! @pxref{Mathematica Language Mode}.  Note that, regardless of the
  1117.   display mode, either brackets and braces may be used to enter vectors,
  1118.   and parentheses may never be used for this purpose.@refill
  1119.   
  1120. --- 7094,7100 ----
  1121.   respectively, instead of square brackets.  For example, @kbd{v @{} might
  1122.   be used in preparation for yanking a matrix into a buffer running
  1123.   Mathematica.  (In fact, the Mathematica language mode uses this mode;
  1124. ! @pxref{Mathematica Language Mode}.)  Note that, regardless of the
  1125.   display mode, either brackets and braces may be used to enter vectors,
  1126.   and parentheses may never be used for this purpose.@refill
  1127.   
  1128. ***************
  1129. *** 7900,7905 ****
  1130. --- 7938,7956 ----
  1131.   by hand.  (The shift-@kbd{Z} prefix key is mainly for defining user
  1132.   commands; @pxref{Programming}.)
  1133.   
  1134. + If you do not specify the name of a variable to save (i.e.,
  1135. + @kbd{Z V @key{RET}}), all @samp{var-} variables with defined values
  1136. + are saved.
  1137. + @kindex Z I
  1138. + @pindex calc-insert-variables
  1139. + The shift-@kbd{Z I} (@code{calc-insert-variables}) command writes
  1140. + the values of all @samp{var-} variables into a specified buffer.
  1141. + The variables are written in the form of Lisp @code{setq} commands
  1142. + which store the values in string form.  You can place these commands
  1143. + in your @file{.emacs} buffer if you wish, though in this case it
  1144. + would be easier to use @kbd{Z V @key{RET}}.
  1145.   The only variables with predefined values are the ``special constants''
  1146.   @code{var-pi}, @code{var-e}, and @code{var-i}.  You are free to unstore these
  1147.   variables or to store a new value over them if you like, although some
  1148. ***************
  1149. *** 8512,8519 ****
  1150.   for all mode-setting commands inside the macro.
  1151.   
  1152.   The contents of the stack and trail, values of non-quick variables, and
  1153. ! other settings such as the various display modes, are @emph{not}
  1154. ! affected by @kbd{Z `} and @kbd{Z '}.
  1155.   
  1156.   @node Queries in Macros, , Local Values in Macros, Keyboard Macros
  1157.   @subsection Queries in Keyboard Macros
  1158. --- 8563,8570 ----
  1159.   for all mode-setting commands inside the macro.
  1160.   
  1161.   The contents of the stack and trail, values of non-quick variables, and
  1162. ! other settings such as the language mode and the various display modes,
  1163. ! are @emph{not} affected by @kbd{Z `} and @kbd{Z '}.
  1164.   
  1165.   @node Queries in Macros, , Local Values in Macros, Keyboard Macros
  1166.   @subsection Queries in Keyboard Macros
  1167. ***************
  1168. *** 9333,9339 ****
  1169.   @var{value})} stored in their value cell, where @var{value} is a formula
  1170.   which is evaluated when the constant's value is requested.  Variables
  1171.   which represent units are not stored in any special way; they are units
  1172. ! only because their names appear in the units table.@refill
  1173.   
  1174.   A Lisp list with any other symbol as the first element is a function call.
  1175.   The symbols @code{+}, @code{-}, @code{*}, @code{/}, @code{%}, @code{^},
  1176. --- 9384,9392 ----
  1177.   @var{value})} stored in their value cell, where @var{value} is a formula
  1178.   which is evaluated when the constant's value is requested.  Variables
  1179.   which represent units are not stored in any special way; they are units
  1180. ! only because their names appear in the units table.  If the value
  1181. ! cell contains a string, it is parsed to get the variable's value when
  1182. ! the variable is used.@refill
  1183.   
  1184.   A Lisp list with any other symbol as the first element is a function call.
  1185.   The symbols @code{+}, @code{-}, @code{*}, @code{/}, @code{%}, @code{^},
  1186. ***************
  1187. *** 9577,9583 ****
  1188.   of various types, negative HMS forms, and intervals in which all
  1189.   included values are negative.  In @code{defmath}, the expression
  1190.   @samp{(< x 0)} will automatically be converted to @samp{(math-negp x)},
  1191. ! and @samp{(>= x 0)} will be converted to samp{(not (math-negp x))}.
  1192.   @end defun
  1193.   
  1194.   @defun posp x
  1195. --- 9630,9636 ----
  1196.   of various types, negative HMS forms, and intervals in which all
  1197.   included values are negative.  In @code{defmath}, the expression
  1198.   @samp{(< x 0)} will automatically be converted to @samp{(math-negp x)},
  1199. ! and @samp{(>= x 0)} will be converted to @samp{(not (math-negp x))}.
  1200.   @end defun
  1201.   
  1202.   @defun posp x
  1203. *** macedit.el    Mon Jun  4 15:20:24 1990
  1204. --- ../dist/macedit.el    Wed Jun 13 14:08:54 1990
  1205. ***************
  1206. *** 1,4 ****
  1207. ! ;; Keyboard macro editor for GNU Emacs.  Version 1.00.
  1208.   ;; Copyright (C) 1990 Dave Gillespie, daveg@csvax.caltech.edu.
  1209.   
  1210.   ;; This file is part of GNU Emacs.
  1211. --- 1,4 ----
  1212. ! ;; Keyboard macro editor for GNU Emacs.  Version 1.01.
  1213.   ;; Copyright (C) 1990 Dave Gillespie, daveg@csvax.caltech.edu.
  1214.   
  1215.   ;; This file is part of GNU Emacs.
  1216. ***************
  1217. *** 259,278 ****
  1218.   )
  1219.   
  1220.   (defun MacEdit-lookup-key (map)
  1221. !   (setq key-str macro-str
  1222. !     key-symbol (or (lookup-key map key-str)
  1223. !                (lookup-key (current-global-map) key-str)))
  1224. !   (and (integerp key-symbol)
  1225. !        (setq key-str (substring macro-str 0 key-symbol)
  1226. !          key-symbol (or (lookup-key map key-str)
  1227. !                 (lookup-key (current-global-map) key-str))))
  1228. !   (and (consp key-symbol)
  1229. !        (setq key-symbol nil))
  1230. !   (or key-symbol
  1231. !       (setq key-str ""))
  1232. !   (setq key-last (and (> (length key-str) 0)
  1233. !               (logand (aref key-str (1- (length key-str))) 127)))
  1234. !   key-symbol
  1235.   )
  1236.   
  1237.   (defun MacEdit-read-argument (&optional obarray pred)   ;; currently ignored
  1238. --- 259,290 ----
  1239.   )
  1240.   
  1241.   (defun MacEdit-lookup-key (map)
  1242. !   (let ((loc (and map (lookup-key map macro-str)))
  1243. !     (glob (lookup-key (current-global-map) macro-str))
  1244. !     (loc-str macro-str)
  1245. !     (glob-str macro-str))
  1246. !     (and (integerp loc)
  1247. !      (setq loc-str (substring macro-str 0 loc)
  1248. !            loc (lookup-key map loc-str)))
  1249. !     (and (consp loc)
  1250. !      (setq loc nil))
  1251. !     (or loc
  1252. !     (setq loc-str ""))
  1253. !     (and (integerp glob)
  1254. !      (setq glob-str (substring macro-str 0 glob)
  1255. !            glob (lookup-key (current-global-map) glob-str)))
  1256. !     (and (consp glob)
  1257. !      (setq glob nil))
  1258. !     (or glob
  1259. !     (setq glob-str ""))
  1260. !     (if (> (length glob-str) (length loc-str))
  1261. !     (setq key-symbol glob
  1262. !           key-str glob-str)
  1263. !       (setq key-symbol loc
  1264. !         key-str loc-str))
  1265. !     (setq key-last (and (> (length key-str) 0)
  1266. !             (logand (aref key-str (1- (length key-str))) 127)))
  1267. !     key-symbol)
  1268.   )
  1269.   
  1270.   (defun MacEdit-read-argument (&optional obarray pred)   ;; currently ignored
  1271. ***************
  1272. *** 586,592 ****
  1273.   
  1274.   (defun MacEdit-mode ()
  1275.     "Keyboard Macro Editing mode.  Press C-c C-c to save and exit.
  1276. ! To abort the edit, just kill this buffer with C-x k."
  1277.     (interactive)
  1278.     (error "This mode can be enabled only by edit-kbd-macro or edit-last-kbd-macro.")
  1279.   )
  1280. --- 598,610 ----
  1281.   
  1282.   (defun MacEdit-mode ()
  1283.     "Keyboard Macro Editing mode.  Press C-c C-c to save and exit.
  1284. ! To abort the edit, just kill this buffer with C-x k RET.
  1285. ! The keyboard macro is represented as a series of M-x style command names.
  1286. ! Keystrokes which do not correspond to simple M-x commands are written as
  1287. ! \"type\" commands.  When you press C-c C-c, MacEdit converts each command
  1288. ! back into a suitable keystroke sequence; \"type\" commands are converted
  1289. ! directly back into keystrokes."
  1290.     (interactive)
  1291.     (error "This mode can be enabled only by edit-kbd-macro or edit-last-kbd-macro.")
  1292.   )
  1293.  
  1294.