[comp.emacs] Patch for Emacs Calc, 1.03 -> 1.04, part 1/2

daveg@near.cs.caltech.edu (Dave Gillespie) (08/07/90)

The following patches convert Calc version 1.03 into Calc
version 1.04.  To apply them automatically with Patch v2.0,
first cd into your Calc distribution directory, then execute
"patch -p0 <calc.patch", where "calc.patch" is the name of this file.
You will want to re-byte-compile both parts, and re-format the
manual, as explained in the calc-INSTALL file.

This is part 1 of 2 patches.  You must apply both in order to
complete the upgrade to version 1.04.

These patches do not cover the README file, but the interesting
part of that file (the revision history) is now present near the
top of calc.el.  The INSTALL file is now being included in the
patches under the name calc-INSTALL.

Note that some patches will add to the list of "autoload" commands
recommended in the calc-INSTALL file.

Patches and complete tar files are also available from anonymous FTP
on csvax.cs.caltech.edu [131.215.131.131], in the "pub" subdirectory.

Enjoy!
							-- Dave

Dave Gillespie
256-80 Caltech, Pasadena CA 91125
daveg@csvax.cs.caltech.edu, ...!cit-vax!daveg



*** calc.el	Tue Jun 26 20:53:26 1990
--- ../dist/calc.el	Mon Aug  6 14:54:39 1990
***************
*** 1,4 ****
! ;; Calculator for GNU Emacs version 1.03
  ;; Copyright (C) 1990 Dave Gillespie
  
  ;; This file is part of GNU Emacs.
--- 1,4 ----
! ;; Calculator for GNU Emacs version 1.04
  ;; Copyright (C) 1990 Dave Gillespie
  
  ;; This file is part of GNU Emacs.
***************
*** 44,53 ****
  
  ;;; Author's address:
  ;;;   Dave Gillespie, 256-80 Caltech, Pasadena CA 91125.
! ;;;   daveg@csvax.caltech.edu, ...!cit-vax!daveg.
  ;;;
  ;;; This file and the manual, calc.texinfo, are available from anonymous FTP
! ;;; on csvax.caltech.edu [192.12.18.1]; look in ~ftp/pub/calc*.
  ;;;
  ;;; Bug reports and suggestions are always welcome!
  
--- 44,56 ----
  
  ;;; Author's address:
  ;;;   Dave Gillespie, 256-80 Caltech, Pasadena CA 91125.
! ;;;   daveg@csvax.cs.caltech.edu, ...!cit-vax!daveg.
  ;;;
+ ;;; Note that csvax's name has changed slightly.  The old name,
+ ;;; csvax.caltech.edu, will also still work for a while.
+ ;;;
  ;;; This file and the manual, calc.texinfo, are available from anonymous FTP
! ;;; on csvax.cs.caltech.edu [131.215.131.131]; look in ~ftp/pub/calc*.
  ;;;
  ;;; Bug reports and suggestions are always welcome!
  
***************
*** 58,69 ****
  ;;; and "defmath".  User-accessible variables begin with "var-".
  
  
  
  (provide 'calc)
  
  (defmacro calc-record-compilation-date-macro ()
    (` (setq calc-version (concat "Emacs Calc Mode"
! 				" v1.03 by Dave Gillespie"
  				", installed "
  				(, (current-time-string))
  				" by "
--- 61,124 ----
  ;;; and "defmath".  User-accessible variables begin with "var-".
  
  
+ ;;; Version 1.04:
+ ;;;  * Included a copy of revision history (from README) in calc.el.
+ ;;;  * Added the "calc-split" feature to split calc-ext.el into smaller bits.
+ ;;;  * Changed calc-unpack to unpack floats and fractions, too.
+ ;;;  * Added "mant", "xpon", and "scf" functions for decomposing floats.
+ ;;;  * Fixed a bug in the "y" command with positive prefix arguments.
+ ;;;  * Rearranged binary shift/rotate command keys to be a bit more convenient.
+ ;;;  * Fixed a bug in which simplifying "(0/0) * 2" crashed with a Lisp error.
+ ;;;  * Made `H F' [ffloor] and friends faster for very large arguments.
+ ;;;  * Made calc-define-del more robust.
+ ;;;  * Handled pasting of data into the Calculator using the mouse under X.
+ ;;;  * Made overlay-arrow variables buffer-local to avoid interference.
+ ;;;  * Fixed a problem in which Calc Trail buffer got stuck after a C-x C-w.
+ ;;; 
+ ;;; Version 1.03:
+ ;;;  * Changed math-choose to compute n-choose-m faster when m is large.
+ ;;;  * Fixed some problems with TeX mode.
+ ;;;  * Fixed a bug that prevented `b s' from working without a prefix argument.
+ ;;;  * Added "calc-eval" function.
+ ;;;  * Improved calc-grab-region.
+ ;;; 
+ ;;; Version 1.02:
+ ;;;  * Fixed a bug in Tutorial: telephone pole height/distance were switched!
+ ;;;  * Fixed a few other things in the manual.
+ ;;;  * Added "full-calc" command.
+ ;;;  * Added "calc-insert-variables" (`Z I') command.
+ ;;;  * Quick Calc now works even if you are already in the minibuffer.
+ ;;;  * Fixed a bug in math-mul-bignum-digit which affected math-and, etc.
+ ;;;  * Definition of "Hectares" was wrong in units table.
+ ;;;  * Fixed a bug in calc-execute-kbd-macro concerning undo and refresh.
+ ;;;  * Bound "calc-undo" to `C-x u' as well as `C-_' and `U'.
+ ;;; 
+ ;;; Version 1.01:
+ ;;;  * Added a tutorial section to the manual.
+ ;;;  * Next and Prev for node Strings in the manual were reversed; fixed.
+ ;;;  * Changed "'bignum" in calc-isqrt-bignum-iter to "'bigpos".
+ ;;;  * Fixed a bug that prevented "$" from working during algebraic entry.
+ ;;;  * Fixed a bug caused by an X (last-X) command following a K (macro) cmd.
+ ;;;  * Fixed a bug in which K command incorrectly formatted stack in Big mode.
+ ;;;  * Added space between unary operators and non-flat compositions.
+ ;;;    (Otherwise, "-(a/b)" in Big mode blended the minus sign into the rule!)
+ ;;;  * Fixed formatting of (-1)^n in Big mode.
+ ;;;  * Fixed some problems relating to "not" operator in Pascal language mode.
+ ;;;  * Fixed several bugs relating to V M ' and V M $ sequences.
+ ;;;  * Fixed matrix-vector multiplication to produce a vector.
+ ;;;  * Introduced Z ` ... Z ' commands; renamed old Z ' to Z #.
+ ;;;  * Fixed various other bugs.
+ ;;;  * Added calc-settings-file variable suggested by C. Witty.
+ ;;; 
+ ;;; Version 1.00:
+ ;;;  * First official release of Calc.
+ 
  
  (provide 'calc)
  
  (defmacro calc-record-compilation-date-macro ()
    (` (setq calc-version (concat "Emacs Calc Mode"
! 				" v1.04 by Dave Gillespie"
  				", installed "
  				(, (current-time-string))
  				" by "
***************
*** 85,93 ****
  
  ;;; IDEAS:
  ;;;
- ;;;   Consider breaking calc-ext.el into several extension modules:
- ;;;      Base extensions, algebra/units, scientific, programming
- ;;;
  ;;;   How about putting cursor on an operator or functor in stack window
  ;;;      to indicate the subterm to which a command should apply?
  ;;;   Make math-simplify faster!
--- 140,145 ----
***************
*** 119,124 ****
--- 171,177 ----
  ;;;   Consider implementing some other special functions.
  ;;;   May as well make continued-fractions stuff available to the user.
  ;;;   Provide date arithmetic a la HP 48.
+ ;;;   Consider providing infinities and indeterminate values as a data type.
  ;;;
  ;;;   Implement some more built-in statistical functions:
  ;;;      mean, median, variance, std dev of a list.
***************
*** 141,146 ****
--- 194,200 ----
  ;;;   Provide more examples in the tutorial section of the manual.
  ;;;   Cover in the tutorial:  language modes, simplification modes,
  ;;;       bitwise stuff, rewrite rules.
+ ;;;   Add some exercises to the tutorial.
  ;;;   Provide more Lisp programming examples in the manual.
  ;;;   Finish the Internals section of the manual.
  ;;;
***************
*** 147,153 ****
  ;;;   Tim suggests adding spreadsheet-like features.
  ;;;   How about ultra-low-resolution plots?  (Probably too slow.)
  ;;;   How about running gnuplot to generate high-res plots?
! ;;;   Implement language modes for Lisp, Ada, ...?
  ;;;
  
  
--- 201,207 ----
  ;;;   Tim suggests adding spreadsheet-like features.
  ;;;   How about ultra-low-resolution plots?  (Probably too slow.)
  ;;;   How about running gnuplot to generate high-res plots?
! ;;;   Implement language modes for Eqn, Gnuplot, Lisp, Ada, ...?
  ;;;
  
  
***************
*** 416,421 ****
--- 470,478 ----
  (defvar calc-executing-macro nil)
  
  
+ (defvar calc-trail-buffer nil)
+ 
+ 
  (defvar calc-other-modes nil
    "List of used-defined strings to append to Calculator mode line.")
  
***************
*** 450,456 ****
  
  (defun calc-define-del (map func)
    (define-key map "\C-d" func)
!   (mapcar (function (lambda (x) (define-key map x func)))
  	  (append (where-is-internal 'delete-backward-char global-map)
  		  (where-is-internal 'backward-delete-char global-map)))
  )
--- 507,515 ----
  
  (defun calc-define-del (map func)
    (define-key map "\C-d" func)
!   (mapcar (function (lambda (x) (condition-case err
! 				    (define-key map x func)
! 				  (error nil))))
  	  (append (where-is-internal 'delete-backward-char global-map)
  		  (where-is-internal 'backward-delete-char global-map)))
  )
***************
*** 646,651 ****
--- 705,715 ----
        (progn
  	(setq calc-loaded-settings-file t)
  	(load calc-settings-file t)))   ; t = missing-ok
+   (if (eq window-system 'x)
+       (progn
+ 	(or (boundp 'calc-old-x-paste-text)
+ 	    (setq calc-old-x-paste-text (symbol-function 'x-paste-text)))
+ 	(define-key mouse-map x-button-middle 'calc-x-paste-text)))
    (run-hooks 'calc-mode-hook)
    (calc-refresh t)
    (calc-set-mode-line)
***************
*** 667,672 ****
--- 731,738 ----
    (setq mode-name "Calc Trail")
    (setq truncate-lines nil)
    (setq buffer-read-only t)
+   (make-local-variable 'overlay-arrow-position)
+   (make-local-variable 'overlay-arrow-string)
    (if buf
        (progn
  	(make-local-variable 'calc-main-buffer)
***************
*** 731,742 ****
  		      (select-window w))
  		  (pop-to-buffer (current-buffer)))))))
  	(save-excursion
! 	  (let ((buf (current-buffer)))
! 	    (set-buffer (get-buffer-create "*Calc Trail*"))
! 	    (calc-trail-mode buf)
! 	    (and calc-display-trail
! 		 (= (window-width) (screen-width))
! 		 (calc-trail-display 1 t))))
  	(calc-summary full-display)
  	(and calc-said-hello
  	     (interactive-p)
--- 797,806 ----
  		      (select-window w))
  		  (pop-to-buffer (current-buffer)))))))
  	(save-excursion
! 	  (set-buffer (calc-trail-buffer))
! 	  (and calc-display-trail
! 	       (= (window-width) (screen-width))
! 	       (calc-trail-display 1 t)))
  	(calc-summary full-display)
  	(and calc-said-hello
  	     (interactive-p)
***************
*** 776,790 ****
    (mapcar (function
  	   (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list)
    (let ((buf (current-buffer))
- 	(tbuf (get-buffer-create "*Calc Trail*"))
  	(win (get-buffer-window (current-buffer))))
      (if (and win
  	     (< (window-height win) (1- (screen-height))))
  	(setq calc-window-height (- (window-height win) 2)))
      (delete-windows-on buf)
!     (delete-windows-on tbuf)
      (bury-buffer buf)
!     (bury-buffer tbuf))
  )
  
  (defun quick-calc ()
--- 840,853 ----
    (mapcar (function
  	   (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list)
    (let ((buf (current-buffer))
  	(win (get-buffer-window (current-buffer))))
      (if (and win
  	     (< (window-height win) (1- (screen-height))))
  	(setq calc-window-height (- (window-height win) 2)))
      (delete-windows-on buf)
!     (delete-windows-on calc-trail-buffer)
      (bury-buffer buf)
!     (bury-buffer calc-trail-buffer))
  )
  
  (defun quick-calc ()
***************
*** 1347,1354 ****
--- 1410,1433 ----
    (calc-wrapper)
  )
  
+ (defun calc-x-paste-text (arg)
+   "Move point to mouse position and insert window system cut buffer contents.
+ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
+   (x-mouse-select arg)
+   (if (memq major-mode '(calc-mode calc-trail-mode))
+       (progn
+ 	(calc-wrapper
+ 	 (calc-extensions)
+ 	 (let ((val (math-read-exprs (calc-clean-newlines
+ 				      (x-get-cut-buffer)))))
+ 	   (if (eq (car-safe val) 'error)
+ 	       (error "%s in yanked data" (nth 2 val))
+ 	     (calc-enter-result 0 "Xynk" val)))))
+     (funcall calc-old-x-paste-text arg))
+ )
  
  
+ 
  ;;;; The Calc Trail buffer.
  
  (defun calc-check-trail-aligned ()
***************
*** 1366,1375 ****
  	body)
  )
  
  (defun calc-record (val &optional prefix)
    (or calc-executing-macro
        (let* ((mainbuf (current-buffer))
! 	     (buf (get-buffer-create "*Calc Trail*"))
  	     (calc-display-raw (eq calc-display-raw t))
  	     (fval (if val
  		       (if (stringp val)
--- 1445,1466 ----
  	body)
  )
  
+ (defun calc-trail-buffer ()
+   (and (or (null calc-trail-buffer)
+ 	   (null (buffer-name calc-trail-buffer)))
+        (save-excursion
+ 	 (setq calc-trail-buffer (get-buffer-create "*Calc Trail*"))
+ 	 (let ((buf (current-buffer)))
+ 	   (set-buffer calc-trail-buffer)
+ 	   (or (eq major-mode 'calc-trail-mode)
+ 	       (calc-trail-mode (current-buffer))))))
+   calc-trail-buffer
+ )
+ 
  (defun calc-record (val &optional prefix)
    (or calc-executing-macro
        (let* ((mainbuf (current-buffer))
! 	     (buf (calc-trail-buffer))
  	     (calc-display-raw (eq calc-display-raw t))
  	     (fval (if val
  		       (if (stringp val)
***************
*** 1379,1386 ****
  		     "")))
  	(save-excursion
  	  (set-buffer buf)
- 	  (if (not (eq major-mode 'calc-trail-mode))
- 	      (calc-trail-mode mainbuf))
  	  (let ((aligned (calc-check-trail-aligned))
  		(buffer-read-only nil))
  	    (goto-char (point-max))
--- 1470,1475 ----
***************
*** 1409,1416 ****
    "Turn the Trail display on or off.
  With prefix argument 1, turn it on; with argument 0, turn it off."
    (interactive "P")
!   (let* ((trail (get-buffer-create "*Calc Trail*"))
! 	 (win (get-buffer-window trail)))
      (if (setq calc-display-trail
  	      (not (if flag (memq flag '(nil 0)) win)))
  	(if (null win)
--- 1498,1504 ----
    "Turn the Trail display on or off.
  With prefix argument 1, turn it on; with argument 0, turn it off."
    (interactive "P")
!   (let ((win (get-buffer-window (calc-trail-buffer))))
      (if (setq calc-display-trail
  	      (not (if flag (memq flag '(nil 0)) win)))
  	(if (null win)
***************
*** 1418,1424 ****
  	      (if (and (boundp 'calc-trail-window-hook) calc-trail-window-hook)
  		  (run-hooks 'calc-trail-window-hook)
  		(let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
! 		  (set-window-buffer w trail)))
  	      (calc-wrapper
  	       (or no-refresh
  		   (calc-refresh)))))
--- 1506,1512 ----
  	      (if (and (boundp 'calc-trail-window-hook) calc-trail-window-hook)
  		  (run-hooks 'calc-trail-window-hook)
  		(let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
! 		  (set-window-buffer w calc-trail-buffer)))
  	      (calc-wrapper
  	       (or no-refresh
  		   (calc-refresh)))))
***************
*** 1430,1437 ****
  		 (calc-refresh)))))
        (if (and (boundp 'overlay-arrow-position)
  	       (eq overlay-arrow-position calc-trail-pointer))
! 	  (setq overlay-arrow-position nil)))
!     trail)
  )
  
  (defun calc-trail-here ()
--- 1518,1525 ----
  		 (calc-refresh)))))
        (if (and (boundp 'overlay-arrow-position)
  	       (eq overlay-arrow-position calc-trail-pointer))
! 	  (setq overlay-arrow-position nil))))
!   calc-trail-buffer
  )
  
  (defun calc-trail-here ()
***************
*** 4106,4112 ****
    (interactive "sBug Subject: ")
    (mail nil calc-bug-address topic)
    (goto-char (point-max))
!   (insert "\nIn Calc 1.03, Emacs " (emacs-version) "\n\n")
    (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
  )
  
--- 4194,4200 ----
    (interactive "sBug Subject: ")
    (mail nil calc-bug-address topic)
    (goto-char (point-max))
!   (insert "\nIn Calc 1.04, Emacs " (emacs-version) "\n\n")
    (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
  )
  
*** calc-INSTALL	Mon Aug  6 15:07:44 1990
--- ../dist/calc-INSTALL	Mon Aug  6 15:04:40 1990
***************
*** 0 ****
--- 1,185 ----
+ 
+ Installation
+ ************
+ 
+ Calc 1.04 comes as a pair of Emacs Lisp files, generally called
+ `calc.el' and `calc-ext.el'.  The first contains the basic foundations
+ of the Calculator, and is as small as possible to promote quick loading.
+ The second contains all the more advanced commands and functions.  Calc
+ is usually installed so that the `M-x calc' or `M-#' command auto-loads
+ only the first part, and the second part is auto-loaded whenever the
+ first advanced feature is used.
+ 
+ 
+ Compilation
+ ===========
+ 
+ Calc is written in a way that maximizes performance when its code has been
+ byte-compiled; a side effect is that performance is seriously degraded if
+ it *isn't* compiled.  Thus, it is essential to compile the Calculator
+ before trying to use it.  The Emacs command `M-x byte-compile-file'
+ is used to compile an Emacs Lisp file.  Compile each of `calc.el' and
+ `calc-ext.el' to obtain byte-code files `calc.elc' and
+ `calc-ext.elc'.  You may find you need to do `M-x load-file
+ calc.elc' before compiling `calc-ext.el' will work.
+ 
+ For your convenience, the FTP distribution of Calc, obtainable from
+ anonymous FTP on `csvax.cs.caltech.edu', includes already-compiled
+ versions of both of these files.
+ 
+ 
+ Auto-loading
+ ============
+ 
+ To teach Emacs how to load in Calc when you type `M-x calc' for the
+ first time, include these lines in your `.emacs' file (if you are
+ installing Calc just for your own use), or the system's `lisp/default'
+ file (if you are installing Calc publicly).
+ 
+      (autoload 'calc             ".../calc.elc"     "Calculator Mode" t nil)
+      (autoload 'calc-extensions  ".../calc-ext.elc" nil nil nil)
+      (autoload 'quick-calc       ".../calc.elc"     "Quick Calculator" t nil)
+      (autoload 'full-calc        ".../calc.elc"     "Full-screen Calculator" t nil)
+      (autoload 'calc-eval        ".../calc.elc"     "Call Calculator" nil nil)
+      (autoload 'calc-grab-region ".../calc-ext.elc" nil t nil)
+      (autoload 'defmath          ".../calc-ext.elc" nil t t)
+ 
+ where `.../calc.elc' represents the full path to the `calc.elc'
+ file, and similarly for `.../calc-ext.elc'.  If you have installed
+ these files in Emacs' main `lisp/' directory, you can just write
+ `"calc.elc"' and `"calc-ext.elc"'.
+ 
+ The `autoload' command for `calc' is what loads `calc.elc'
+ when you type `M-x calc'.  The `autoload' for `calc-extensions'
+ brings in the extensions module; Calc takes care to call the
+ `calc-extensions' function (which doesn't actually do anything)
+ before any operation that requires the extensions to be present.
+ The other five `autoload' commands are for functions which might
+ reasonably be used before the user has typed `M-x calc' for the
+ first time.
+ 
+ 
+ Merging `calc' and `calc-ext'
+ =============================
+ 
+ If you don't want to bother with a split Calculator, you can simply
+ concatenate `calc-ext.elc' onto the end of `calc.elc', rewrite
+ the above `autoload' commands all to point to the combined file,
+ and treat Calc as one big program.  You may need to do this if
+ the `autoload' mechanism is giving you problems.
+ 
+ 
+ Splitting `calc-ext'
+ ====================
+ 
+ On the other hand, you may find that `calc-ext.el' is too big to load
+ quickly.  You can split the Calculator into still more parts using the
+ `calc-split' command.  This command splits the file `calc-ext.el' into
+ about 20 small files with names like `calc-cplx.el' and `calc-mode.el'
+ in the same directory as `calc-ext.el'.  First, load the file
+ `calc-ext.el' with `C-x C-f'.  Move to the end of the buffer and type
+ `C-x C-e' at the indicated position.  Now type `M-x calc-split'.  This
+ moves most of the text out of `calc-ext.el' and into other files.  All
+ necessary `autoload' commands are inserted into `calc-ext.el'.
+ 
+ The `calc-split' command prompts for a directory name; the new files are
+ placed in this directory, and the `autoload' commands are written to
+ refer to the directory explicitly.  If you wish you can backspace over
+ the default directory name and enter a blank name, in which case the
+ `autoload' commands will be written without directory names on the
+ assumption that Emacs can find the Calc files in one of the default
+ places.  Some people prefer to put the Calc files in a subdirectory by
+ themselves.
+ 
+ The `calc-split' command also offers to byte-compile all Calc files
+ automatically.  Note that `calc.el' must have been byte-compiled and
+ loaded already, just as if you were compiling `calc-ext' whole.  If you
+ choose to compile by hand, you will need to compile `calc.el' first,
+ load it, compile the new `calc-ext.el' and load it, then compile each of
+ the new component files.  Also, note that the `autoload' commands shown
+ above are still correct for use in your startup file.
+ 
+ If you do decide to use `calc-split', note that when patches are made
+ available for new versions of Calc, they will refer to the old, unsplit
+ version of the file `calc-ext.el'.  The `calc-split' command makes a
+ copy of this under the name `calc-old.el'; be sure to keep it around so
+ you can rename it back to `calc-ext.el' before installing new patches.
+ You can then use `calc-split' again to re-split your updated version of
+ Calc.
+ 
+ 
+ Key Bindings
+ ============
+ 
+ You may wish to bind the `calc' command to a key.  The
+ recommended keystroke is `M-#' (i.e., Meta-Shift-3).  To set up
+ this key binding, include this command in your `.emacs' or
+ `lisp/default' file:
+ 
+      (global-set-key "\e#" 'calc)
+ 
+ There are no standard key assignments for `quick-calc' and
+ `calc-grab-region', but you may wish to define some.
+ 
+ 
+ The `macedit' Package
+ =====================
+ 
+ The file `macedit.el' contains another useful Emacs extension
+ called `edit-kbd-macro'.  It allows you to edit a keyboard macro
+ in human-readable form.  The `Z E' command in Calc knows how to
+ use it to edit user commands that have been defined by keyboard macros.
+ To autoload it, you will want to include the commands,
+ 
+      (autoload 'edit-kbd-macro      ".../macedit.elc" "Edit Keyboard Macro" t nil)
+      (autoload 'edit-last-kbd-macro ".../macedit.elc" "Edit Keyboard Macro" t nil)
+ 
+ 
+ Documentation
+ =============
+ 
+ The documentation for Calc (i.e., this manual) comes in a file
+ `calc.texinfo'.  To format this for use as an on-line manual,
+ open this file for editing in Emacs and give the command
+ `M-x texinfo-format-buffer'.  When this finishes, type `C-x C-s'
+ to save.  The result will be a collection of files whose names begin
+ with `calc-info'.  You can also format this into a printable
+ document using TeX, but beware, the manual is about 170 printed pages!
+ 
+ There is a Lisp variable called `calc-info-filename' which holds
+ the name of the Info file containing Calc's on-line documentation.
+ Its default value is `calc-info', which will work correctly if
+ the Info files are stored in Emacs' main `info/' directory.  If
+ you keep them elsewhere, you will want to put a command of the form,
+ 
+      (setq calc-info-filename ".../calc-info")
+ 
+ in your `.emacs' or `lisp/default' file, where again `...'
+ represents the directory containing the Info files.
+ 
+ 
+ Settings File
+ =============
+ 
+ Another variable you might want to set is `calc-settings-file', which
+ holds the file name in which commands like `m m' and `Z P' store
+ "permanent" definitions.  The default value for this variable is
+ `"~/.emacs"'.  If `calc-settings-file' does not contain `".emacs"' as a
+ substring, and if the variable `calc-loaded-settings-file' is `nil',
+ then Calc will automatically load your settings file (if it exists) the
+ first time Calc is invoked.
+ 
+ 
+ Testing the Installation
+ ========================
+ 
+ To test your installation of Calc, start a fresh Emacs and type `M-#'
+ to make sure the autoload commands and key bindings work.  Now, type
+ `i' to make sure Calc can find its Info documentation.  Press `q'
+ to exit the Info system and `M-#' to re-enter the Calculator.
+ Type `20 S' to compute the sine of 20 degrees; this will test the
+ autoloading of the extensions module.  The result should be 0.342020143326.
+ Finally, press `M-#' again to make sure the Calculator can exit.
+ 
+ (The above text is included in both the Calc documentation and the
+ file INSTALL in the Calc distribution directory.)
*** calc.texinfo	Tue Jun 26 20:53:34 1990
--- ../dist/calc.texinfo	Mon Aug  6 15:03:10 1990
***************
*** 1,7 ****
  \input texinfo                  @c -*-texinfo-*-
  @comment %**start of header (This is for running Texinfo on a region.)
  @setfilename calc-info
! @settitle GNU Emacs Calc 1.03 Manual
  @setchapternewpage odd
  @comment %**end of header (This is for running Texinfo on a region.)
  
--- 1,7 ----
  \input texinfo                  @c -*-texinfo-*-
  @comment %**start of header (This is for running Texinfo on a region.)
  @setfilename calc-info
! @settitle GNU Emacs Calc 1.04 Manual
  @setchapternewpage odd
  @comment %**end of header (This is for running Texinfo on a region.)
  
***************
*** 38,46 ****
  @sp 6
  @center @titlefont{Calc Manual}
  @sp 4
! @center GNU Emacs Calc Version 1.03
  @sp 1
! @center June 1990
  @sp 5
  @center Dave Gillespie
  @page
--- 38,46 ----
  @sp 6
  @center @titlefont{Calc Manual}
  @sp 4
! @center GNU Emacs Calc Version 1.04
  @sp 1
! @center July 1990
  @sp 5
  @center Dave Gillespie
  @page
***************
*** 512,518 ****
  Type @kbd{M-x calc} or @kbd{M-#} to start the Calculator; type @kbd{q} to quit.
  Type @kbd{M-x quick-calc} to do one quick calculation in the minibuffer.
  
! Calc normally uses RPN notation.  @xref{Stack Basics}, for a discussion
  of RPN for the beginner.  The @kbd{RET} or @kbd{SPC} key enters a number
  or duplicates the top number on the stack, @kbd{DEL} removes the top
  number from the stack, and @kbd{TAB} swaps the top two numbers.@refill
--- 512,518 ----
  Type @kbd{M-x calc} or @kbd{M-#} to start the Calculator; type @kbd{q} to quit.
  Type @kbd{M-x quick-calc} to do one quick calculation in the minibuffer.
  
! Calc normally uses RPN notation.  @xref{RPN Tutorial}, for a discussion
  of RPN for the beginner.  The @kbd{RET} or @kbd{SPC} key enters a number
  or duplicates the top number on the stack, @kbd{DEL} removes the top
  number from the stack, and @kbd{TAB} swaps the top two numbers.@refill
***************
*** 714,725 ****
  number of operands from the stack and pushes back the result.
  
  Thus we could add the numbers 2 and 3 in an RPN calculator by typing the
! keys: @kbd{1 @key{RET} 2 @key{RET} +}.  (@key{RET} corresponds to the
  @key{ENTER} key on traditional RPN calculators.)  The first four
  keystrokes ``push'' the numbers 2 and 3 onto the stack.  The @kbd{+} key
  ``pops'' the top two numbers from the stack, adds them, and pushes the
  result (5) back onto the stack.  Here's how the stack will look at
! various points throughout the calculation:
  
  @group
  @example
--- 714,725 ----
  number of operands from the stack and pushes back the result.
  
  Thus we could add the numbers 2 and 3 in an RPN calculator by typing the
! keys: @kbd{2 @key{RET} 3 @key{RET} +}.  (@key{RET} corresponds to the
  @key{ENTER} key on traditional RPN calculators.)  The first four
  keystrokes ``push'' the numbers 2 and 3 onto the stack.  The @kbd{+} key
  ``pops'' the top two numbers from the stack, adds them, and pushes the
  result (5) back onto the stack.  Here's how the stack will look at
! various points throughout the calculation:@refill
  
  @group
  @example
***************
*** 742,748 ****
  as large as you like, so it uses numbers instead of letters.  Some
  stack-manipulation commands accept a numeric argument which says
  which stack level to work on.  Normal commands like @kbd{+} always
! work on the top few levels of the stack.
  
  The Stack buffer is just an Emacs buffer, and you can move around in
  it using the regular Emacs motion commands.  But no matter where the
--- 742,748 ----
  as large as you like, so it uses numbers instead of letters.  Some
  stack-manipulation commands accept a numeric argument which says
  which stack level to work on.  Normal commands like @kbd{+} always
! work on the top few levels of the stack.@refill
  
  The Stack buffer is just an Emacs buffer, and you can move around in
  it using the regular Emacs motion commands.  But no matter where the
***************
*** 932,938 ****
  
  @group
  @example
! 1:  ( ...      2:  ( ...      1:  ( 2, ...   1:  ( 2, ...   1:  (2, 3)
      .          1:  2              .              3              .
                                                   .
  
--- 932,938 ----
  
  @group
  @example
! 1:  ( ...      2:  ( ...      1:  (2, ...    1:  (2, ...    1:  (2, 3)
      .          1:  2              .              3              .
                                                   .
  
***************
*** 1217,1223 ****
  calls are not evaluated.  In the second call, the logarithm is
  undefined for that value of the argument; in the third, there are
  too many arguments.  In the fourth case, there is no function
! called @code{foo}.
  
  We will encounter formulas involving variables and functions again
  when we discuss the algebra and calculus features of the Calculator.
--- 1217,1226 ----
  calls are not evaluated.  In the second call, the logarithm is
  undefined for that value of the argument; in the third, there are
  too many arguments.  In the fourth case, there is no function
! called @code{foo}.  You can press the @kbd{w} key (``why'') to
! see an explanation of why a function call was left unevaluated.
! Pressing @kbd{w} the first time will report the too-many-arguments
! problem; pressing it again will report the logarithm-of-zero problem.
  
  We will encounter formulas involving variables and functions again
  when we discuss the algebra and calculus features of the Calculator.
***************
*** 1393,1399 ****
  Calc has to stop somewhere.
  
  Of course, calculations are slower the more digits you request.
! Press @kbd{p 12} to set the precision back down to the default.
  
  Calculations always use the current precision.  For example, even
  though we have a 30-digit value for @samp{1/7} on the stack, if
--- 1396,1402 ----
  Calc has to stop somewhere.
  
  Of course, calculations are slower the more digits you request.
! Press @kbd{p 12} now to set the precision back down to the default.
  
  Calculations always use the current precision.  For example, even
  though we have a 30-digit value for @samp{1/7} on the stack, if
***************
*** 1605,1611 ****
  
  You can enter non-decimal numbers using the @kbd{#} symbol, too.
  Let's see what the hexadecimal number @samp{5FE} looks like in
! binary.  Type @kbd{16#5FE} (the F's can be in upper or lower case).
  It will also help to turn grouping on with @kbd{d g}:
  
  @example
--- 1608,1614 ----
  
  You can enter non-decimal numbers using the @kbd{#} symbol, too.
  Let's see what the hexadecimal number @samp{5FE} looks like in
! binary.  Type @kbd{16#5FE} (the letters can be in upper or lower case).
  It will also help to turn grouping on with @kbd{d g}:
  
  @example
***************
*** 1649,1655 ****
  The shift-@kbd{S} command computes the sine of an angle.  The sine
  of 45 degrees is @samp{sqrt(2)/2}; squaring this yields @samp{2/4 = 0.5}.
  However, there has been a slight roundoff error because the
! resentation of @samp{sqrt(2)/2} wasn't exact.  The @kbd{c 1}
  command is a handy way to clean up numbers in this case; it
  temporarily reduces the precision by one digit while it
  re-rounds the number on the top of the stack.
--- 1652,1658 ----
  The shift-@kbd{S} command computes the sine of an angle.  The sine
  of 45 degrees is @samp{sqrt(2)/2}; squaring this yields @samp{2/4 = 0.5}.
  However, there has been a slight roundoff error because the
! representation of @samp{sqrt(2)/2} wasn't exact.  The @kbd{c 1}
  command is a handy way to clean up numbers in this case; it
  temporarily reduces the precision by one digit while it
  re-rounds the number on the top of the stack.
***************
*** 1713,1719 ****
  @end group
  
  In the first case, we get an approximate floating-point result.
! In the second case, we get an exact fractional result.
  
  You can enter a fraction at any time using @kbd{:} notation.
  (Calc uses @kbd{:} instead of @kbd{/} as the fraction separator
--- 1716,1723 ----
  @end group
  
  In the first case, we get an approximate floating-point result.
! In the second case, we get an exact fractional result
! (four-thirds).
  
  You can enter a fraction at any time using @kbd{:} notation.
  (Calc uses @kbd{:} instead of @kbd{/} as the fraction separator
***************
*** 1794,1804 ****
  @end example
  @end group
  
! Since dividing-and-flooring is such a common operation, Calc
! provides a special command for that purpose, the backslash @kbd{\}.
! Another common arithmetic operator is @kbd{%}, which computes the
! remainder that would arise from a @kbd{\} operation, i.e., the
! ``modulo'' of two numbers.  For example,
  
  @group
  @example
--- 1798,1808 ----
  @end example
  @end group
  
! Since dividing-and-flooring (i.e., ``integer quotient'') is such a
! common operation, Calc provides a special command for that purpose, the
! backslash @kbd{\}.  Another common arithmetic operator is @kbd{%}, which
! computes the remainder that would arise from a @kbd{\} operation, i.e.,
! the ``modulo'' of two numbers.  For example,
  
  @group
  @example
***************
*** 2079,2085 ****
  
  Note that we can separate the vector elements with either commas or
  spaces.  This is true whether we are using incomplete vectors or
! algebraic entry.
  
  If you multiply two vectors, the result is the sum of the products
  of the elements taken pairwise.  This is called the @dfn{dot product}
--- 2083,2090 ----
  
  Note that we can separate the vector elements with either commas or
  spaces.  This is true whether we are using incomplete vectors or
! algebraic entry.  The @kbd{s 1} and @kbd{s 2} commands save these
! vectors so we can easily reuse them later.
  
  If you multiply two vectors, the result is the sum of the products
  of the elements taken pairwise.  This is called the @dfn{dot product}
***************
*** 2335,2341 ****
  @end example
  @end group
  
! Dividing by a square matrix is equivalent to multiplying by the
  inverse.
  
  Let's verify this solution:
--- 2340,2346 ----
  @end example
  @end group
  
! Dividing by a square matrix is equivalent to multiplying by its
  inverse.
  
  Let's verify this solution:
***************
*** 2369,2376 ****
  @end example
  @end group
  
! You can also build vectors out of consecutive integers, or many
! copies of a given value:
  
  @group
  @example
--- 2374,2381 ----
  @end example
  @end group
  
! You can also build vectors out of consecutive integers, or out
! of many copies of a given value:
  
  @group
  @example
***************
*** 2767,2777 ****
  
  @group
  @example
! 1:  8 +/- 0.2    2:  8 +/- 0.2    1:  0.266 +/- 0.011   1:  14.93 +/- 0.594
!     .            1:  30 +/- 1         .                     .
                       .
  
!     8 p .2           30 p 1           /                     I T
  @end example
  @end group
  
--- 2772,2782 ----
  
  @group
  @example
! 1:  8 +/- 0.2    2:  8 +/- 0.2   1:  0.266 +/- 0.011   1:  14.93 +/- 0.594
!     .            1:  30 +/- 1        .                     .
                       .
  
!     8 p .2           30 p 1          /                     I T
  @end example
  @end group
  
***************
*** 3177,3183 ****
  1:  [1, 2, ... ]    1:  [10, 11, ... ]    1:  [1, 1.1, ... ]
      .                   .                     .
  
!     v x 10 RET          9 +                   10 /
  @end example
  @end group
  
--- 3182,3188 ----
  1:  [1, 2, ... ]    1:  [10, 11, ... ]    1:  [1, 1.1, ... ]
      .                   .                     .
  
!     v x 10 RET          9 +                   0.1 *
  @end example
  @end group
  
***************
*** 3461,3467 ****
  
  @group
  @example
! 3:  []             1:  [0.10132, 0.03079, 0.02340, 0.33197, ...]
  2:  2                  .
  1:  30
      .
--- 3466,3472 ----
  
  @group
  @example
! 3:  []             1:  [0.10132, 0.03079, 0.02340, 0.033197, ...]
  2:  2                  .
  1:  30
      .
***************
*** 3508,3514 ****
  Let's edit in a new definition, for computing harmonic numbers.
  First, erase the three lines of the old definition.  Then, type
  in the new definition (or use Emacs @kbd{M-w} and @kbd{C-y} commands
! to copy it from the Info file).
  
  @example
  calc-kbd-push         # Save local values (Z `)
--- 3513,3519 ----
  Let's edit in a new definition, for computing harmonic numbers.
  First, erase the three lines of the old definition.  Then, type
  in the new definition (or use Emacs @kbd{M-w} and @kbd{C-y} commands
! to copy it from this page of the Info file).
  
  @example
  calc-kbd-push         # Save local values (Z `)
***************
*** 4288,4297 ****
  An @dfn{interval} is a subset of consecutive real numbers.  For example,
  the interval @samp{[2 .. 4]} represents all the numbers from 2 to 4,
  inclusive.  If you multiply it by the interval @samp{[0.5 .. 2]} you
! obtain @samp{[1 .. 6]}.  This calculation represents the fact that if
  you multiply some number in the range @samp{[2 .. 4]} by some other
  number in the range @samp{[0.5 .. 2]}, your result will lie in the range
! from 1 to 6.  Interval arithmetic is used to get a worst-case estimate
  of the possible range of values a computation will produce, given the
  set of possible values of the input.
  
--- 4293,4302 ----
  An @dfn{interval} is a subset of consecutive real numbers.  For example,
  the interval @samp{[2 .. 4]} represents all the numbers from 2 to 4,
  inclusive.  If you multiply it by the interval @samp{[0.5 .. 2]} you
! obtain @samp{[1 .. 8]}.  This calculation represents the fact that if
  you multiply some number in the range @samp{[2 .. 4]} by some other
  number in the range @samp{[0.5 .. 2]}, your result will lie in the range
! from 1 to 8.  Interval arithmetic is used to get a worst-case estimate
  of the possible range of values a computation will produce, given the
  set of possible values of the input.
  
***************
*** 5693,5699 ****
  The @kbd{\} (@code{calc-idiv}) command divides two numbers on the stack
  to produce an integer result.  It is equivalent to dividing with
  @key{/}, then rounding down with @kbd{F} (@code{calc-floor}), only a bit
! more convenient and efficient.
  
  @kindex :
  @pindex calc-fdiv
--- 5698,5706 ----
  The @kbd{\} (@code{calc-idiv}) command divides two numbers on the stack
  to produce an integer result.  It is equivalent to dividing with
  @key{/}, then rounding down with @kbd{F} (@code{calc-floor}), only a bit
! more convenient and efficient.  Also, since it is an all-integer
! operation when the arguments are integers, it avoids problems that
! @kbd{/ F} would have with floating-point roundoff.
  
  @kindex :
  @pindex calc-fdiv
***************
*** 5730,5736 ****
  The @code{calc-abssqr} [@code{abssqr}] command computes the absolute
  value squared of a number, vector or matrix, or error form.
  
- @pindex calc-sign
  @tindex sign
  The @code{sign} algebraic function returns 1 if its argument is positive,
  -1 if its argument is negative, or 0 if its argument is zero.
--- 5737,5742 ----
***************
*** 5766,5771 ****
--- 5772,5801 ----
  take any number of arguments and return the maximum or minimum among all
  the arguments.)@refill
  
+ @pindex calc-mant-part
+ @tindex mant
+ @pindex calc-xpon-part
+ @tindex xpon
+ The @code{calc-mant-part} [@code{mant}] function extracts the ``mantissa''
+ part @var{m} of its floating-point argument; @code{calc-xpon-part}
+ [@code{xpon}] extracts the ``exponent'' part @var{e}.  The original
+ number is equal to @samp{@var{m} * 10^@var{e}}, where @var{m} is in
+ the interval @samp{[1.0 .. 10.0)} except that @samp{@var{m}=@var{e}=0}
+ if the original number is zero.  For integers and fractions,
+ @code{mant} returns the number unchanged and @code{xpon} returns zero.
+ The @kbd{v u} (@code{calc-unpack}) command can also be used to ``unpack''
+ a floating-point number; this produces an integer mantissa and exponent,
+ with the constraint that the mantissa is either zero or a non-multiple
+ of ten.@refill
+ 
+ @pindex calc-scale-float
+ @tindex scf
+ The @code{calc-scale-float} [@code{scf}] function scales a number by
+ a given power of ten.  Thus, @samp{scf(mant(x), xpon(x)) = x} for any
+ real @var{x}.  The second argument must be an integer, but the first
+ may actually be any numeric value.  For example, @samp{scf(5,-2) = 0.05}
+ or @samp{1:20} depending on the current Fraction Mode.@refill
+ 
  @node Integer Truncation, Complex Number Functions, Basic Arithmetic, Arithmetic
  @section Integer Truncation
  
***************
*** 6491,6512 ****
  number right by one bit, or by the number of bits specified in the numeric
  prefix argument:  @samp{rsh(a,n) = lsh(a,-n)}.
  
! @kindex b s
! @pindex calc-shift-binary
  @tindex ash
! The @kbd{b s} (@code{calc-shift-binary}) [@code{ash}] command shifts a
! number left in the same way as @code{lsh}.  However, if shifting right,
! it performs an ``arithmetic'' shift, in which the leftmost bit (according
! to the current word size) is duplicated rather than shifting in zeros.
! This corresponds to dividing by two where the input is interpreted as a
! signed, twos-complement number.  (The distinction between the @samp{lsh}
! and @samp{ash} operations is totally independent from whether the word
! size is positive or negative.)
  
  @kindex b R
  @pindex calc-rotate-binary
  @tindex rot
! The @kbd{b R} (@code{calc-rotate-binary}) [@code{rot}] command rotates a
  number one bit to the left.  The leftmost bit (according to the current
  word size) is dropped off the left and shifted in on the right.  With a
  numeric prefix argument, the number is rotated the specified number of
--- 6521,6550 ----
  number right by one bit, or by the number of bits specified in the numeric
  prefix argument:  @samp{rsh(a,n) = lsh(a,-n)}.
  
! @kindex b L
! @pindex calc-lshift-arith
  @tindex ash
! The @kbd{b L} (@code{calc-lshift-arith}) [@code{ash}] command shifts a
! number left.  It is analogous to @code{lsh}, except that if the shift
! is rightward (the prefix argument is negative), an arithmetic shift
! is performed as described below.
  
  @kindex b R
+ @pindex calc-rshift-arith
+ @tindex rash
+ The @kbd{b R} (@code{calc-rshift-arith}) [@code{rash}] command performs
+ an ``arithmetic'' shift to the right, in which the leftmost bit (according
+ to the current word size) is duplicated rather than shifting in zeros.
+ This corresponds to dividing by a power of two where the input is interpreted
+ as a signed, twos-complement number.  (The distinction between the @samp{rsh}
+ and @samp{rash} operations is totally independent from whether the word
+ size is positive or negative.)  With a negative prefix argument, this
+ performs a standard left shift.
+ 
+ @kindex b t
  @pindex calc-rotate-binary
  @tindex rot
! The @kbd{b t} (@code{calc-rotate-binary}) [@code{rot}] command rotates a
  number one bit to the left.  The leftmost bit (according to the current
  word size) is dropped off the left and shifted in on the right.  With a
  numeric prefix argument, the number is rotated the specified number of
***************
*** 7195,7206 ****
  
  The @code{calc-substitute} command normally prompts for two formulas,
  the old one and the new one.  If you enter a blank line for the first
! prompt, all three arguments are taken from the stack (old, then new,
  then target expression).  If you type an old formula but then enter a
  blank line for the new one, the new formula is taken from top-of-stack
  and the target from second-to-top.  If you answer both prompts, the
  target is taken from top-of-stack as usual.
  
  @node Rewrite Rules, Logical Operations, Algebraic Manipulation, Algebra
  @section Rewrite Rules
  
--- 7233,7252 ----
  
  The @code{calc-substitute} command normally prompts for two formulas,
  the old one and the new one.  If you enter a blank line for the first
! prompt, all three arguments are taken from the stack (new, then old,
  then target expression).  If you type an old formula but then enter a
  blank line for the new one, the new formula is taken from top-of-stack
  and the target from second-to-top.  If you answer both prompts, the
  target is taken from top-of-stack as usual.
  
+ Note that @code{calc-substitute} has no understanding of commutativity
+ or associativity.  The pattern @samp{x+y} will not match the formula
+ @samp{y+x}.  Also, @samp{y+z} will not match inside the formula @samp{x+y+z}
+ because the @samp{+} operator is left-associative, so the ``deep
+ structure'' of that formula is @samp{(x+y) + z}.  Use @kbd{d U}
+ (@code{calc-unformatted-language}) mode to see the true structure of
+ a formula.
+ 
  @node Rewrite Rules, Logical Operations, Algebraic Manipulation, Algebra
  @section Rewrite Rules
  
***************
*** 7254,7260 ****
  Pattern-matching is completely structural, not taking the algebraic
  properties of formulas into account.  Thus @samp{f(x+1)} matches
  the formula @samp{f(a+1)} but not @samp{f(a)}, @samp{f(a+2)}, or
! @samp{f(1+a)}.@refill
  
  If the @samp{old} pattern is found to match a given formula, that
  formula is replaced by @samp{new}, where any occurrences in @samp{new}
--- 7300,7307 ----
  Pattern-matching is completely structural, not taking the algebraic
  properties of formulas into account.  Thus @samp{f(x+1)} matches
  the formula @samp{f(a+1)} but not @samp{f(a)}, @samp{f(a+2)}, or
! @samp{f(1+a)}.  For other examples @pxref{Algebraic Manipulation},
! under the discussion of @code{calc-substitute}.@refill
  
  If the @samp{old} pattern is found to match a given formula, that
  formula is replaced by @samp{new}, where any occurrences in @samp{new}
***************
*** 8771,8777 ****
  @example
  (defmath myfact (n)
    (if (> n 0)
!       (* (myfact (1- n)))
      (if (= n 0)
          1
        nil)))    ; this could be simplified as: (and (= n 0) 1)
--- 8818,8824 ----
  @example
  (defmath myfact (n)
    (if (> n 0)
!       (* n (myfact (1- n)))
      (if (= n 0)
          1
        nil)))    ; this could be simplified as: (and (= n 0) 1)
***************
*** 9023,9029 ****
    "Compute the factorial of the integer at the top of the stack."
    (interactive 1 "fact")
    (if (> n 0)
!       (* (myfact (1- n)))
      (and (= n 0) 1)))
  @end example
  
--- 9070,9076 ----
    "Compute the factorial of the integer at the top of the stack."
    (interactive 1 "fact")
    (if (> n 0)
!       (* n (myfact (1- n)))
      (and (= n 0) 1)))
  @end example
  
***************
*** 10900,10906 ****
  @node Installation, Reporting Bugs, Programming, Top
  @chapter Installation
  
! Calc comes as a pair of Emacs Lisp files, generally called
  @file{calc.el} and @file{calc-ext.el}.  The first contains the basic
  foundations of the Calculator, and is as small as possible to promote
  quick loading.  The second contains all the more advanced commands and
--- 10947,10953 ----
  @node Installation, Reporting Bugs, Programming, Top
  @chapter Installation
  
! Calc 1.04 comes as a pair of Emacs Lisp files, generally called
  @file{calc.el} and @file{calc-ext.el}.  The first contains the basic
  foundations of the Calculator, and is as small as possible to promote
  quick loading.  The second contains all the more advanced commands and
***************
*** 10908,10913 ****
--- 10955,10962 ----
  @kbd{M-#} command auto-loads only the first part, and the second part is
  auto-loaded whenever the first advanced feature is used.@refill
  
+ @section Compilation
+ 
  Calc is written in a way that maximizes performance when its code has been
  byte-compiled; a side effect is that performance is seriously degraded if
  it @emph{isn't} compiled.  Thus, it is essential to compile the Calculator
***************
*** 10918,10926 ****
  calc.elc} before compiling @file{calc-ext.el} will work.
  
  For your convenience, the FTP distribution of Calc, obtainable from
! anonymous FTP on @samp{csvax.caltech.edu}, includes already-compiled
  versions of both of these files.
  
  To teach Emacs how to load in Calc when you type @kbd{M-x calc} for the
  first time, include these lines in your @file{.emacs} file (if you are
  installing Calc just for your own use), or the system's @file{lisp/default}
--- 10967,10977 ----
  calc.elc} before compiling @file{calc-ext.el} will work.
  
  For your convenience, the FTP distribution of Calc, obtainable from
! anonymous FTP on @samp{csvax.cs.caltech.edu}, includes already-compiled
  versions of both of these files.
  
+ @section Auto-loading
+ 
  To teach Emacs how to load in Calc when you type @kbd{M-x calc} for the
  first time, include these lines in your @file{.emacs} file (if you are
  installing Calc just for your own use), or the system's @file{lisp/default}
***************
*** 10950,10962 ****
  reasonably be used before the user has typed @kbd{M-x calc} for the
  first time.
  
  If you don't want to bother with a split Calculator, you can simply
  concatenate @code{calc-ext.elc} onto the end of @code{calc.elc}, rewrite
  the above @code{autoload} commands all to point to the combined file,
  and treat Calc as one big program.  You may need to do this if
! @code{autoload} is giving you problems.
  
! You may also wish to bind the @code{calc} command to a key.  The
  recommended keystroke is @kbd{M-#} (i.e., Meta-Shift-3).  To set up
  this key binding, include this command in your @file{.emacs} or
  @file{lisp/default} file:
--- 11001,11058 ----
  reasonably be used before the user has typed @kbd{M-x calc} for the
  first time.
  
+ @section Merging @file{calc} and @file{calc-ext}
+ 
  If you don't want to bother with a split Calculator, you can simply
  concatenate @code{calc-ext.elc} onto the end of @code{calc.elc}, rewrite
  the above @code{autoload} commands all to point to the combined file,
  and treat Calc as one big program.  You may need to do this if
! the @code{autoload} mechanism is giving you problems.
! 
! @section Splitting @file{calc-ext}
! 
! On the other hand, you may find that @file{calc-ext.el} is too big to load
! quickly.  You can split the Calculator into still more parts using the
! @code{calc-split} command.  This command splits the file
! @file{calc-ext.el} into about 20 small files with names like
! @file{calc-cplx.el} and @file{calc-mode.el} in the same directory
! as @file{calc-ext.el}.  First, load the file @file{calc-ext.el} with
! @kbd{C-x C-f}.  Move to the end of the buffer and type @kbd{C-x C-e}
! at the indicated position.  Now type @kbd{M-x calc-split}.
! This moves most of the text out of @file{calc-ext.el} and into
! other files.  All necessary @code{autoload} commands are inserted
! into @file{calc-ext.el}.@refill
! 
! The @code{calc-split} command prompts for a directory name; the new
! files are placed in this directory, and the @code{autoload} commands are
! written to refer to the directory explicitly.  If you wish you can
! backspace over the default directory name and enter a blank name, in
! which case the @code{autoload} commands will be written without
! directory names on the assumption that Emacs can find the Calc files in
! one of the default places.  Some people prefer to put the Calc files in
! a subdirectory by themselves.@refill
! 
! The @code{calc-split} command also offers to byte-compile all Calc files
! automatically.  Note that @file{calc.el} must have been byte-compiled
! and loaded already, just as if you were compiling @file{calc-ext} whole.
! If you choose to compile by hand, you will need to compile @file{calc.el}
! first, load it, compile the new @file{calc-ext.el} and load it, then
! compile each of the new component files.  Also, note that the
! @code{autoload} commands shown above are still correct for use in
! your startup file.@refill
! 
! If you do decide to use @code{calc-split}, note that when patches
! are made available for new versions of Calc, they will refer to
! the old, unsplit version of the file @file{calc-ext.el}.  The
! @code{calc-split} command makes a copy of this under the name
! @file{calc-old.el}; be sure to keep it around so you can rename
! it back to @file{calc-ext.el} before installing new patches.
! You can then use @code{calc-split} again to re-split your updated
! version of Calc.@refill
! 
! @section Key Bindings
  
! You may wish to bind the @code{calc} command to a key.  The
  recommended keystroke is @kbd{M-#} (i.e., Meta-Shift-3).  To set up
  this key binding, include this command in your @file{.emacs} or
  @file{lisp/default} file:
***************
*** 10968,10973 ****
--- 11064,11071 ----
  There are no standard key assignments for @code{quick-calc} and
  @code{calc-grab-region}, but you may wish to define some.
  
+ @section The @file{macedit} Package
+ 
  The file @file{macedit.el} contains another useful Emacs extension
  called @code{edit-kbd-macro}.  It allows you to edit a keyboard macro
  in human-readable form.  The @kbd{Z E} command in Calc knows how to
***************
*** 10979,10984 ****
--- 11077,11084 ----
  (autoload 'edit-last-kbd-macro ".../macedit.elc" "Edit Keyboard Macro" t nil)
  @end example
  
+ @section Documentation
+ 
  The documentation for Calc (i.e., this manual) comes in a file
  @file{calc.texinfo}.  To format this for use as an on-line manual,
  open this file for editing in Emacs and give the command
***************
*** 11002,11007 ****
--- 11102,11109 ----
  in your @file{.emacs} or @file{lisp/default} file, where again @file{...}
  represents the directory containing the Info files.
  
+ @section Settings File
+ 
  @vindex calc-settings-file
  Another variable you might want to set is @code{calc-settings-file},
  which holds the file name in which commands like @kbd{m m} and @kbd{Z P}
***************
*** 11012,11017 ****
--- 11114,11121 ----
  automatically load your settings file (if it exists) the first time
  Calc is invoked.@refill
  
+ @section Testing the Installation
+ 
  To test your installation of Calc, start a fresh Emacs and type @kbd{M-#}
  to make sure the autoload commands and key bindings work.  Now, type
  @kbd{i} to make sure Calc can find its Info documentation.  Press @kbd{q}
***************
*** 11027,11033 ****
  @chapter Reporting Bugs
  
  If you find a bug in Calc, send e-mail to Dave Gillespie,
! @samp{daveg@@csvax.caltech.edu}.  While I cannot guarantee that I
  will have time to work on your bug, I do try to fix bugs quickly
  whenever I can.
  
--- 11131,11137 ----
  @chapter Reporting Bugs
  
  If you find a bug in Calc, send e-mail to Dave Gillespie,
! @samp{daveg@@csvax.cs.caltech.edu}.  While I cannot guarantee that I
  will have time to work on your bug, I do try to fix bugs quickly
  whenever I can.
  
--
Dave Gillespie
  256-80 Caltech Pasadena CA USA 91125
  daveg@csvax.cs.caltech.edu, ...!cit-vax!daveg