emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem of released-button style mode-line


From: Miles Bader
Subject: Re: problem of released-button style mode-line
Date: Fri, 20 Oct 2000 17:05:51 +0900 (JST)

Kenichi Handa <address@hidden> writes:
> So, I tried to check the style of the current modeline, and
> increase the window height only when released-button style
> is used by using a code something like this:
> 
> (if (let ((box-attr (face-attribute 'mode-line :box)))
>       (and (listp box-attr)
>          (eq (plist-get box-attr :style) 'released-button)))
>     ...)
> 
> But, such a code seems very clumsy.  If possible, I'd like
> to avoid installing this kind of code.

That seems like a bad idea, it's too fragile -- many face attributes can
increase the mode-line height, not only :box, but :height, :family,
:inherit, etc. as well.

Even if you check to make sure all attributes of the mode-line face are
`unspecified' or nil, except for the ones that can't affect the height
(:inverse-video, :{fore,back}ground ...), it can *still* be too big, if
some string displayed in the mode-line has a face property.

Whether it's better to do the test on the mode-line face, and assume it
won't get screwed up by something (and risk obscuration), or to
default to making such buffers too big, I don't know.

Until the some way is added to actually do this correctly (which seems
like it might be ... involved), how about defining something like --

 (defcustom mode-line-window-height-fudge 1
   "*Amount returned by `mode-line-window-height-fudge' on graphical displays.
 This is added to the sizes of windows in some cases to compensate for the
 extra height of graphical mode-lines.

 This is a kluge.")

 (defsubst mode-line-window-height-fudge ()
   "Return a fudge factor to compensate for the extra height of graphic 
mode-lines. 
 This can be added to the height of a window if such mode-lines could possibly
 obscure the last line of text.
 On a non-graphic display, return 0.

 This is a kluge."
   (if (display-graphic-p)
       mode-line-window-height-fudge
     0))

And make your code add (mode-line-window-height-fudge) to its window
size request.

Then you can customize `mode-line-window-height-fudge' and cross your fingers.

-Miles
-- 
Love is a snowmobile racing across the tundra.  Suddenly it flips over,
pinning you underneath.  At night the ice weasels come.  --Nietzsche



reply via email to

[Prev in Thread] Current Thread [Next in Thread]