[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4543: window-full-height-p
From: |
Stefan Monnier |
Subject: |
bug#4543: window-full-height-p |
Date: |
Fri, 02 Oct 2009 09:30:29 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
>>>> (defun window-full-height-p (&optional window)
>>>> (unless window
>>>> (setq window (selected-window)))
>>>> (= (window-height window)
>>>> (window-height (frame-root-window (window-frame window)))))
>>
>> Please could this be installed?
> I have a number of problems with this:
> (1) The name is problematic. Note that `window-full-width-p' has no
> such problem because when it returns t the window is as wide as the
> containing frame.
> (2) It might give unexpected results when invoked with the minibuffer
> window as argument. Again `window-full-width-p' has no such problems.
I think the name is OK, but the docstring needs to clearly explain what
is the intended behavior (which, I must say, I do not know, but I guess
it's something like "the frame is not split top-down", except we're
talking about a window). It's more important to make sure that
the docstring is clear and describes a useful behavior, than to make
sure it describes the actual behavior of its current implementation.
> (3) It must be rewritten as soon as someone implements horizontal
> scrollbars ;-)
That's OK: this code is (now) available for 0 efforts, so rewriting it
wouldn't mean that much effort has been wasted.
> Personally, I use a function `window-size' to return the total size of a
> window thus avoiding such confusions:
> DEFUN ("window-size", Fwindow_size, Swindow_size, 0, 2, 0,
> doc: /* Return total number of lines of WINDOW.
> WINDOW defaults to the selected window. The return values includes any
> header- or mode-line. Optional argument HORIZONTAL non-nil means return
> total number of columns of WINDOW. In this case the return value
> includes any scroll-bars of WINDOW. */)
> (window, horizontal)
> Lisp_Object window, horizontal;
> {
> if (!NILP (horizontal))
> return decode_any_window (window)->total_cols;
> else
> return decode_any_window (window)->total_lines;
> }
Seems reasonable. Where do you use it?
Stefan