]> code.delx.au - gnu-emacs/blobdiff - lisp/calculator.el
Use __sparc__ rather than sparc.
[gnu-emacs] / lisp / calculator.el
index a5e527eed2039f6123d0277313b24473c143c2ff..2feea1bba373fe150dc18599967b926935bde48a 100644 (file)
@@ -1,7 +1,7 @@
 ;;; calculator.el --- a [not so] simple calculator for Emacs
 
 ;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Eli Barzilay <eli@barzilay.org>
 ;; Keywords: tools, convenience
@@ -11,7 +11,7 @@
 
 ;; 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 2, or (at your option) any
+;; Free Software Foundation; either version 3, or (at your option) any
 ;; later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful, but
@@ -88,9 +88,9 @@ 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,
-this string will be a two-character string as described in the
-documentation for `calculator-mode'."
+It should contain a \"%s\" somewhere that will indicate the i/o radixes;
+this will be a two-character string as described in the documentation
+for `calculator-mode'."
   :type  'string
   :group 'calculator)
 
@@ -561,7 +561,7 @@ Used for repeating operations in calculator-repR/L.")
                                      calculator-output-radix)))]
             "---"
             ,@(mapcar 'car radix-selectors)
-            ("Seperate I/O"
+            ("Separate I/O"
              ,@(mapcar (lambda (x) (nth 1 x)) radix-selectors)
              "---"
              ,@(mapcar (lambda (x) (nth 2 x)) radix-selectors)))
@@ -736,31 +736,41 @@ See the documentation for `calculator-mode' for more information."
            (select-window
             (split-window-vertically
              ;; If the modeline might interfere with the calculator buffer,
-             ;; use 3 lines instead. 
+             ;; use 3 lines instead.
              (if (and (fboundp 'face-attr-construct)
-                      ;; If the modeline is shorter than the default, 
-                      ;; stick with 2 lines.  (It may be necessary to 
-                      ;; check how much shorter.)
-                      (let ((dh (plist-get (face-attr-construct 'default) :height))
-                            (mh (plist-get (face-attr-construct 'modeline) :height)))
-                        (not
-                         (or (and (integerp dh)
-                                  (integerp mh)
-                                  (< mh dh))
-                             (and (numberp mh)
-                                  (not (integerp mh))
-                                  (< mh 1)))))
-                      (or
-                       ;; If the modeline has a box with non-negative line-width,
-                       ;; use 3 lines.
-                       (let* ((bx (plist-get (face-attr-construct 'modeline) :box))
-                              (lh (plist-get bx :line-width)))
-                         (and bx
-                              (or 
-                               (not lh)
-                               (> lh 0))))
-                       ;; If the modeline has an overline, use 3 lines.
-                       (plist-get (face-attr-construct 'modeline) :overline)))
+                      (let* ((dh (plist-get (face-attr-construct 'default) :height))
+                             (mf (face-attr-construct 'modeline))
+                             (mh (plist-get mf :height)))
+                        ;; If the modeline is shorter than the default,
+                        ;; stick with 2 lines.  (It may be necessary to
+                        ;; check how much shorter.)
+                        (and
+                         (not
+                          (or (and (integerp dh)
+                                   (integerp mh)
+                                   (< mh dh))
+                              (and (numberp mh)
+                                   (not (integerp mh))
+                                   (< mh 1))))
+                         (or
+                          ;; If the modeline is taller than the default,
+                          ;; use 3 lines.
+                          (and (integerp dh)
+                               (integerp mh)
+                               (> mh dh))
+                          (and (numberp mh)
+                               (not (integerp mh))
+                               (> mh 1))
+                          ;; If the modeline has a box with non-negative line-width,
+                          ;; use 3 lines.
+                          (let* ((bx (plist-get mf :box))
+                                 (lh (plist-get bx :line-width)))
+                            (and bx
+                                 (or
+                                  (not lh)
+                                  (> lh 0))))
+                          ;; If the modeline has an overline, use 3 lines.
+                          (plist-get (face-attr-construct 'modeline) :overline)))))
                -3 -2)))
            (switch-to-buffer calculator-buffer)))
         ((not (eq (current-buffer) calculator-buffer))