Merge changes from emacs-23 branch.
[bpt/emacs.git] / lisp / calc / calc-misc.el
index b660e04..890e624 100644 (file)
@@ -1,17 +1,17 @@
 ;;; calc-misc.el --- miscellaneous functions for Calc
 
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 (require 'calc)
 (require 'calc-macs)
 
+;; Declare functions which are defined elsewhere.
+(declare-function calc-do-keypad "calc-keypd" (&optional full-display interactive))
+(declare-function calc-inv-hyp-prefix-help "calc-help" ())
+(declare-function calc-inverse-prefix-help "calc-help" ())
+(declare-function calc-hyperbolic-prefix-help "calc-help" ())
+(declare-function calc-option-prefix-help "calc-help" ())
+(declare-function calc-explain-why "calc-stuff" (why &optional more))
+(declare-function calc-clear-command-flag "calc-ext" (f))
+(declare-function calc-roll-down-with-selections "calc-sel" (n m))
+(declare-function calc-roll-up-with-selections "calc-sel" (n m))
+(declare-function calc-last-args "calc-undo" (n))
+(declare-function calc-is-inverse "calc-ext" ())
+(declare-function calc-do-prefix-help "calc-ext" (msgs group key))
+(declare-function math-objvecp "calc-ext" (a))
+(declare-function math-known-scalarp "calc-arith" (a &optional assume-scalar))
+(declare-function math-vectorp "calc-ext" (a))
+(declare-function math-matrixp "calc-ext" (a))
+(declare-function math-trunc-special "calc-arith" (a prec))
+(declare-function math-trunc-fancy "calc-arith" (a))
+(declare-function math-floor-special "calc-arith" (a prec))
+(declare-function math-floor-fancy "calc-arith" (a))
+(declare-function math-square-matrixp "calc-ext" (a))
+(declare-function math-matrix-inv-raw "calc-mtx" (m))
+(declare-function math-known-matrixp "calc-arith" (a))
+(declare-function math-mod-fancy "calc-arith" (a b))
+(declare-function math-pow-of-zero "calc-arith" (a b))
+(declare-function math-pow-zero "calc-arith" (a b))
+(declare-function math-pow-fancy "calc-arith" (a b))
+(declare-function calc-locate-cursor-element "calc-yank" (pt))
+
+;;;###autoload
 (defun calc-dispatch-help (arg)
   "C-x* is a prefix key sequence; follow it with one of these letters:
 
@@ -102,6 +131,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
       (calc-do-dispatch arg))))
 
 
+;;;###autoload
 (defun calc-big-or-small (arg)
   "Toggle Calc between full-screen and regular mode."
   (interactive "P")
@@ -111,8 +141,8 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
     (if cwin
        (setq calc-full-mode
              (if kwin
-                 (and twin (eq (window-width twin) (frame-width)))
-               (eq (window-height cwin) (1- (frame-height))))))
+                 (and twin (window-full-width-p twin))
+               (window-full-height-p cwin))))
     (setq calc-full-mode (if arg
                             (> (prefix-numeric-value arg) 0)
                           (not calc-full-mode)))
@@ -128,6 +158,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
                 "Now using full screen for Calc"
               "Now using partial screen for Calc"))))
 
+;;;###autoload
 (defun calc-other-window (&optional interactive)
   "Invoke the Calculator in another window."
   (interactive "p")
@@ -141,6 +172,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
       (let ((win (selected-window)))
        (calc nil win interactive)))))
 
+;;;###autoload
 (defun another-calc ()
   "Create another, independent Calculator buffer."
   (interactive)
@@ -152,18 +184,21 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
   (pop-to-buffer (current-buffer))
   (calc-mode))
 
+;;;###autoload
 (defun calc-info ()
   "Run the Emacs Info system on the Calculator documentation."
   (interactive)
   (select-window (get-largest-window))
   (info "Calc"))
 
+;;;###autoload
 (defun calc-info-goto-node (node)
   "Go to a node in the Calculator info documentation."
   (interactive)
   (select-window (get-largest-window))
   (info (concat "(Calc)" node)))
 
+;;;###autoload
 (defun calc-tutorial ()
   "Run the Emacs Info system on the Calculator Tutorial."
   (interactive)
@@ -173,17 +208,19 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
   (calc-other-window)
   (message "Welcome to the Calc Tutorial!"))
 
+;;;###autoload
 (defun calc-info-summary ()
   "Run the Emacs Info system on the Calculator Summary."
   (interactive)
   (calc-info-goto-node "Summary"))
 
+;;;###autoload
 (defun calc-help ()
   (interactive)
-  (let ((msgs (append
+  (let ((msgs
         '("Press `h' for complete help; press `?' repeatedly for a summary"
           "Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit"
-          "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic"
+          "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic, Option"
           "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
           "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
           "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro"
@@ -199,10 +236,8 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
           "Prefix keys: Kombinatorics/statistics, Modes, Store/recall"
           "Prefix keys: Trail/time, Units/statistics, Vector/matrix"
           "Prefix keys: Z (user), SHIFT + Z (define)"
-          "Prefix keys: prefix + ? gives further help for that prefix")
-        (list (format
-               "  Calc %s by Dave Gillespie, daveg@synaptics.com"
-               calc-version)))))
+          "Prefix keys: prefix + ? gives further help for that prefix"
+           "  Calc by Dave Gillespie, daveg@synaptics.com")))
     (if calc-full-help-flag
        msgs
       (if (or calc-inverse-flag calc-hyperbolic-flag)
@@ -211,20 +246,22 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
                  (calc-inv-hyp-prefix-help)
                (calc-inverse-prefix-help))
            (calc-hyperbolic-prefix-help))
-       (setq calc-help-phase
-             (if (eq this-command last-command)
-                 (% (1+ calc-help-phase) (1+ (length msgs)))
-               0))
-       (let ((msg (nth calc-help-phase msgs)))
-         (message "%s" (if msg
-                           (concat msg ":"
-                                   (make-string (- (apply 'max
-                                                          (mapcar 'length
-                                                                  msgs))
-                                                   (length msg)) 32)
-                                   "  [?=MORE]")
-                         "")))))))
-
+        (if calc-option-flag
+            (calc-option-prefix-help)
+          (setq calc-help-phase
+                (if (eq this-command last-command)
+                    (% (1+ calc-help-phase) (1+ (length msgs)))
+                  0))
+          (let ((msg (nth calc-help-phase msgs)))
+            (message "%s" (if msg
+                              (concat msg ":"
+                                      (make-string (- (apply 'max
+                                                             (mapcar 'length
+                                                                     msgs))
+                                                      (length msg)) 32)
+                                      "  [?=MORE]")
+                            ""))))))))
+  
 
 
 
@@ -234,6 +271,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
 ;; and used in calc-why (in calc-stuff.el).
 (defvar calc-last-why-command)
 
+;;;###autoload
 (defun calc-do-handle-whys ()
   (setq calc-why (sort calc-next-why
                       (function
@@ -253,6 +291,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
        (setq calc-last-why-command this-command)
        (calc-clear-command-flag 'clear-message))))
 
+;;;###autoload
 (defun calc-record-why (&rest stuff)
   (if (eq (car stuff) 'quiet)
       (setq stuff (cdr stuff))
@@ -270,7 +309,8 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
   (setq calc-next-why (cons stuff calc-next-why))
   nil)
 
-;;; True if A is a constant or vector of constants.  [P x] [Public]
+;; True if A is a constant or vector of constants.  [P x] [Public]
+;;;###autoload
 (defun math-constp (a)
   (or (Math-scalarp a)
       (and (memq (car a) '(sdev intv mod vec))
@@ -281,6 +321,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
             (null a)))))
 
 
+;;;###autoload
 (defun calc-roll-down-stack (n &optional m)
   (if (< n 0)
       (calc-roll-up-stack (- n) m)
@@ -295,6 +336,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
                               (append (calc-top-list m 1)
                                       (calc-top-list (- n m) (1+ m))))))))
 
+;;;###autoload
 (defun calc-roll-up-stack (n &optional m)
   (if (< n 0)
       (calc-roll-down-stack (- n) m)
@@ -310,6 +352,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
                                       (calc-top-list m (- n m -1))))))))
 
 
+;;;###autoload
 (defun calc-do-refresh ()
   (if calc-hyperbolic-flag
       (progn
@@ -319,6 +362,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
     t))
 
 
+;;;###autoload
 (defun calc-record-list (vals &optional prefix)
   (while vals
     (or (eq (car vals) 'top-of-stack)
@@ -328,12 +372,14 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
     (setq vals (cdr vals))))
 
 
+;;;###autoload
 (defun calc-last-args-stub (arg)
   (interactive "p")
   (require 'calc-ext)
   (calc-last-args arg))
 
 
+;;;###autoload
 (defun calc-power (arg)
   (interactive "P")
   (calc-slow-wrapper
@@ -342,16 +388,19 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
        (calc-binary-op "root" 'calcFunc-nroot arg nil nil)
      (calc-binary-op "^" 'calcFunc-pow arg nil nil '^))))
 
+;;;###autoload
 (defun calc-mod (arg)
   (interactive "P")
   (calc-slow-wrapper
    (calc-binary-op "%" 'calcFunc-mod arg nil nil '%)))
 
+;;;###autoload
 (defun calc-inv (arg)
   (interactive "P")
   (calc-slow-wrapper
    (calc-unary-op "inv" 'calcFunc-inv arg)))
 
+;;;###autoload
 (defun calc-percent ()
   (interactive)
   (calc-slow-wrapper
@@ -359,6 +408,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
     1 "%" (list (list 'calcFunc-percent (calc-top-n 1))))))
 
 
+;;;###autoload
 (defun calc-over (n)
   (interactive "P")
   (if n
@@ -366,12 +416,14 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
     (calc-enter -2)))
 
 
+;;;###autoload
 (defun calc-pop-above (n)
   (interactive "P")
   (if n
       (calc-pop (- (prefix-numeric-value n)))
     (calc-pop -2)))
 
+;;;###autoload
 (defun calc-roll-down (n)
   (interactive "P")
   (calc-wrapper
@@ -387,6 +439,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
           (t
            (calc-roll-down-stack (calc-stack-size) (- nn)))))))
 
+;;;###autoload
 (defun calc-roll-up (n)
   (interactive "P")
   (calc-wrapper
@@ -402,11 +455,125 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
           (t
            (calc-roll-up-stack (calc-stack-size) (- nn)))))))
 
+;;;###autoload
+(defun calc-transpose-lines (&optional arg)
+  "Transpose previous line and current line.
+With argument ARG, move previous line past ARG lines.
+With argument 0, switch line point is in with line mark is in."
+  (interactive "p")
+  (setq arg (or arg 1))
+  (let (bot-line mid-line end-line
+                 old-top-list new-top-list
+                 bot-cell mid-cell
+                 prev-mid-cell post-mid-cell post-bot-cell)
+    (calc-wrapper
+     (when (eq major-mode 'calc-mode)
+       (cond
+        ;; exchange point and mark
+        ((= 0 arg)
+         (setq bot-line  (calc-locate-cursor-element (point))
+               mid-line  (mark))
+         (if mid-line
+             (setq mid-line  (calc-locate-cursor-element mid-line)
+                   end-line  (1+ mid-line))
+           (error "No mark set"))
+         (if (< bot-line mid-line)
+             (let ((temp mid-line))
+               (setq mid-line bot-line
+                     bot-line temp))))
+        ;; move bot-line to mid-line that is above bot-line on stack (that is
+        ;; to say mid-line displayed below bot-line in *Calculator* buffer)
+        ((> arg 0)
+         (setq bot-line (1+ (calc-locate-cursor-element (point)))
+               mid-line (- bot-line arg)
+               end-line mid-line))
+        ;; move bot-line to mid-line that is above bot-line on stack (that is
+        ;; to say mid-line displayed below bot-line in *Calculator* buffer)
+        ((< arg 0)
+         (setq mid-line (1+ (calc-locate-cursor-element (point)))
+               bot-line (- mid-line arg)
+               end-line bot-line)))
+       (calc-check-stack bot-line)
+       (if (= 0 mid-line)
+           (error "Can't transpose beyond top"))
+       (setq old-top-list (nreverse (calc-top-list bot-line)))
+       ;; example: (arg = 2)
+       ;; old-top-list =
+       ;; 1 <-- top of stack (bottom of *Calculator* buffer)
+       ;; 2
+       ;; 3 <-- mid-line = 3
+       ;; 4 <-- point
+       ;; 5 <-- bot-line = 5
+       (dotimes (i mid-line)
+         (setq mid-cell old-top-list
+               old-top-list (cdr old-top-list))
+         (setcdr mid-cell new-top-list)
+         (setq new-top-list  mid-cell))
+       ;; example follow-up:
+       ;; old-top-list =
+       ;; 4
+       ;; 5
+       ;; new-top-list =
+       ;; 3 <-- mid-cell
+       ;; 2
+       ;; 1
+       (setq  prev-mid-cell old-top-list)
+       (dotimes (i (- bot-line mid-line))
+         (setq bot-cell old-top-list
+               old-top-list (cdr old-top-list))
+         (setcdr bot-cell new-top-list)
+         (setq new-top-list  bot-cell))
+       (setq post-mid-cell (cdr mid-cell)
+             post-bot-cell  (cdr bot-cell))
+       ;; example follow-up:
+       ;; new-top-list =
+       ;; 5 <-- bot-cell
+       ;; 4 <-- prev-mid-cell & post-bot-cell
+       ;; 3 <-- mid-cell
+       ;; 2 <-- post-mid-cell
+       ;; 1
+       (cond
+        ((= 0 arg); swap bot and mid
+         (setcdr mid-cell            post-bot-cell)
+         (setcdr bot-cell            post-mid-cell)
+         (setcdr prev-mid-cell       bot-cell)
+         ;; example follow-up:
+         ;; 3 <-- mid-cell
+         ;; 4 <-- post-bot-cell & prev-mid-cell
+         ;; 5 <-- bot-cell
+         ;; 2 <-- post-mid-cell
+         ;; 1
+         (setq new-top-list mid-cell))
+        ((< 0 arg) ; move bot just after mid
+         (setcdr mid-cell       bot-cell)
+         (setcdr bot-cell       post-mid-cell)
+         ;; example follow-up:
+         ;; new-top-list =
+         ;; 4 <-- post-bot-cell
+         ;; 3 <-- mid-cell
+         ;; 5 <-- bot-cell
+         ;; 2 <-- post-mid-cell
+         ;; 1
+         (setq new-top-list post-bot-cell))
+        ((> 0 arg) ; move mid just before bot
+         (setcdr mid-cell       bot-cell)
+         (setcdr prev-mid-cell  post-mid-cell)
+         ;; example follow-up:
+         ;; new-top-list =
+         ;; 3 <-- mid-cell
+         ;; 5 <-- bot-cell
+         ;; 4 <-- prev-mid-cell
+         ;; 2 <-- post-mid-cell
+         ;; 1
+         (setq new-top-list mid-cell)))
+       (calc-pop-push-list bot-line new-top-list)))
+    (calc-cursor-stack-index (1- end-line))))
 
 
 
 ;;; Other commands.
 
+;;;###autoload
 (defun calc-num-prefix-name (n)
   (cond ((eq n '-) "- ")
        ((equal n '(4)) "C-u ")
@@ -414,17 +581,19 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
        ((integerp n) (format "%d " n))
        (t "")))
 
+;;;###autoload
 (defun calc-missing-key (n)
   "This is a placeholder for a command which needs to be loaded from calc-ext.
 When this key is used, calc-ext (the Calculator extensions module) will be
 loaded and the keystroke automatically re-typed."
   (interactive "P")
   (require 'calc-ext)
-  (if (keymapp (key-binding (char-to-string last-command-char)))
-      (message "%s%c-" (calc-num-prefix-name n) last-command-char))
+  (if (keymapp (key-binding (char-to-string last-command-event)))
+      (message "%s%c-" (calc-num-prefix-name n) last-command-event))
   (calc-unread-command)
   (setq prefix-arg n))
 
+;;;###autoload
 (defun calc-shift-Y-prefix-help ()
   (interactive)
   (require 'calc-ext)
@@ -433,16 +602,18 @@ loaded and the keystroke automatically re-typed."
 
 
 
+;;;###autoload
 (defun calcDigit-letter ()
   (interactive)
   (if (calc-minibuffer-contains "[-+]?\\(1[1-9]\\|[2-9][0-9]\\)#.*")
       (progn
-       (setq last-command-char (upcase last-command-char))
+       (setq last-command-event (upcase last-command-event))
        (calcDigit-key))
     (calcDigit-nondigit)))
 
 
 ;; A Lisp version of temp_minibuffer_message from minibuf.c.
+;;;###autoload
 (defun calc-temp-minibuffer-message (m)
   (let ((savemax (point-max)))
     (save-excursion
@@ -462,7 +633,8 @@ loaded and the keystroke automatically re-typed."
 (put 'math-with-extra-prec 'lisp-indent-hook 1)
 
 
-;;; Concatenate two vectors, or a vector and an object.  [V O O] [Public]
+;; Concatenate two vectors, or a vector and an object.  [V O O] [Public]
+;;;###autoload
 (defun math-concat (v1 v2)
   (if (stringp v1)
       (concat v1 v2)
@@ -482,7 +654,8 @@ loaded and the keystroke automatically re-typed."
       (list '| v1 v2))))
 
 
-;;; True if A is zero.  Works for un-normalized values.  [P n] [Public]
+;; True if A is zero.  Works for un-normalized values.  [P n] [Public]
+;;;###autoload
 (defun math-zerop (a)
   (if (consp a)
       (cond ((memq (car a) '(bigpos bigneg))
@@ -499,8 +672,9 @@ loaded and the keystroke automatically re-typed."
     (eq a 0)))
 
 
-;;; True if A is real and negative.  [P n] [Public]
+;; True if A is real and negative.  [P n] [Public]
 
+;;;###autoload
 (defun math-negp (a)
   (if (consp a)
       (cond ((eq (car a) 'bigpos) nil)
@@ -522,7 +696,8 @@ loaded and the keystroke automatically re-typed."
            ((equal a '(neg (var inf var-inf))) t))
     (< a 0)))
 
-;;; True if A is a negative number or an expression the starts with '-'.
+;; True if A is a negative number or an expression the starts with '-'.
+;;;###autoload
 (defun math-looks-negp (a)   ; [P x] [Public]
   (or (Math-negp a)
       (eq (car-safe a) 'neg)
@@ -533,7 +708,8 @@ loaded and the keystroke automatically re-typed."
           (math-looks-negp (nth 1 a)))))
 
 
-;;; True if A is real and positive.  [P n] [Public]
+;; True if A is real and positive.  [P n] [Public]
+;;;###autoload
 (defun math-posp (a)
   (if (consp a)
       (cond ((eq (car a) 'bigpos) (cdr a))
@@ -557,19 +733,23 @@ loaded and the keystroke automatically re-typed."
            ((equal a '(var inf var-inf)) t))
     (> a 0)))
 
+;;;###autoload
 (defalias 'math-fixnump 'integerp)
+;;;###autoload
 (defalias 'math-fixnatnump 'natnump)
 
 
-;;; True if A is an even integer.  [P R R] [Public]
+;; True if A is an even integer.  [P R R] [Public]
+;;;###autoload
 (defun math-evenp (a)
   (if (consp a)
       (and (memq (car a) '(bigpos bigneg))
           (= (% (nth 1 a) 2) 0))
     (= (% a 2) 0)))
 
-;;; Compute A / 2, for small or big integer A.  [I i]
-;;; If A is negative, type of truncation is undefined.
+;; Compute A / 2, for small or big integer A.  [I i]
+;; If A is negative, type of truncation is undefined.
+;;;###autoload
 (defun math-div2 (a)
   (if (consp a)
       (if (cdr a)
@@ -577,6 +757,7 @@ loaded and the keystroke automatically re-typed."
        0)
     (/ a 2)))
 
+;;;###autoload
 (defun math-div2-bignum (a)   ; [l l]
   (if (cdr a)
       (cons (+ (/ (car a) 2) (* (% (nth 1 a) 2) (/ math-bignum-digit-size 2)))
@@ -584,7 +765,8 @@ loaded and the keystroke automatically re-typed."
     (list (/ (car a) 2))))
 
 
-;;; Reject an argument to a calculator function.  [Public]
+;; Reject an argument to a calculator function.  [Public]
+;;;###autoload
 (defun math-reject-arg (&optional a p option)
   (if option
       (calc-record-why option p a)
@@ -593,11 +775,12 @@ loaded and the keystroke automatically re-typed."
   (signal 'wrong-type-argument (and a (if p (list p a) (list a)))))
 
 
-;;; Coerce A to be an integer (by truncation toward zero).  [I N] [Public]
+;; Coerce A to be an integer (by truncation toward zero).  [I N] [Public]
 
 ;; The variable math-trunc-prec is local to math-trunc, but used by
 ;; math-trunc-fancy in calc-arith.el, which is called by math-trunc.
 
+;;;###autoload
 (defun math-trunc (a &optional math-trunc-prec)
   (cond (math-trunc-prec
         (require 'calc-ext)
@@ -609,13 +792,15 @@ loaded and the keystroke automatically re-typed."
         (math-scale-int (nth 1 a) (nth 2 a)))
        (t (require 'calc-ext)
           (math-trunc-fancy a))))
+;;;###autoload
 (defalias 'calcFunc-trunc 'math-trunc)
 
-;;; Coerce A to be an integer (by truncation toward minus infinity).  [I N]
+;; Coerce A to be an integer (by truncation toward minus infinity).  [I N]
 
 ;; The variable math-floor-prec is local to math-floor, but used by
 ;; math-floor-fancy in calc-arith.el, which is called by math-floor.
 
+;;;###autoload
 (defun math-floor (a &optional math-floor-prec)    ;  [Public]
   (cond (math-floor-prec
         (require 'calc-ext)
@@ -628,9 +813,11 @@ loaded and the keystroke automatically re-typed."
           (math-trunc a)))
        (t (require 'calc-ext)
           (math-floor-fancy a))))
+;;;###autoload
 (defalias 'calcFunc-floor 'math-floor)
 
 
+;;;###autoload
 (defun math-imod (a b)   ; [I I I] [Public]
   (if (and (not (consp a)) (not (consp b)))
       (if (= b 0)
@@ -639,6 +826,7 @@ loaded and the keystroke automatically re-typed."
     (cdr (math-idivmod a b))))
 
 
+;;;###autoload
 (defun calcFunc-inv (m)
   (if (Math-vectorp m)
       (progn
@@ -653,6 +841,7 @@ loaded and the keystroke automatically re-typed."
         (math-pow m -1)
       (math-div 1 m))))
 
+;;;###autoload
 (defun math-do-working (msg arg)
   (or executing-kbd-macro
       (progn
@@ -666,7 +855,8 @@ loaded and the keystroke automatically re-typed."
                 (math-showing-full-precision (math-format-number arg))))))
 
 
-;;; Compute A modulo B, defined in terms of truncation toward minus infinity.
+;; Compute A modulo B, defined in terms of truncation toward minus infinity.
+;;;###autoload
 (defun math-mod (a b)   ; [R R R] [Public]
   (cond ((and (Math-zerop a) (not (eq (car-safe a) 'mod))) a)
        ((Math-zerop b)
@@ -682,6 +872,7 @@ loaded and the keystroke automatically re-typed."
 
 ;;; General exponentiation.
 
+;;;###autoload
 (defun math-pow (a b)   ; [O O N] [Public]
   (cond ((equal b '(var nan var-nan))
         b)
@@ -707,6 +898,7 @@ loaded and the keystroke automatically re-typed."
         (require 'calc-ext)
         (math-pow-fancy a b))))
 
+;;;###autoload
 (defun math-ipow (a n)   ; [O O I] [Public]
   (cond ((Math-integer-negp n)
         (math-ipow (math-div 1 a) (Math-integer-neg n)))
@@ -737,6 +929,7 @@ loaded and the keystroke automatically re-typed."
     val))
 
 
+;;;###autoload
 (defun math-read-radix-digit (dig)   ; [D S; Z S]
   (if (> dig ?9)
       (if (< dig ?A)
@@ -749,20 +942,26 @@ loaded and the keystroke automatically re-typed."
 
 ;;; Bug reporting
 
+;;;###autoload
 (defun report-calc-bug ()
   "Report a bug in Calc, the GNU Emacs calculator.
 Prompts for bug subject.  Leaves you in a mail buffer."
   (interactive)
   (let ((reporter-prompt-for-summary-p t))
-    (reporter-submit-bug-report calc-bug-address "Calc" '(calc-version)
-                               nil nil
+    (reporter-submit-bug-report calc-bug-address "Calc"
+                               nil nil nil
                                "Please describe exactly what actions triggered the bug and the
 precise symptoms of the bug.  If possible, include a backtrace by
 doing 'M-x toggle-debug-on-error', then reproducing the bug.
 " )))
+;;;###autoload
 (defalias 'calc-report-bug 'report-calc-bug)
 
 (provide 'calc-misc)
 
-;;; arch-tag: 7984d9d0-62e5-41dc-afb8-e904b975f250
+;; Local variables:
+;; generated-autoload-file: "calc-loaddefs.el"
+;; End:
+
+;; arch-tag: 7984d9d0-62e5-41dc-afb8-e904b975f250
 ;;; calc-misc.el ends here