From: martin rudalics <rudalics@gmx.at>
To: emacs-devel <emacs-devel@gnu.org>
Subject: decode_any_window
Date: Sun, 07 Dec 2008 14:02:32 +0100 [thread overview]
Message-ID: <493BC968.3050707@gmx.at> (raw)
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
reply other threads:[~2008-12-07 13:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=493BC968.3050707@gmx.at \
--to=rudalics@gmx.at \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.