comparison src/window.c @ 36231:9fa7c8e6a6d5

(Fwindow_end): Handle case that WINDOW's buffer is not equal to the current buffer.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 20 Feb 2001 16:00:18 +0000
parents 8d5b7f742286
children 28af746067b2
comparison
equal deleted inserted replaced
36230:56577cf3e384 36231:9fa7c8e6a6d5
910 && ! (! NILP (w->window_end_valid) 910 && ! (! NILP (w->window_end_valid)
911 && XFASTINT (w->last_modified) >= MODIFF)) 911 && XFASTINT (w->last_modified) >= MODIFF))
912 { 912 {
913 struct text_pos startp; 913 struct text_pos startp;
914 struct it it; 914 struct it it;
915 struct buffer *old_buffer = NULL, *b = XBUFFER (buf);
915 916
916 /* In case W->start is out of the range, use something 917 /* In case W->start is out of the range, use something
917 reasonable. This situation occured when loading a file with 918 reasonable. This situation occured when loading a file with
918 `-l' containing a call to `rmail' with subsequent other 919 `-l' containing a call to `rmail' with subsequent other
919 commands. At the end, W->start happened to be BEG, while 920 commands. At the end, W->start happened to be BEG, while
925 else 926 else
926 SET_TEXT_POS_FROM_MARKER (startp, w->start); 927 SET_TEXT_POS_FROM_MARKER (startp, w->start);
927 928
928 /* Cannot use Fvertical_motion because that function doesn't 929 /* Cannot use Fvertical_motion because that function doesn't
929 cope with variable-height lines. */ 930 cope with variable-height lines. */
931 if (b != current_buffer)
932 {
933 old_buffer = current_buffer;
934 set_buffer_internal (b);
935 }
936
930 start_display (&it, w, startp); 937 start_display (&it, w, startp);
931 move_it_vertically (&it, window_box_height (w)); 938 move_it_vertically (&it, window_box_height (w));
932 move_it_past_eol (&it); 939 move_it_past_eol (&it);
933 value = make_number (IT_CHARPOS (it)); 940 value = make_number (IT_CHARPOS (it));
941
942 if (old_buffer)
943 set_buffer_internal (old_buffer);
934 } 944 }
935 else 945 else
936 XSETINT (value, BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); 946 XSETINT (value, BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
937 947
938 return value; 948 return value;