]> git.eshelyaron.com Git - emacs.git/commitdiff
(calculator): Do more extensive checking for when 3 lines should be
authorJay Belanger <jay.p.belanger@gmail.com>
Sat, 10 Feb 2007 22:03:55 +0000 (22:03 +0000)
committerJay Belanger <jay.p.belanger@gmail.com>
Sat, 10 Feb 2007 22:03:55 +0000 (22:03 +0000)
used for the calculator.

lisp/ChangeLog
lisp/calculator.el

index 171beae728aca0c0b20540cbe1fbf91aa23f01f8..d398577314d468bcae7cd88c32a91c7ccba53b18 100644 (file)
@@ -1,3 +1,8 @@
+2007-02-10  Jay Belanger  <belanger@truman.edu>
+
+       * calculator.el (calculator): Do more extensive checking for when
+       3 lines should be used for the calculator.
+
 2007-02-10  Eli Zaretskii  <eliz@gnu.org>
 
        * info-look.el (info-lookup-make-completions): Bind
index 363e98a804f1a91097e1aed2ba53702a729d6521..a5e527eed2039f6123d0277313b24473c143c2ff 100644 (file)
@@ -735,8 +735,32 @@ See the documentation for `calculator-mode' for more information."
            ;; `raised' modeline in Emacs 21
            (select-window
             (split-window-vertically
+             ;; If the modeline might interfere with the calculator buffer,
+             ;; use 3 lines instead. 
              (if (and (fboundp 'face-attr-construct)
-                      (plist-get (face-attr-construct 'modeline) :box))
+                      ;; 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)))
                -3 -2)))
            (switch-to-buffer calculator-buffer)))
         ((not (eq (current-buffer) calculator-buffer))