diff options
| author | Richard M. Stallman | 1994-08-09 04:29:53 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-08-09 04:29:53 +0000 |
| commit | 7250968eba3eea4b41392ed86523f0e2f0677002 (patch) | |
| tree | dc92c7d2a96c742b78b080e9aef9158f21b414e1 /src | |
| parent | c638661f14454e2237fe34466831d7430abb0d97 (diff) | |
| download | emacs-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.c | 18 |
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\ |
| 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 | { |
| @@ -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 | ||