Mercurial > emacs
comparison src/window.c @ 8492:865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 09 Aug 1994 04:29:53 +0000 |
parents | 52b7441e731b |
children | 6d2f0901efe9 |
comparison
equal
deleted
inserted
replaced
8491:320375e58ee3 | 8492:865daa7a9faf |
---|---|
491 | 491 |
492 DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 1, 0, | 492 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\ |
494 This is updated by redisplay, when it runs to completion.\n\ | 494 This is updated by redisplay, when it runs to completion.\n\ |
495 Simply changing the buffer text or setting `window-start'\n\ | 495 Simply changing the buffer text or setting `window-start'\n\ |
496 does not update this value.") | 496 does not update this value.\n\ |
497 \n\ | |
498 This function returns nil if the position is not currently known.\n\ | |
499 That happens when redisplay is preempted and doesn't finish.\n\ | |
500 If in that case you want to compute where the end of the window would\n\ | |
501 have 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 { |
500 Lisp_Object value; | 509 Lisp_Object value; |
501 struct window *w = decode_window (window); | 510 struct window *w = decode_window (window); |
502 Lisp_Object buf; | 511 Lisp_Object buf; |
503 | 512 |
504 buf = w->buffer; | 513 buf = w->buffer; |
505 CHECK_BUFFER (buf, 0); | 514 CHECK_BUFFER (buf, 0); |
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; | |
506 | 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 |
510 return value; | 526 return value; |