From f38952fe7bd43bbe4013d9a1d99d9bfc7dd7d742 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Wed, 7 Jun 2000 12:31:26 +0000 Subject: [PATCH] (readevalloop): If READCHARFUN sets point to ZV, arrange to stop reading, even if the form read sets point to a different value when evaluated. --- src/ChangeLog | 8 ++++++++ src/lread.c | 21 ++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fb734387aa4..2a5875dac96 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2000-06-07 Gerd Moellmann + * window.c (displayed_window_lines): New function. + (Fmove_to_window_line): Use displayed_window_lines to determine + the number of lines to move, instead of using the window's height. + + * lread.c (readevalloop): If READCHARFUN sets point to ZV, arrange + to stop reading, even if the form read sets point to a different + value when evaluated. + * xdisp.c (display_line): Fix code deciding in which line to put the cursor. diff --git a/src/lread.c b/src/lread.c index 1e33df4a87a..3a1bc00c03f 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1136,6 +1136,7 @@ readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, read int count = specpdl_ptr - specpdl; struct gcpro gcpro1; struct buffer *b = 0; + int continue_reading_p; if (BUFFERP (readcharfun)) b = XBUFFER (readcharfun); @@ -1153,7 +1154,8 @@ readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, read LOADHIST_ATTACH (sourcename); - while (1) + continue_reading_p = 1; + while (continue_reading_p) { if (b != 0 && NILP (b->name)) error ("Reading from killed buffer"); @@ -1182,8 +1184,20 @@ readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, read { UNREAD (c); read_objects = Qnil; - if (! NILP (readfun)) - val = call1 (readfun, readcharfun); + if (!NILP (readfun)) + { + val = call1 (readfun, readcharfun); + + /* If READCHARFUN has set point to ZV, we should + stop reading, even if the form read sets point + to a different value when evaluated. */ + if (BUFFERP (readcharfun)) + { + struct buffer *b = XBUFFER (readcharfun); + if (BUF_PT (b) == BUF_ZV (b)) + continue_reading_p = 0; + } + } else if (! NILP (Vload_read_function)) val = call1 (Vload_read_function, readcharfun); else @@ -1191,6 +1205,7 @@ readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, read } val = (*evalfun) (val); + if (printflag) { Vvalues = Fcons (val, Vvalues); -- 2.39.2