]> code.delx.au - gnu-emacs/blobdiff - lisp/calculator.el
Add a provide statement.
[gnu-emacs] / lisp / calculator.el
index b0ca5b4f449852b131fc27c2b998b977924ae2ec..a9410ae961cd8ceae4849be2fc329262ab4b3e73 100644 (file)
@@ -4,7 +4,6 @@
 
 ;; Author: Eli Barzilay <eli@barzilay.org>
 ;; Keywords: tools, convenience
-;; Time-stamp: <2001-09-23 02:24:35 eli>
 
 ;; This file is part of GNU Emacs.
 
@@ -129,14 +128,14 @@ character, in this case the `calculator-standard-displayer' function
 will be used with this character for a format string.")
 
 (defcustom calculator-displayers
-  '(((std ?n) "Standard dislpay, decimal point or scientific")
+  '(((std ?n) "Standard display, decimal point or scientific")
     (calculator-eng-display "Eng display")
     ((std ?f) "Standard display, decimal point")
-    ((std ?e) "Standard dislpay, scientific")
+    ((std ?e) "Standard display, scientific")
     ("%S"     "Emacs printer"))
   "*A list of displayers.
 Each element is a list of a displayer and a description string.  The
-first element is the one which is curently used, this is for the display
+first element is the one which is currently used, this is for the display
 of result values not values in expressions.  A displayer specification
 is the same as the values that can be stored in `calculator-displayer'.
 
@@ -669,14 +668,13 @@ See the documentation for `calculator-mode' for more information."
            ;; don't change this since it is a customization variable,
            ;; its set function will add any new operators
            (calculator-add-operators calculator-user-operators)))
+  (setq calculator-buffer (get-buffer-create "*calculator*"))
   (if calculator-electric-mode
     (save-window-excursion
       (progn (require 'electric) (message nil)) ; hide load message
       (let (old-g-map old-l-map (echo-keystrokes 0)
             (garbage-collection-messages nil)) ; no gc msg when electric
-        ;; strange behavior in FSF: doesn't always select correct
-        ;; minibuffer.  I have no idea how to fix this
-        (setq calculator-buffer (window-buffer (minibuffer-window)))
+        (set-window-buffer (minibuffer-window) calculator-buffer)
         (select-window (minibuffer-window))
         (calculator-reset)
         (calculator-update-display)
@@ -698,7 +696,6 @@ See the documentation for `calculator-mode' for more information."
           (use-local-map old-l-map)
           (use-global-map old-g-map))))
     (progn
-      (setq calculator-buffer (get-buffer-create "*calculator*"))
       (cond
         ((not (get-buffer-window calculator-buffer))
          (let ((split-window-keep-point nil)
@@ -721,7 +718,7 @@ See the documentation for `calculator-mode' for more information."
     (calculator)))
 
 ;;;---------------------------------------------------------------------
-;;; Operatos
+;;; Operators
 
 (defun calculator-op-arity (op)
   "Return OP's arity, 2, +1 or -1."
@@ -988,7 +985,9 @@ the 'left or 'right when one of the standard modes is used."
                       (setq num (/ num 1000.0)) (setq exp (+ exp 3))
                       (setq i (1+ i)))))))
       (or calculator-eng-tmp-show (setq calculator-eng-extra nil))
-      (let ((str (format (concat "%." calculator-number-digits "f")
+      (let ((str (format (concat "%." (number-to-string
+                                       calculator-number-digits)
+                                 "f")
                          num)))
         (concat (let ((calculator-remove-zeros
                        ;; make sure we don't leave integers
@@ -1688,4 +1687,5 @@ To use this, apply a binary operator (evaluate it), then call this."
 
 (provide 'calculator)
 
+;;; arch-tag: a1b9766c-af8a-4a74-b466-65ad8eeb0c73
 ;;; calculator.el ends here