]> code.delx.au - gnu-emacs/blobdiff - lisp/calc/calc.el
Format initial input uniformly.
[gnu-emacs] / lisp / calc / calc.el
index 58bbdb81289501fbf7e92c8bc4e52e17acc40caf..105e1e443b48e9da8aeb729db5c52eba5325bac7 100644 (file)
 (declare-function math-parse-date "calc-forms" (math-pd-str))
 (declare-function math-lessp "calc-ext" (a b))
 (declare-function math-compare "calc-ext" (a b))
+(declare-function math-zerop "calc-misc" (a))
 (declare-function calc-embedded-finish-command "calc-embed" ())
 (declare-function calc-embedded-select-buffer "calc-embed" ())
 (declare-function calc-embedded-mode-line-change "calc-embed" ())
@@ -735,7 +736,7 @@ If hms, angles are in degrees-minutes-seconds.")
 
 (defcalcmodevar calc-algebraic-mode nil
   "If non-nil, numeric entry accepts whole algebraic expressions.
-If nil, algebraic expressions must be preceded by \"'\".")
+If nil, algebraic expressions must be preceded by \"\\='\".")
 
 (defcalcmodevar calc-incomplete-algebraic-mode nil
   "Like calc-algebraic-mode except only affects ( and [ keys.")
@@ -988,11 +989,11 @@ Used by `calc-user-invocation'.")
 (defvar calc-last-kill nil
   "The last number killed in calc-mode.")
 (defvar calc-dollar-values nil
-  "Values to be used for '$'.")
+  "Values to be used for `$'.")
 (defvar calc-dollar-used nil
-  "The highest order of '$' that occurred.")
+  "The highest order of `$' that occurred.")
 (defvar calc-hashes-used nil
-  "The highest order of '#' that occurred.")
+  "The highest order of `#' that occurred.")
 (defvar calc-quick-prev-results nil
   "Previous results from Quick Calc.")
 (defvar calc-said-hello nil
@@ -1310,7 +1311,7 @@ This is an RPN calculator featuring arbitrary-precision integer, rational,
 floating-point, complex, matrix, and symbolic arithmetic.
 
 RPN calculation:  2 RET 3 +    produces 5.
-Algebraic style:  ' 2+3 RET    produces 5.
+Algebraic style:  \\=' 2+3 RET    produces 5.
 
 Basic operators are +, -, *, /, ^, & (reciprocal), % (modulo), n (change-sign).
 
@@ -1329,7 +1330,7 @@ Notations:  3.14e6     3.14 * 10^6
             [1 .. 4)   semi-open interval, 1 <= x < 4
             2 +/- 3    (p key) number with mean 2, standard deviation 3
             2 mod 3    (M key) number 2 computed modulo 3
-           <1 jan 91> Date form (enter using ' key)
+           <1 jan 91> Date form (enter using \\=' key)
 
 
 \\{calc-mode-map}
@@ -2033,7 +2034,7 @@ See calc-keypad for details."
 ;; (YEAR MONTH DAY math-date-from-gregorian-dt(YEAR MONTH DAY)) for speed.
 (defcustom calc-gregorian-switch nil
   "The first day the Gregorian calendar is used by Calc's date forms.
-This is `nil' (the default) if the Gregorian calendar is the only one used.
+This is nil (the default) if the Gregorian calendar is the only one used.
 Otherwise, it should be a list `(YEAR MONTH DAY)' when Calc begins to use
 the Gregorian calendar; Calc will use the Julian calendar for earlier dates.
 The dates in which different regions of the world began to use the
@@ -2302,12 +2303,20 @@ the United States."
                   (calc-delete-selection 1)
                 (calc-pop-stack nn))))))
     (if calc-context-sensitive-enter (calc-cursor-stack-index (1- num)))))
-    
+
 
 
 
 
 ;;;; Reading a number using the minibuffer.
+(defun calc-digit-start-entry ()
+  (cond ((eq last-command-event ?e)
+         (if (> calc-number-radix 14) (format "%d.^" calc-number-radix) "1e"))
+        ((eq last-command-event ?#) (format "%d#" calc-number-radix))
+        ((eq last-command-event ?_) "-")
+        ((eq last-command-event ?@) "0@ ")
+        (t (char-to-string last-command-event)))))
+
 (defvar calc-buffer)
 (defvar calc-prev-char)
 (defvar calc-prev-prev-char)
@@ -2318,7 +2327,6 @@ the United States."
    (if (or calc-algebraic-mode
           (and (> calc-number-radix 14) (eq last-command-event ?e)))
        (calc-alg-digit-entry)
-     (calc-unread-command)
      (setq calc-aborted-prefix nil)
      (let* ((calc-digit-value nil)
            (calc-prev-char nil)
@@ -2336,7 +2344,8 @@ the United States."
                     (unwind-protect
                         (progn
                           (define-key global-map "\e" nil)
-                          (read-from-minibuffer "Calc: " "" calc-digit-map))
+                          (read-from-minibuffer
+                            "Calc: " (calc-digit-start-entry) calc-digit-map))
                       (define-key global-map "\e" old-esc))))))
        (or calc-digit-value (setq calc-digit-value (math-read-number buf)))
        (if (stringp calc-digit-value)
@@ -3917,8 +3926,4 @@ See Info node `(calc)Defining Functions'."
 
 (provide 'calc)
 
-;; Local variables:
-;; coding: utf-8
-;; End:
-
 ;;; calc.el ends here