mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-10 05:30:45 -08:00
(unreadchar): For unreading an ASCII char
thru a buffer or marker, really decrement point or the marker position.
This commit is contained in:
parent
1d01033382
commit
d7760ca97f
1 changed files with 34 additions and 2 deletions
36
src/lread.c
36
src/lread.c
|
|
@ -268,9 +268,41 @@ unreadchar (readcharfun, c)
|
|||
since readchar didn't advance it when we read it. */
|
||||
;
|
||||
else if (BUFFERP (readcharfun))
|
||||
readchar_backlog++;
|
||||
{
|
||||
if (!SINGLE_BYTE_CHAR_P (c))
|
||||
readchar_backlog++;
|
||||
else
|
||||
{
|
||||
struct buffer *b = XBUFFER (readcharfun);
|
||||
int bytepos = BUF_PT_BYTE (b);
|
||||
|
||||
BUF_PT (b)--;
|
||||
if (! NILP (b->enable_multibyte_characters))
|
||||
BUF_DEC_POS (b, bytepos);
|
||||
else
|
||||
bytepos--;
|
||||
|
||||
BUF_PT_BYTE (b) = bytepos;
|
||||
}
|
||||
}
|
||||
else if (MARKERP (readcharfun))
|
||||
readchar_backlog++;
|
||||
{
|
||||
if (!SINGLE_BYTE_CHAR_P (c))
|
||||
readchar_backlog++;
|
||||
else
|
||||
{
|
||||
struct buffer *b = XMARKER (readcharfun)->buffer;
|
||||
int bytepos = XMARKER (readcharfun)->bytepos;
|
||||
|
||||
XMARKER (readcharfun)->charpos--;
|
||||
if (! NILP (b->enable_multibyte_characters))
|
||||
BUF_DEC_POS (b, bytepos);
|
||||
else
|
||||
bytepos--;
|
||||
|
||||
XMARKER (readcharfun)->bytepos = bytepos;
|
||||
}
|
||||
}
|
||||
else if (STRINGP (readcharfun))
|
||||
read_from_string_index--;
|
||||
else if (EQ (readcharfun, Qget_file_char))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue