diff options
| author | Richard M. Stallman | 1998-01-21 00:37:15 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-01-21 00:37:15 +0000 |
| commit | d7760ca97f7c98eb97e10be4b3ff8c6cef01e0cf (patch) | |
| tree | 7790610663a0bbe086c3a58e4e1457410832d408 | |
| parent | 1d01033382e390e3ed8527a51d8c7d039a1a374f (diff) | |
| download | emacs-d7760ca97f7c98eb97e10be4b3ff8c6cef01e0cf.tar.gz emacs-d7760ca97f7c98eb97e10be4b3ff8c6cef01e0cf.zip | |
(unreadchar): For unreading an ASCII char
thru a buffer or marker, really decrement point or the marker position.
| -rw-r--r-- | src/lread.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/lread.c b/src/lread.c index e69e3f86943..144f991223f 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -268,9 +268,41 @@ unreadchar (readcharfun, c) | |||
| 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)) |