Mercurial > emacs
comparison src/lread.c @ 29486:033cf607b908
(readevalloop): If READCHARFUN sets point to ZV, arrange
to stop reading, even if the form read sets point to a different
value when evaluated.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 07 Jun 2000 12:30:47 +0000 |
parents | db8bfd5478d4 |
children | 469d242e5f72 |
comparison
equal
deleted
inserted
replaced
29485:362c61b5411b | 29486:033cf607b908 |
---|---|
1134 register int c; | 1134 register int c; |
1135 register Lisp_Object val; | 1135 register Lisp_Object val; |
1136 int count = specpdl_ptr - specpdl; | 1136 int count = specpdl_ptr - specpdl; |
1137 struct gcpro gcpro1; | 1137 struct gcpro gcpro1; |
1138 struct buffer *b = 0; | 1138 struct buffer *b = 0; |
1139 int continue_reading_p; | |
1139 | 1140 |
1140 if (BUFFERP (readcharfun)) | 1141 if (BUFFERP (readcharfun)) |
1141 b = XBUFFER (readcharfun); | 1142 b = XBUFFER (readcharfun); |
1142 else if (MARKERP (readcharfun)) | 1143 else if (MARKERP (readcharfun)) |
1143 b = XMARKER (readcharfun)->buffer; | 1144 b = XMARKER (readcharfun)->buffer; |
1151 | 1152 |
1152 GCPRO1 (sourcename); | 1153 GCPRO1 (sourcename); |
1153 | 1154 |
1154 LOADHIST_ATTACH (sourcename); | 1155 LOADHIST_ATTACH (sourcename); |
1155 | 1156 |
1156 while (1) | 1157 continue_reading_p = 1; |
1158 while (continue_reading_p) | |
1157 { | 1159 { |
1158 if (b != 0 && NILP (b->name)) | 1160 if (b != 0 && NILP (b->name)) |
1159 error ("Reading from killed buffer"); | 1161 error ("Reading from killed buffer"); |
1160 | 1162 |
1161 instream = stream; | 1163 instream = stream; |
1180 } | 1182 } |
1181 else | 1183 else |
1182 { | 1184 { |
1183 UNREAD (c); | 1185 UNREAD (c); |
1184 read_objects = Qnil; | 1186 read_objects = Qnil; |
1185 if (! NILP (readfun)) | 1187 if (!NILP (readfun)) |
1186 val = call1 (readfun, readcharfun); | 1188 { |
1189 val = call1 (readfun, readcharfun); | |
1190 | |
1191 /* If READCHARFUN has set point to ZV, we should | |
1192 stop reading, even if the form read sets point | |
1193 to a different value when evaluated. */ | |
1194 if (BUFFERP (readcharfun)) | |
1195 { | |
1196 struct buffer *b = XBUFFER (readcharfun); | |
1197 if (BUF_PT (b) == BUF_ZV (b)) | |
1198 continue_reading_p = 0; | |
1199 } | |
1200 } | |
1187 else if (! NILP (Vload_read_function)) | 1201 else if (! NILP (Vload_read_function)) |
1188 val = call1 (Vload_read_function, readcharfun); | 1202 val = call1 (Vload_read_function, readcharfun); |
1189 else | 1203 else |
1190 val = read0 (readcharfun); | 1204 val = read0 (readcharfun); |
1191 } | 1205 } |
1192 | 1206 |
1193 val = (*evalfun) (val); | 1207 val = (*evalfun) (val); |
1208 | |
1194 if (printflag) | 1209 if (printflag) |
1195 { | 1210 { |
1196 Vvalues = Fcons (val, Vvalues); | 1211 Vvalues = Fcons (val, Vvalues); |
1197 if (EQ (Vstandard_output, Qt)) | 1212 if (EQ (Vstandard_output, Qt)) |
1198 Fprin1 (val, Qnil); | 1213 Fprin1 (val, Qnil); |