# HG changeset patch # User Jay Belanger # Date 1171144885 0 # Node ID fa4ebb68ab30b577b4be08c37d903eac7b39385f # Parent 97721109e77fe0bff004374a1ccf8ef82a774c2b (calculator): Do more extensive checking for when 3 lines should be used for the calculator. diff -r 97721109e77f -r fa4ebb68ab30 lisp/calculator.el --- a/lisp/calculator.el Sat Feb 10 20:21:28 2007 +0000 +++ b/lisp/calculator.el Sat Feb 10 22:01:25 2007 +0000 @@ -735,8 +735,32 @@ ;; `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))