changeset 26635:af8d605cbcf1

(Fwindow_end): Don't call temp_set_pt_both with out of range position.
author Gerd Moellmann <gerd@gnu.org>
date Sun, 28 Nov 1999 12:48:29 +0000
parents b1d50e45b825
children 36564a827d06
files src/window.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Sun Nov 28 12:37:33 1999 +0000
+++ b/src/window.c	Sun Nov 28 12:48:29 1999 +0000
@@ -720,8 +720,21 @@
 	    && XFASTINT (w->last_modified) >= MODIFF))
     {
       int opoint = PT, opoint_byte = PT_BYTE;
-      TEMP_SET_PT_BOTH (XMARKER (w->start)->charpos,
-			XMARKER (w->start)->bytepos);
+
+      /* In case W->start is out of the range, use something
+         reasonable.  This situation occured when loading a file with
+         `-l' containing a call to `rmail' with subsequent other
+         commands.  At the end, W->start happened to be BEG, while
+         rmail had already narrowed the buffer.  This leads to an
+         abort in temp_set_pt_both.  */
+      if (XMARKER (w->start)->charpos < BEGV)
+	TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
+      else if (XMARKER (w->start)->charpos > ZV)
+	TEMP_SET_PT_BOTH (ZV, ZV_BYTE);
+      else
+	TEMP_SET_PT_BOTH (XMARKER (w->start)->charpos,
+			  XMARKER (w->start)->bytepos);
+      
       Fvertical_motion (make_number (window_internal_height (w)), Qnil);
       XSETINT (value, PT);
       TEMP_SET_PT_BOTH (opoint, opoint_byte);