aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-08-09 04:29:53 +0000
committerRichard M. Stallman1994-08-09 04:29:53 +0000
commit7250968eba3eea4b41392ed86523f0e2f0677002 (patch)
treedc92c7d2a96c742b78b080e9aef9158f21b414e1 /src
parentc638661f14454e2237fe34466831d7430abb0d97 (diff)
downloademacs-7250968eba3eea4b41392ed86523f0e2f0677002.tar.gz
emacs-7250968eba3eea4b41392ed86523f0e2f0677002.zip
(Fwindow_end): If window_end_valid is nil, return nil.
Diffstat (limited to 'src')
-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,
493 "Return position at which display currently ends in WINDOW.\n\ 493 "Return position at which display currently ends in WINDOW.\n\
494This is updated by redisplay, when it runs to completion.\n\ 494This is updated by redisplay, when it runs to completion.\n\
495Simply changing the buffer text or setting `window-start'\n\ 495Simply changing the buffer text or setting `window-start'\n\
496does not update this value.") 496does not update this value.\n\
497\n\
498This function returns nil if the position is not currently known.\n\
499That happens when redisplay is preempted and doesn't finish.\n\
500If in that case you want to compute where the end of the window would\n\
501have been if redisplay had finished, do this:\n\
502 (save-excursion\n\
503 (goto-char (window-start window))\n\
504 (vertical-motion (1- (window-height window)) window)\n\
505 (point))")
497 (window) 506 (window)
498 Lisp_Object window; 507 Lisp_Object window;
499{ 508{
@@ -504,6 +513,13 @@ does not update this value.")
504 buf = w->buffer; 513 buf = w->buffer;
505 CHECK_BUFFER (buf, 0); 514 CHECK_BUFFER (buf, 0);
506 515
516 /* If we don't know the end position, return nil.
517 The user can compute it with vertical-motion if he wants to.
518 It would be nicer to do it automatically,
519 but that's so slow that it would probably bother people. */
520 if (NILP (w->window_end_valid))
521 return Qnil;
522
507 XSET (value, Lisp_Int, 523 XSET (value, Lisp_Int,
508 BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); 524 BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
509 525