[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
decode_any_window
From: |
martin rudalics |
Subject: |
decode_any_window |
Date: |
Sun, 07 Dec 2008 14:02:32 +0100 |
User-agent: |
Thunderbird 2.0.0.16 (Windows/20080708) |
With Emacs 23 `fit-window-to-buffer' contains the following code:
(defun fit-window-to-buffer (&optional window max-height min-height)
...
(unless (zerop delta)
(enlarge-window delta))
...
(= desired-height (window-height window))
When delta is negative, `enlarge-window' will shrink WINDOW and, if this
makes its height less than that of `window-min-height', delete it. OTOH
`window-height' operates on ANY window regardless of whether it's live
or has been deleted. Now if WINDOW is a full-height child of a parent
window which is not the root window of that frame, deleting that parent
window calls the routine delete_all_subwindows which, as a special hack,
temporarily stores the name of the buffer displayed by WINDOW in the
number of lines of the window. As a consequence, (window-height window)
returns the buffer previously shown in WINDOW and the test for equality
fails because a buffer is neither a number nor a marker. Emacs 22
worked around this problem by temporarily binding `window-min-height' to
1, so WINDOW didn't get deleted.
Hence in this special case an apparently reasonable operation fails
gracefully for a reason hardly anyone will understand. I'm not sure
whether other operations fail equally gracefully. The Elisp manual
warns:
*Warning:* Erroneous information or fatal errors may result from
using a deleted window as if it were live.
But this advice is problematic because quite often we can't say what
"using" stands for. Do we "use" a deleted window when we call
`window-height' on it?
The problem is that decode_window considers a window "live" when it has
a buffer. Parent windows don't have a buffer but we want to execute
`window-height' on them, so we use decode_any_window. I suppose TRT for
decode_any_window is to check whether it has either a buffer or a
vertical or horizontal child. But maybe we want to decode effectively
"dead" windows too for some reason?
martin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- decode_any_window,
martin rudalics <=