summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-08-09 04:29:53 +0000
committerRichard M. Stallman <rms@gnu.org>1994-08-09 04:29:53 +0000
commitf012216073e56a1c25690c40d267d0e18a1ff98f (patch)
tree29d8b8e1b3a1c91a6fe01cbc48a6877ce92d67a4 /src/window.c
parent942a19e622efdc9e1a35ded537a6a74c812dd64f (diff)
downloademacs-f012216073e56a1c25690c40d267d0e18a1ff98f.tar.gz
(Fwindow_end): If window_end_valid is nil, return nil.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c
index e89fa874c84..1401abda32c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -493,7 +493,16 @@ DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 1, 0,
"Return position at which display currently ends in WINDOW.\n\
This is updated by redisplay, when it runs to completion.\n\
Simply changing the buffer text or setting `window-start'\n\
-does not update this value.")
+does not update this value.\n\
+\n\
+This function returns nil if the position is not currently known.\n\
+That happens when redisplay is preempted and doesn't finish.\n\
+If in that case you want to compute where the end of the window would\n\
+have been if redisplay had finished, do this:\n\
+ (save-excursion\n\
+ (goto-char (window-start window))\n\
+ (vertical-motion (1- (window-height window)) window)\n\
+ (point))")
(window)
Lisp_Object window;
{
@@ -504,6 +513,13 @@ does not update this value.")
buf = w->buffer;
CHECK_BUFFER (buf, 0);
+ /* If we don't know the end position, return nil.
+ The user can compute it with vertical-motion if he wants to.
+ It would be nicer to do it automatically,
+ but that's so slow that it would probably bother people. */
+ if (NILP (w->window_end_valid))
+ return Qnil;
+
XSET (value, Lisp_Int,
BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));