home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume13 / gmcalc / patch01-fixed < prev    next >
Encoding:
Text File  |  1990-07-02  |  29.8 KB  |  935 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v13i081: Corrected patch for GNU Emacs Calc, 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 81
  7. Submitted-by: daveg@csvax.caltech.edu (David Gillespie)
  8. Archive-name: gmcalc/patch01-fixed
  9.  
  10. (The original version of this patch corresponded to a slightly older
  11. "version 1.01" than was actually posted here.  Sorry about that...
  12. Here is a corrected version of that patch.  -- Dave)
  13.  
  14.  
  15. The following patches convert Calc version 1.01 into Calc
  16. version 1.02.  To apply them automatically with Patch v2.0,
  17. first cd into your Calc distribution directory, then execute
  18. "patch -p0 <calc.patch", where "calc.patch" is the name of this file.
  19. You will want to re-byte-compile both parts, and re-format the
  20. manual, as explained in the INSTALL file.
  21.  
  22. These patches do not cover the README and INSTALL files.  The
  23. INSTALL file is just a copy of the "Installation" chapter of
  24. calc.texinfo, which is updated by this patch.  Note that some
  25. patches will add to the list of "autoload" commands recommended
  26. in that chapter.
  27.  
  28. Patches and complete tar files are also available from anonymous FTP
  29. on csvax.caltech.edu, in the "pub" subdirectory.
  30.  
  31. Enjoy!
  32.                             -- Dave
  33.  
  34. Dave Gillespie
  35. 256-80 Caltech, Pasadena CA 91125
  36. daveg@csvax.caltech.edu, ...!cit-vax!daveg
  37.  
  38.  
  39.  
  40. *** calc.el    Tue Jun 26 16:14:45 1990
  41. --- ../dist/calc.el    Tue Jun 26 16:33:01 1990
  42. ***************
  43. *** 1,4 ****
  44. ! ;; Calculator for GNU Emacs
  45.   ;; Copyright (C) 1990 Dave Gillespie
  46.   
  47.   ;; This file is part of GNU Emacs.
  48. --- 1,4 ----
  49. ! ;; Calculator for GNU Emacs version 1.02
  50.   ;; Copyright (C) 1990 Dave Gillespie
  51.   
  52.   ;; This file is part of GNU Emacs.
  53. ***************
  54. *** 60,66 ****
  55.   
  56.   (defmacro calc-record-compilation-date-macro ()
  57.     (` (setq calc-version (concat "Emacs Calc Mode"
  58. !                 " v1.01 by Dave Gillespie"
  59.                   ", installed "
  60.                   (, (current-time-string))
  61.                   " by "
  62. --- 60,66 ----
  63.   
  64.   (defmacro calc-record-compilation-date-macro ()
  65.     (` (setq calc-version (concat "Emacs Calc Mode"
  66. !                 " v1.02 by Dave Gillespie"
  67.                   ", installed "
  68.                   (, (current-time-string))
  69.                   " by "
  70. ***************
  71. *** 92,97 ****
  72. --- 92,99 ----
  73.   ;;;      Together, Apart, Cancel, Factor, GCD, quotient/remainder.
  74.   ;;;   Automatically generate derivatives for functions defined with Z F.
  75.   ;;;   Handle commutativity and associativity among +, -, *, / in rewrite rules.
  76. + ;;;   Allow more powerful patterns, e.g., generic function names.
  77. + ;;;   Have a command that distributes function calls over equations.
  78.   ;;;
  79.   ;;;   In no-simplify mode, have a key which executes the top-level call
  80.   ;;;      once, but does not execute any of the arguments' calls.
  81. ***************
  82. *** 682,687 ****
  83. --- 684,690 ----
  84.     (if (or (not (eq major-mode 'calc-mode))
  85.         (and (boundp 'calc-defs) calc-defs))
  86.         (calc-mode))
  87. +   (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
  88.     (if calc-always-load-extensions
  89.         (calc-extensions))
  90.     (if calc-language
  91. ***************
  92. *** 690,696 ****
  93.       (calc-set-language calc-language calc-language-option t)))
  94.   )
  95.   
  96. ! (defun calc (&optional arg no-display)
  97.     "The Emacs Calculator.  Full documentation is listed under \"calc-mode\"."
  98.     (interactive "P")
  99.     (or (fboundp 'calc-extensions)
  100. --- 693,699 ----
  101.       (calc-set-language calc-language calc-language-option t)))
  102.   )
  103.   
  104. ! (defun calc (&optional arg full-display)
  105.     "The Emacs Calculator.  Full documentation is listed under \"calc-mode\"."
  106.     (interactive "P")
  107.     (or (fboundp 'calc-extensions)
  108. ***************
  109. *** 705,726 ****
  110.       (calc-quit)
  111.         (let ((oldbuf (current-buffer)))
  112.       (calc-create-buffer)
  113. !     (if (get-buffer-window (current-buffer))
  114. !         (select-window (get-buffer-window (current-buffer)))
  115. !       (if (and (boundp 'calc-window-hook) calc-window-hook)
  116. !           (run-hooks 'calc-window-hook)
  117. !         (let ((w (get-largest-window)))
  118. !           (if (and pop-up-windows
  119. !                (> (window-height w)
  120. !               (+ window-min-height calc-window-height 2)))
  121. !           (progn
  122. !             (setq w (split-window w
  123. !                       (- (window-height w)
  124. !                          calc-window-height 2)
  125. !                       nil))
  126. !             (set-window-buffer w (current-buffer))
  127. !             (select-window w))
  128. !         (pop-to-buffer (current-buffer))))))
  129.       (save-excursion
  130.         (let ((buf (current-buffer)))
  131.           (set-buffer (get-buffer-create "*Calc Trail*"))
  132. --- 708,731 ----
  133.       (calc-quit)
  134.         (let ((oldbuf (current-buffer)))
  135.       (calc-create-buffer)
  136. !     (if full-display
  137. !         (switch-to-buffer (current-buffer) t)
  138. !       (if (get-buffer-window (current-buffer))
  139. !           (select-window (get-buffer-window (current-buffer)))
  140. !         (if (and (boundp 'calc-window-hook) calc-window-hook)
  141. !         (run-hooks 'calc-window-hook)
  142. !           (let ((w (get-largest-window)))
  143. !         (if (and pop-up-windows
  144. !              (> (window-height w)
  145. !                 (+ window-min-height calc-window-height 2)))
  146. !             (progn
  147. !               (setq w (split-window w
  148. !                         (- (window-height w)
  149. !                            calc-window-height 2)
  150. !                         nil))
  151. !               (set-window-buffer w (current-buffer))
  152. !               (select-window w))
  153. !           (pop-to-buffer (current-buffer)))))))
  154.       (save-excursion
  155.         (let ((buf (current-buffer)))
  156.           (set-buffer (get-buffer-create "*Calc Trail*"))
  157. ***************
  158. *** 728,735 ****
  159.           (and calc-display-trail
  160.            (= (window-width) (screen-width))
  161.            (calc-trail-display 1 t))))
  162. !     (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
  163. !     (calc-summary)
  164.       (and calc-said-hello
  165.            (interactive-p)
  166.            (progn
  167. --- 733,739 ----
  168.           (and calc-display-trail
  169.            (= (window-width) (screen-width))
  170.            (calc-trail-display 1 t))))
  171. !     (calc-summary full-display)
  172.       (and calc-said-hello
  173.            (interactive-p)
  174.            (progn
  175. ***************
  176. *** 739,744 ****
  177. --- 743,754 ----
  178.       (run-hooks 'calc-start-hook))))
  179.   )
  180.   
  181. + (defun full-calc ()
  182. +   "Invoke the Calculator and give it a full-sized window."
  183. +   (interactive)
  184. +   (calc nil t)
  185. + )
  186.   (defun another-calc ()
  187.     "Create another, independent Calculator buffer."
  188.     (interactive)
  189. ***************
  190. *** 783,788 ****
  191. --- 793,799 ----
  192.                     'flat calc-language))
  193.          (calc-dollar-values calc-quick-prev-results)
  194.          (calc-dollar-used 0)
  195. +        (enable-recursive-minibuffers t)
  196.          (alg-exp (calc-do-alg-entry "" "Quick calc: ")))
  197.         (let ((buf ""))
  198.       (setq calc-quick-prev-results alg-exp)
  199. ***************
  200. *** 797,805 ****
  201.       (message buf))))
  202.   )
  203.   
  204. ! (defun calc-summary ()
  205.     (interactive)
  206. !   (message "Welcome to the GNU Emacs Calculator!  Press ? for help, q to quit.")
  207.   )
  208.   
  209.   (defun calc-info ()
  210. --- 808,818 ----
  211.       (message buf))))
  212.   )
  213.   
  214. ! (defun calc-summary (&optional full)
  215.     (interactive)
  216. !   (if full
  217. !       (message "Welcome to GNU Emacs Calc!  Press `?' or `i' for help, `C-x C-c' to quit.")
  218. !       (message "Welcome to the GNU Emacs Calculator!  Press `?' or `i' for help, `q' to quit."))
  219.   )
  220.   
  221.   (defun calc-info ()
  222. ***************
  223. *** 813,820 ****
  224.   (defun calc-help ()
  225.     (interactive)
  226.     (let ((msgs
  227. !      '("Letter keys: Help, Info, Why; Xtended cmd; Yank; Quit"
  228. !        "Letter keys: Negate; Precision; Store, Recall, Let"
  229.          "Letter keys: SHIFT + Undo, reDo, last-X; Inverse, Hyperbolic"
  230.          "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
  231.          "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
  232. --- 826,833 ----
  233.   (defun calc-help ()
  234.     (interactive)
  235.     (let ((msgs
  236. !      '("Letter keys: Help, Info (manual), Why; Xtended cmd; Quit"
  237. !        "Letter keys: Negate; Precision; Store, Recall, Let; Yank"
  238.          "Letter keys: SHIFT + Undo, reDo, last-X; Inverse, Hyperbolic"
  239.          "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
  240.          "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
  241. ***************
  242. *** 2515,2524 ****
  243.   )
  244.   
  245.   (defun math-div2-bignum (a)   ; [l l]
  246. !   (cond
  247. !    ((null (cdr a)) (list (/ (car a) 2)))
  248. !    (t (cons (+ (/ (car a) 2) (* (% (nth 1 a) 2) 500))
  249. !         (math-div2-bignum (cdr a)))))
  250.   )
  251.   
  252.   
  253. --- 2528,2537 ----
  254.   )
  255.   
  256.   (defun math-div2-bignum (a)   ; [l l]
  257. !   (if (cdr a)
  258. !       (cons (+ (/ (car a) 2) (* (% (nth 1 a) 2) 500))
  259. !         (math-div2-bignum (cdr a)))
  260. !     (list (/ (car a) 2)))
  261.   )
  262.   
  263.   
  264. ***************
  265. *** 2627,2636 ****
  266.   )
  267.   
  268.   (defun math-div10-bignum (a)   ; [l l]
  269. !   (cond
  270. !    ((null (cdr a)) (list (/ (car a) 10)))
  271. !    (t (cons (+ (/ (car a) 10) (* (% (nth 1 a) 10) 100))
  272. !         (math-div10-bignum (cdr a)))))
  273.   )
  274.   
  275.   ;;; Coerce A to be a float.  [F N; V V] [Public]
  276. --- 2640,2649 ----
  277.   )
  278.   
  279.   (defun math-div10-bignum (a)   ; [l l]
  280. !   (if (cdr a)
  281. !       (cons (+ (/ (car a) 10) (* (% (nth 1 a) 10) 100))
  282. !         (math-div10-bignum (cdr a)))
  283. !     (list (/ (car a) 10)))
  284.   )
  285.   
  286.   ;;; Coerce A to be a float.  [F N; V V] [Public]
  287. ***************
  288. *** 3054,3071 ****
  289.   
  290.   ;;; Multiply digit list A by digit D.  [L L D D; l l D D]
  291.   (defun math-mul-bignum-digit (a d c)
  292. !   (and a
  293. !        (if (<= d 1)
  294. !        (and (= d 1) a)
  295. !      (let* ((a (copy-sequence a)) (aa a) prod)
  296. !        (while (progn
  297. !             (setcar aa (% (setq prod (+ (* (car aa) d) c)) 1000))
  298. !             (cdr aa))
  299. !          (setq aa (cdr aa)
  300. !            c (/ prod 1000)))
  301. !        (if (>= prod 1000)
  302. !            (setcdr aa (list (/ prod 1000))))
  303. !        a)))
  304.   )
  305.   
  306.   
  307. --- 3067,3086 ----
  308.   
  309.   ;;; Multiply digit list A by digit D.  [L L D D; l l D D]
  310.   (defun math-mul-bignum-digit (a d c)
  311. !   (if a
  312. !       (if (<= d 1)
  313. !       (and (= d 1) a)
  314. !     (let* ((a (copy-sequence a)) (aa a) prod)
  315. !       (while (progn
  316. !            (setcar aa (% (setq prod (+ (* (car aa) d) c)) 1000))
  317. !            (cdr aa))
  318. !         (setq aa (cdr aa)
  319. !           c (/ prod 1000)))
  320. !       (if (>= prod 1000)
  321. !           (setcdr aa (list (/ prod 1000))))
  322. !       a))
  323. !     (and (> c 0)
  324. !      (list c)))
  325.   )
  326.   
  327.   
  328. ***************
  329. *** 3132,3161 ****
  330.   ;;; Divide a bignum digit list by another.  [l.l l L]
  331.   ;;; The following division algorithm is borrowed from Knuth vol. II, sec. 4.3.1
  332.   (defun math-div-bignum (a b)
  333. !   (if (null (cdr b))
  334. !       (let ((res (math-div-bignum-digit a (car b))))
  335. !     (cons (car res) (list (cdr res))))
  336. !     (let* ((alen (length a))
  337. !        (blen (length b))
  338. !        (d (/ 1000 (1+ (nth (1- blen) b))))
  339. !        (res (math-div-bignum-big (math-mul-bignum-digit a d 0)
  340. !                      (math-mul-bignum-digit b d 0)
  341. !                      alen blen)))
  342. !       (if (= d 1)
  343. !       res
  344. !     (cons (car res)
  345. !           (car (math-div-bignum-digit (cdr res) d))))))
  346.   )
  347.   
  348.   ;;; Divide a bignum digit list by a digit.  [l.D l D]
  349.   (defun math-div-bignum-digit (a b)
  350. !   (if (null a)
  351. !       '(nil . 0)
  352. !     (let* ((res (math-div-bignum-digit (cdr a) b))
  353. !        (num (+ (* (cdr res) 1000) (car a))))
  354. !       (cons
  355. !        (cons (/ num b) (car res))
  356. !        (% num b))))
  357.   )
  358.   
  359.   (defun math-div-bignum-big (a b alen blen)   ; [l.l l L]
  360. --- 3147,3176 ----
  361.   ;;; Divide a bignum digit list by another.  [l.l l L]
  362.   ;;; The following division algorithm is borrowed from Knuth vol. II, sec. 4.3.1
  363.   (defun math-div-bignum (a b)
  364. !   (if (cdr b)
  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. !     (let ((res (math-div-bignum-digit a (car b))))
  376. !       (cons (car res) (list (cdr res)))))
  377.   )
  378.   
  379.   ;;; Divide a bignum digit list by a digit.  [l.D l D]
  380.   (defun math-div-bignum-digit (a b)
  381. !   (if a
  382. !       (let* ((res (math-div-bignum-digit (cdr a) b))
  383. !          (num (+ (* (cdr res) 1000) (car a))))
  384. !     (cons
  385. !      (cons (/ num b) (car res))
  386. !      (% num b)))
  387. !     '(nil . 0))
  388.   )
  389.   
  390.   (defun math-div-bignum-big (a b alen blen)   ; [l.l l L]
  391. ***************
  392. *** 4057,4063 ****
  393.     (interactive "sBug Subject: ")
  394.     (mail nil calc-bug-address topic)
  395.     (goto-char (point-max))
  396. !   (insert "\nIn Calc 1.01, Emacs " (emacs-version) "\n\n")
  397.     (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
  398.   )
  399.   
  400. --- 4072,4078 ----
  401.     (interactive "sBug Subject: ")
  402.     (mail nil calc-bug-address topic)
  403.     (goto-char (point-max))
  404. !   (insert "\nIn Calc 1.02, Emacs " (emacs-version) "\n\n")
  405.     (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
  406.   )
  407.   
  408. *** calc-ext.el    Tue Jun 26 16:14:44 1990
  409. --- ../dist/calc-ext.el    Wed Jun 13 11:27:16 1990
  410. ***************
  411. *** 88,93 ****
  412. --- 88,94 ----
  413.     (define-key calc-mode-map "\M-w" 'calc-copy-region-as-kill)
  414.     (define-key calc-mode-map "\C-y" 'calc-yank)
  415.     (define-key calc-mode-map "\C-_" 'calc-undo)
  416. +   (define-key calc-mode-map "\C-xu" 'calc-undo)
  417.   
  418.     (define-key calc-mode-map "a" nil)
  419.     (define-key calc-mode-map "a?" 'calc-a-prefix-help)
  420. ***************
  421. *** 298,303 ****
  422. --- 299,305 ----
  423.     (define-key calc-mode-map "Ze" 'calc-user-define-edit)
  424.     (define-key calc-mode-map "Zf" 'calc-user-define-formula)
  425.     (define-key calc-mode-map "Zg" 'calc-get-user-defn)
  426. +   (define-key calc-mode-map "Zi" 'calc-insert-variables)
  427.     (define-key calc-mode-map "Zk" 'calc-user-define-kbd-macro)
  428.     (define-key calc-mode-map "Zp" 'calc-user-define-permanent)
  429.     (define-key calc-mode-map "Zu" 'calc-user-undefine)
  430. ***************
  431. *** 1212,1217 ****
  432. --- 1214,1221 ----
  433.            (set ivar (calc-top 1))
  434.          (if (null ival)
  435.              (error "No such variable"))
  436. +        (if (stringp ival)
  437. +            (setq ival (math-read-expr ival)))
  438.          (setq ival (calc-normalize ival))
  439.          (cond ((equal oper "+")
  440.             (set ivar (calc-normalize
  441. ***************
  442. *** 1294,1299 ****
  443. --- 1298,1307 ----
  444.        (if (not (and (boundp ivar) ivar))
  445.        (error "No such variable"))
  446.        (let ((ival (symbol-value ivar)))
  447. +        (if (stringp ival)
  448. +        (setq ival (math-read-expr ival)))
  449. +        (if (eq (car-safe ival) 'error)
  450. +        (error "Bad format in variable contents: %s" (nth 2 ival)))
  451.          (setq ival (calc-normalize ival))
  452.          (calc-record ival (concat "<"
  453.                    (if (string-match "\\`var-.+\\'" var)
  454. ***************
  455. *** 5150,5191 ****
  456.               (minibuffer-completion-confirm t)
  457.               (oper "r"))
  458.           (read-from-minibuffer
  459. !          "Save variable: " "var-" calc-store-var-map nil)))
  460.        pos)
  461. !      (if (equal var "")
  462. !      ()
  463. !        (or (and (boundp (intern var)) (intern var))
  464. !        (error "No such variable"))
  465. !        (set-buffer (find-file-noselect (substitute-in-file-name
  466. !                     calc-settings-file)))
  467. !        (goto-char (point-min))
  468. !        (if (search-forward (concat "(setq " var " '") nil t)
  469. !        (progn
  470. !          (setq pos (point-marker))
  471. !          (forward-line -1)
  472. !          (if (looking-at ";;; Variable .* stored by Calc on ")
  473. !          (progn
  474. !            (delete-region (match-end 0) (progn (end-of-line) (point)))
  475. !            (insert (current-time-string))))
  476. !          (goto-char (- pos 8 (length var)))
  477. !          (forward-sexp 1)
  478. !          (backward-char 1)
  479. !          (delete-region pos (point)))
  480. !      (goto-char (point-max))
  481. !      (insert "\n;;; Variable \""
  482. !          var
  483. !          "\" stored by Calc on "
  484. !          (current-time-string)
  485. !          "\n(setq "
  486. !          var
  487. !          " ')\n")
  488. !      (backward-char 2))
  489. !        (insert (prin1-to-string (symbol-value (intern var))))
  490. !        (forward-line 1)
  491. !        (save-buffer))))
  492.   )
  493.   
  494.   
  495.   
  496.   (defun calc-call-last-kbd-macro (arg)
  497.     "Execute the most recent keyboard macro."
  498. --- 5158,5233 ----
  499.               (minibuffer-completion-confirm t)
  500.               (oper "r"))
  501.           (read-from-minibuffer
  502. !          "Save variable (default=all): " "var-"
  503. !          calc-store-var-map nil)))
  504.        pos)
  505. !      (or (equal var "") (equal var "var-")
  506. !      (and (boundp (intern var)) (intern var))
  507. !      (error "No such variable"))
  508. !      (set-buffer (find-file-noselect (substitute-in-file-name
  509. !                       calc-settings-file)))
  510. !      (if (or (equal var "") (equal var "var-"))
  511. !      (mapatoms (function
  512. !             (lambda (x)
  513. !               (and (string-match "\\`var-" (symbol-name x))
  514. !                (boundp x)
  515. !                (symbol-value x)
  516. !                (not (eq (car-safe (symbol-value x))
  517. !                     'special-const))
  518. !                (calc-insert-permanent-variable x)))))
  519. !        (calc-insert-permanent-variable (intern var)))
  520. !      (save-buffer)))
  521. ! )
  522. ! (defun calc-insert-permanent-variable (var)
  523. !   (goto-char (point-min))
  524. !   (if (search-forward (concat "(setq " (symbol-name var) " '") nil t)
  525. !       (progn
  526. !     (setq pos (point-marker))
  527. !     (forward-line -1)
  528. !     (if (looking-at ";;; Variable .* stored by Calc on ")
  529. !         (progn
  530. !           (delete-region (match-end 0) (progn (end-of-line) (point)))
  531. !           (insert (current-time-string))))
  532. !     (goto-char (- pos 8 (length (symbol-name var))))
  533. !     (forward-sexp 1)
  534. !     (backward-char 1)
  535. !     (delete-region pos (point)))
  536. !     (goto-char (point-max))
  537. !     (insert "\n;;; Variable \""
  538. !         (symbol-name var)
  539. !         "\" stored by Calc on "
  540. !         (current-time-string)
  541. !         "\n(setq "
  542. !         (symbol-name var)
  543. !         " ')\n")
  544. !     (backward-char 2))
  545. !   (insert (prin1-to-string (symbol-value var)))
  546. !   (forward-line 1)
  547.   )
  548.   
  549.   
  550. + (defun calc-insert-variables (buf)
  551. +   "Insert all variables beginning with \"var-\" in the specified buffer."
  552. +   (interactive "bBuffer in which to save variable values: ")
  553. +   (save-excursion
  554. +     (set-buffer buf)
  555. +     (mapatoms (function
  556. +            (lambda (x)
  557. +          (and (string-match "\\`var-" (symbol-name x))
  558. +               (boundp x)
  559. +               (symbol-value x)
  560. +               (not (eq (car-safe (symbol-value x)) 'special-const))
  561. +               (insert "(setq "
  562. +                   (symbol-name x)
  563. +                   " "
  564. +                   (prin1-to-string
  565. +                    (if (stringp (symbol-value x))
  566. +                    (symbol-value x)
  567. +                  (math-format-value (symbol-value x) 1000)))
  568. +                   ")\n"))))))
  569. + )
  570.   
  571.   (defun calc-call-last-kbd-macro (arg)
  572.     "Execute the most recent keyboard macro."
  573. ***************
  574. *** 5236,5241 ****
  575. --- 5278,5286 ----
  576.                  (insert fmt "\n"))
  577.                (setq new-stack (cdr new-stack)))
  578.              (calc-renumber-stack))
  579. +            (while new-stack
  580. +          (calc-record-undo (list 'push 1))
  581. +          (setq new-stack (cdr new-stack)))
  582.              (calc-refresh))
  583.            (calc-record-undo (list 'set 'saved-stack-top 0))))))))
  584.   )
  585. ***************
  586. *** 10632,10642 ****
  587.              (not (eq (car-safe (symbol-value (nth 2 x)))
  588.               'incomplete)))
  589.         (let ((val (symbol-value (nth 2 x))))
  590. !         (if (eq (car-safe val) 'special-const)
  591. !         (if calc-symbolic-mode
  592. !             x
  593. !           val)
  594. !           val))
  595.       x)
  596.       x)
  597.   )
  598. --- 10677,10691 ----
  599.              (not (eq (car-safe (symbol-value (nth 2 x)))
  600.               'incomplete)))
  601.         (let ((val (symbol-value (nth 2 x))))
  602. !         (if (stringp val)
  603. !         (setq val (math-read-expr val)))
  604. !         (if (eq (car-safe val) 'error)
  605. !         x
  606. !           (if (eq (car-safe val) 'special-const)
  607. !           (if calc-symbolic-mode
  608. !               x
  609. !             val)
  610. !         val)))
  611.       x)
  612.       x)
  613.   )
  614. ***************
  615. *** 12795,12801 ****
  616.        ( Ang     "1e-10 m"         "Angstrom" )
  617.        
  618.        ;; Area
  619. !      ( hect    "1000 m^2"         "*Hectare" )
  620.        ( acre    "mi^2 / 640"         "Acre" )
  621.        ( b       "1e-28 m^2"         "Barn" )
  622.        
  623. --- 12844,12850 ----
  624.        ( Ang     "1e-10 m"         "Angstrom" )
  625.        
  626.        ;; Area
  627. !      ( hect    "10000 m^2"         "*Hectare" )
  628.        ( acre    "mi^2 / 640"         "Acre" )
  629.        ( b       "1e-28 m^2"         "Barn" )
  630.        
  631. *** calc.texinfo    Tue Jun 26 16:14:49 1990
  632. --- ../dist/calc.texinfo    Tue Jun 26 16:34:50 1990
  633. ***************
  634. *** 1,7 ****
  635.   \input texinfo                  @c -*-texinfo-*-
  636.   @comment %**start of header (This is for running Texinfo on a region.)
  637.   @setfilename calc-info
  638. ! @settitle GNU Emacs Calc 1.01 Manual
  639.   @setchapternewpage odd
  640.   @comment %**end of header (This is for running Texinfo on a region.)
  641.   
  642. --- 1,7 ----
  643.   \input texinfo                  @c -*-texinfo-*-
  644.   @comment %**start of header (This is for running Texinfo on a region.)
  645.   @setfilename calc-info
  646. ! @settitle GNU Emacs Calc 1.02 Manual
  647.   @setchapternewpage odd
  648.   @comment %**end of header (This is for running Texinfo on a region.)
  649.   
  650. ***************
  651. *** 38,46 ****
  652.   @sp 6
  653.   @center @titlefont{Calc Manual}
  654.   @sp 4
  655. ! @center GNU Emacs Calc Version 1.01
  656.   @sp 1
  657. ! @center May 1990
  658.   @sp 5
  659.   @center Dave Gillespie
  660.   @page
  661. --- 38,46 ----
  662.   @sp 6
  663.   @center @titlefont{Calc Manual}
  664.   @sp 4
  665. ! @center GNU Emacs Calc Version 1.02
  666.   @sp 1
  667. ! @center June 1990
  668.   @sp 5
  669.   @center Dave Gillespie
  670.   @page
  671. ***************
  672. *** 760,770 ****
  673.   automatically enters that number and then does the requested command.
  674.   Thus @kbd{2 @key{RET} 3 +} will work just as well.@refill
  675.   
  676.   The @key{DEL} key is called Backspace on some keyboards.  It is
  677.   whatever key you would use to correct a simple typing error when
  678.   regularly using Emacs.  The @key{DEL} key pops and throws away the
  679.   top value on the stack.  (You can still get that value back from
  680. ! the Trail if you should need it later on.)
  681.   
  682.   Since the @kbd{-} key is also an operator (it subtracts the top two
  683.   stack elements), how does one enter a negative number?  Calc uses
  684. --- 760,791 ----
  685.   automatically enters that number and then does the requested command.
  686.   Thus @kbd{2 @key{RET} 3 +} will work just as well.@refill
  687.   
  688. + Examples in this tutorial will often omit @key{RET} even when the
  689. + stack displays shown would only happen if you did press @key{RET}:
  690. + @group
  691. + @example
  692. + 1:  2          2:  2          1:  5
  693. +     .          1:  3              .
  694. +                    .
  695. +   2 RET            3              +
  696. + @end example
  697. + @end group
  698. + Here, after pressing @kbd{3} the stack would really show @samp{1:  2}
  699. + with @samp{Calc: 3} in the minibuffer.  In these situations, you can
  700. + press the optional @key{RET} to see the stack as the figure shows.
  701.   The @key{DEL} key is called Backspace on some keyboards.  It is
  702.   whatever key you would use to correct a simple typing error when
  703.   regularly using Emacs.  The @key{DEL} key pops and throws away the
  704.   top value on the stack.  (You can still get that value back from
  705. ! the Trail if you should need it later on.)  There are many places
  706. ! in this tutorial where we assume you have used @key{DEL} to erase the
  707. ! results of the previous example at the beginning of a new example.
  708. ! In the few places that it is really important to use @key{DEL} to
  709. ! clear away old results, the text will remind you to do so.
  710.   
  711.   Since the @kbd{-} key is also an operator (it subtracts the top two
  712.   stack elements), how does one enter a negative number?  Calc uses
  713. ***************
  714. *** 1626,1632 ****
  715.   @end group
  716.   
  717.   The shift-@kbd{S} command computes the sine of an angle.  The sine
  718. ! of 45 degrees is @samp{sqrt(2)/2}; squaring this yields {2/4 = 0.5}.
  719.   However, there has been a slight roundoff error because the
  720.   resentation of @samp{sqrt(2)/2} wasn't exact.  The @kbd{c 1}
  721.   command is a handy way to clean up numbers in this case; it
  722. --- 1647,1653 ----
  723.   @end group
  724.   
  725.   The shift-@kbd{S} command computes the sine of an angle.  The sine
  726. ! of 45 degrees is @samp{sqrt(2)/2}; squaring this yields @samp{2/4 = 0.5}.
  727.   However, there has been a slight roundoff error because the
  728.   resentation of @samp{sqrt(2)/2} wasn't exact.  The @kbd{c 1}
  729.   command is a handy way to clean up numbers in this case; it
  730. ***************
  731. *** 2262,2268 ****
  732.   @end group
  733.   
  734.   The vertical bar @kbd{|} @dfn{concatenates} numbers, vectors, and
  735. ! matrices together.  Here we have used it to add a new column onto
  736.   our matrix to make it square.
  737.   
  738.   We can multiply these two matrices in either order to get an identity.
  739. --- 2283,2289 ----
  740.   @end group
  741.   
  742.   The vertical bar @kbd{|} @dfn{concatenates} numbers, vectors, and
  743. ! matrices together.  Here we have used it to add a new row onto
  744.   our matrix to make it square.
  745.   
  746.   We can multiply these two matrices in either order to get an identity.
  747. ***************
  748. *** 2746,2760 ****
  749.   
  750.   @group
  751.   @example
  752. ! 1:  30 +/- 1     2:  30 +/- 1     1:  3.75 +/- 0.156   1:  75.06 +/- 0.594
  753. !     .            1:  8 +/- 0.2        .                    .
  754.                        .
  755.   
  756. !     30 p 1           8 p .2           /                   I T
  757.   @end example
  758.   @end group
  759.   
  760. ! This means that the angle is about 75 degrees, and, assuming our
  761.   original error estimates were valid standard deviations, there is about
  762.   a 60% chance that the result is correct within 0.59 degrees.
  763.   
  764. --- 2767,2781 ----
  765.   
  766.   @group
  767.   @example
  768. ! 1:  8 +/- 0.2    2:  8 +/- 0.2    1:  0.266 +/- 0.011   1:  14.9 +/- 0.594
  769. !     .            1:  30 +/- 1         .                     .
  770.                        .
  771.   
  772. !     8 p .2           30 p 1           /                     I T
  773.   @end example
  774.   @end group
  775.   
  776. ! This means that the angle is about 15 degrees, and, assuming our
  777.   original error estimates were valid standard deviations, there is about
  778.   a 60% chance that the result is correct within 0.59 degrees.
  779.   
  780. ***************
  781. *** 2766,2776 ****
  782.   
  783.   @group
  784.   @example
  785. ! 1:  [28 .. 31]  2:  [28 .. 31]    1:  [3.45 .. 4.02]  1:  [73.86 .. 76.05]
  786. !     .           1:  [7.7 .. 8.1]      .                   .
  787. !                     .
  788.   
  789. !   [ 28 .. 31 ]    [ 7.7 .. 8.1 ]      /                  I T
  790.   @end example
  791.   @end group
  792.   
  793. --- 2787,2797 ----
  794.   
  795.   @group
  796.   @example
  797. ! 1:  [7.7 .. 8.1]  2:  [7.7 .. 8.1]  1:  [0.24 .. 0.28]  1:  [13.9 .. 16.1]
  798. !     .             1:  [28 .. 31]        .                   .
  799. !                       .
  800.   
  801. !   [ 7.7 .. 8.1 ]    [ 28 .. 31 ]        /                   I T
  802.   @end example
  803.   @end group
  804.   
  805. ***************
  806. *** 3283,3289 ****
  807.   
  808.   @group
  809.   @example
  810. ! 1:  x^6          2:  x^2        1: 360 x^2
  811.       .            1:  4             .
  812.                        .
  813.   
  814. --- 3304,3310 ----
  815.   
  816.   @group
  817.   @example
  818. ! 1:  x^6          2:  x^6        1: 360 x^2
  819.       .            1:  4             .
  820.                        .
  821.   
  822. ***************
  823. *** 4718,4723 ****
  824. --- 4739,4746 ----
  825.   in the file include everything controlled by the @kbd{m} and @kbd{d}
  826.   prefix keys, the current precision and binary word size, whether or not
  827.   the trail is displayed, and the current height of the Calc window.
  828. + If there were already saved mode settings in the file, they are replaced.
  829. + Otherwise, the new mode information is appended to the end of the file.
  830.   (You can change which file this uses; @pxref{Installation}.)@refill
  831.   
  832.   @kindex m x
  833. ***************
  834. *** 5822,5828 ****
  835.   @tindex arg
  836.   The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the
  837.   ``argument'' or polar angle of a complex number.  For a number in polar
  838. ! notation, this is simply the second component of the pair @samp{(r,theta)}.
  839.   The result is expressed according to the current angular mode and will
  840.   be in the range -180 degrees (exclusive) to +180 degrees (inclusive),
  841.   or the equivalent range in radians.@refill
  842. --- 5845,5851 ----
  843.   @tindex arg
  844.   The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the
  845.   ``argument'' or polar angle of a complex number.  For a number in polar
  846. ! notation, this is simply the second component of the pair @samp{(r;theta)}.
  847.   The result is expressed according to the current angular mode and will
  848.   be in the range -180 degrees (exclusive) to +180 degrees (inclusive),
  849.   or the equivalent range in radians.@refill
  850. ***************
  851. *** 7915,7920 ****
  852. --- 7938,7956 ----
  853.   by hand.  (The shift-@kbd{Z} prefix key is mainly for defining user
  854.   commands; @pxref{Programming}.)
  855.   
  856. + If you do not specify the name of a variable to save (i.e.,
  857. + @kbd{Z V @key{RET}}), all @samp{var-} variables with defined values
  858. + are saved.
  859. + @kindex Z I
  860. + @pindex calc-insert-variables
  861. + The shift-@kbd{Z I} (@code{calc-insert-variables}) command writes
  862. + the values of all @samp{var-} variables into a specified buffer.
  863. + The variables are written in the form of Lisp @code{setq} commands
  864. + which store the values in string form.  You can place these commands
  865. + in your @file{.emacs} buffer if you wish, though in this case it
  866. + would be easier to use @kbd{Z V @key{RET}}.
  867.   The only variables with predefined values are the ``special constants''
  868.   @code{var-pi}, @code{var-e}, and @code{var-i}.  You are free to unstore these
  869.   variables or to store a new value over them if you like, although some
  870. ***************
  871. *** 8527,8534 ****
  872.   for all mode-setting commands inside the macro.
  873.   
  874.   The contents of the stack and trail, values of non-quick variables, and
  875. ! other settings such as the various display modes, are @emph{not}
  876. ! affected by @kbd{Z `} and @kbd{Z '}.
  877.   
  878.   @node Queries in Macros, , Local Values in Macros, Keyboard Macros
  879.   @subsection Queries in Keyboard Macros
  880. --- 8563,8570 ----
  881.   for all mode-setting commands inside the macro.
  882.   
  883.   The contents of the stack and trail, values of non-quick variables, and
  884. ! other settings such as the language mode and the various display modes,
  885. ! are @emph{not} affected by @kbd{Z `} and @kbd{Z '}.
  886.   
  887.   @node Queries in Macros, , Local Values in Macros, Keyboard Macros
  888.   @subsection Queries in Keyboard Macros
  889. ***************
  890. *** 9348,9354 ****
  891.   @var{value})} stored in their value cell, where @var{value} is a formula
  892.   which is evaluated when the constant's value is requested.  Variables
  893.   which represent units are not stored in any special way; they are units
  894. ! only because their names appear in the units table.@refill
  895.   
  896.   A Lisp list with any other symbol as the first element is a function call.
  897.   The symbols @code{+}, @code{-}, @code{*}, @code{/}, @code{%}, @code{^},
  898. --- 9384,9392 ----
  899.   @var{value})} stored in their value cell, where @var{value} is a formula
  900.   which is evaluated when the constant's value is requested.  Variables
  901.   which represent units are not stored in any special way; they are units
  902. ! only because their names appear in the units table.  If the value
  903. ! cell contains a string, it is parsed to get the variable's value when
  904. ! the variable is used.@refill
  905.   
  906.   A Lisp list with any other symbol as the first element is a function call.
  907.   The symbols @code{+}, @code{-}, @code{*}, @code{/}, @code{%}, @code{^},
  908. ***************
  909. *** 9592,9598 ****
  910.   of various types, negative HMS forms, and intervals in which all
  911.   included values are negative.  In @code{defmath}, the expression
  912.   @samp{(< x 0)} will automatically be converted to @samp{(math-negp x)},
  913. ! and @samp{(>= x 0)} will be converted to samp{(not (math-negp x))}.
  914.   @end defun
  915.   
  916.   @defun posp x
  917. --- 9630,9636 ----
  918.   of various types, negative HMS forms, and intervals in which all
  919.   included values are negative.  In @code{defmath}, the expression
  920.   @samp{(< x 0)} will automatically be converted to @samp{(math-negp x)},
  921. ! and @samp{(>= x 0)} will be converted to @samp{(not (math-negp x))}.
  922.   @end defun
  923.   
  924.   @defun posp x
  925.  
  926.