]> code.delx.au - gnu-emacs/blobdiff - lisp/calculator.el
* tramp.texi (top) [xxx, yyy, trampfn]: Provide two versions of
[gnu-emacs] / lisp / calculator.el
index 1e9bb689063af349db43c9c634f3f9ae11c13594..89fa460e53126e042fc1ea68fa210fc98baf257c 100644 (file)
@@ -1,7 +1,6 @@
 ;;; calculator.el --- a [not so] simple calculator for Emacs
 
-;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004,  2005, 2006, 2007,
-;;   2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2013 Free Software Foundation, Inc.
 
 ;; Author: Eli Barzilay <eli@barzilay.org>
 ;; Keywords: tools, convenience
@@ -44,8 +43,6 @@
 ;;; History:
 ;; I hate history.
 
-(eval-when-compile (require 'cl))
-
 ;;;=====================================================================
 ;;; Customization:
 
@@ -82,7 +79,7 @@ This determines the default behavior of unary operators."
 
 (defcustom calculator-prompt "Calc=%s> "
   "The prompt used by the Emacs calculator.
-It should contain a \"%s\" somewhere that will indicate the i/o radixes;
+It should contain a \"%s\" somewhere that will indicate the i/o radices;
 this will be a two-character string as described in the documentation
 for `calculator-mode'."
   :type  'string
@@ -199,11 +196,11 @@ For example, use this to define the golden ratio number:
   (setq calculator-user-registers '((?g .  1.61803398875)))
 before you load calculator."
   :type  '(repeat (cons character number))
-  :set   '(lambda (_ val)
-            (and (boundp 'calculator-registers)
-                 (setq calculator-registers
-                       (append val calculator-registers)))
-            (setq calculator-user-registers val))
+  :set   (lambda (_ val)
+           (and (boundp 'calculator-registers)
+                (setq calculator-registers
+                      (append val calculator-registers)))
+           (setq calculator-user-registers val))
   :group 'calculator)
 
 (defcustom calculator-user-operators nil
@@ -483,7 +480,7 @@ Used for repeating operations in calculator-repR/L.")
             ["Electric mode"
              (progn (calculator-quit)
                     (setq calculator-restart-other-mode t)
-                    (run-with-timer 0.1 nil '(lambda () (message nil)))
+                    (run-with-timer 0.1 nil (lambda () (message nil)))
                     ;; the message from the menu will be visible,
                     ;; couldn't make it go away...
                     (calculator))
@@ -707,7 +704,7 @@ See the documentation for `calculator-mode' for more information."
               (Electric-command-loop
                'calculator-done
                ;; can't use 'noprompt, bug in electric.el
-               '(lambda () 'noprompt)
+               (lambda () 'noprompt)
                nil
                (lambda (x y) (calculator-update-display))))
           (and calculator-buffer
@@ -718,17 +715,17 @@ See the documentation for `calculator-mode' for more information."
       (cond
         ((not (get-buffer-window calculator-buffer))
          (let ((window-min-height 2))
-           ;; maybe leave two lines for our window because of the normal
-           ;; `raised' modeline in Emacs 21
+           ;; maybe leave two lines for our window because of the
+           ;; normal `raised' mode line
            (select-window
-            (split-window-vertically
-             ;; If the modeline might interfere with the calculator buffer,
-             ;; use 3 lines instead.
+            (split-window-below
+             ;; If the mode line might interfere with the calculator
+             ;; buffer, use 3 lines instead.
              (if (and (fboundp 'face-attr-construct)
                       (let* ((dh (plist-get (face-attr-construct 'default) :height))
-                             (mf (face-attr-construct 'modeline))
+                             (mf (face-attr-construct 'mode-line))
                              (mh (plist-get mf :height)))
-                        ;; If the modeline is shorter than the default,
+                        ;; If the mode line is shorter than the default,
                         ;; stick with 2 lines.  (It may be necessary to
                         ;; check how much shorter.)
                         (and
@@ -740,7 +737,7 @@ See the documentation for `calculator-mode' for more information."
                                    (not (integerp mh))
                                    (< mh 1))))
                          (or
-                          ;; If the modeline is taller than the default,
+                          ;; If the mode line is taller than the default,
                           ;; use 3 lines.
                           (and (integerp dh)
                                (integerp mh)
@@ -748,7 +745,7 @@ See the documentation for `calculator-mode' for more information."
                           (and (numberp mh)
                                (not (integerp mh))
                                (> mh 1))
-                          ;; If the modeline has a box with non-negative line-width,
+                          ;; If the mode line has a box with non-negative line-width,
                           ;; use 3 lines.
                           (let* ((bx (plist-get mf :box))
                                  (lh (plist-get bx :line-width)))
@@ -756,8 +753,8 @@ See the documentation for `calculator-mode' for more information."
                                  (or
                                   (not lh)
                                   (> lh 0))))
-                          ;; If the modeline has an overline, use 3 lines.
-                          (plist-get (face-attr-construct 'modeline) :overline)))))
+                          ;; If the mode line has an overline, use 3 lines.
+                          (plist-get (face-attr-construct 'mode-line) :overline)))))
                -3 -2)))
            (switch-to-buffer calculator-buffer)))
         ((not (eq (current-buffer) calculator-buffer))