# HG changeset patch # User Richard M. Stallman # Date 776406593 0 # Node ID 865daa7a9faf1a1f28d2cac03c6e27f10606f2be # Parent 320375e58ee37d33109a44613bdcfadbd60fb6bd (Fwindow_end): If window_end_valid is nil, return nil. diff -r 320375e58ee3 -r 865daa7a9faf src/window.c --- a/src/window.c Tue Aug 09 04:23:51 1994 +0000 +++ b/src/window.c Tue Aug 09 04:29:53 1994 +0000 @@ -493,7 +493,16 @@ "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 @@ 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));