comparison src/lread.c @ 20691:cf1919e207ef

(unreadchar): For unreading an ASCII char thru a buffer or marker, really decrement point or the marker position.
author Richard M. Stallman <rms@gnu.org>
date Wed, 21 Jan 1998 00:37:15 +0000
parents fa76057543dd
children d43ba5d91281
comparison
equal deleted inserted replaced
20690:a51c71dd5cda 20691:cf1919e207ef
266 if (c == -1) 266 if (c == -1)
267 /* Don't back up the pointer if we're unreading the end-of-input mark, 267 /* Don't back up the pointer if we're unreading the end-of-input mark,
268 since readchar didn't advance it when we read it. */ 268 since readchar didn't advance it when we read it. */
269 ; 269 ;
270 else if (BUFFERP (readcharfun)) 270 else if (BUFFERP (readcharfun))
271 readchar_backlog++; 271 {
272 if (!SINGLE_BYTE_CHAR_P (c))
273 readchar_backlog++;
274 else
275 {
276 struct buffer *b = XBUFFER (readcharfun);
277 int bytepos = BUF_PT_BYTE (b);
278
279 BUF_PT (b)--;
280 if (! NILP (b->enable_multibyte_characters))
281 BUF_DEC_POS (b, bytepos);
282 else
283 bytepos--;
284
285 BUF_PT_BYTE (b) = bytepos;
286 }
287 }
272 else if (MARKERP (readcharfun)) 288 else if (MARKERP (readcharfun))
273 readchar_backlog++; 289 {
290 if (!SINGLE_BYTE_CHAR_P (c))
291 readchar_backlog++;
292 else
293 {
294 struct buffer *b = XMARKER (readcharfun)->buffer;
295 int bytepos = XMARKER (readcharfun)->bytepos;
296
297 XMARKER (readcharfun)->charpos--;
298 if (! NILP (b->enable_multibyte_characters))
299 BUF_DEC_POS (b, bytepos);
300 else
301 bytepos--;
302
303 XMARKER (readcharfun)->bytepos = bytepos;
304 }
305 }
274 else if (STRINGP (readcharfun)) 306 else if (STRINGP (readcharfun))
275 read_from_string_index--; 307 read_from_string_index--;
276 else if (EQ (readcharfun, Qget_file_char)) 308 else if (EQ (readcharfun, Qget_file_char))
277 ungetc (c, instream); 309 ungetc (c, instream);
278 else 310 else