From 8bc369d4a23a3a8040d77e3ce89a7f63b1ecff97 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 22 Mar 2013 00:18:44 +0900 Subject: [PATCH] Fix a bug introduced by 2013-03-15T16:06:12Z!handa@gnu.org. --- src/ChangeLog | 6 ++++++ src/coding.c | 2 +- src/insdel.c | 15 +++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2779e5a6ea8..2498bc8c974 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-03-21 Kenichi Handa + + * coding.c (syms_of_coding): Cancel previous change. + + * insdel.c (insert_from_gap): Fix previous change. + 2013-03-20 Kenichi Handa * coding.c (syms_of_coding): Initialize disable_ascii_optimization diff --git a/src/coding.c b/src/coding.c index cb81375a043..8a09cd67859 100644 --- a/src/coding.c +++ b/src/coding.c @@ -10877,7 +10877,7 @@ decode text as usual. */); DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. Internal use only. Removed after the experimental optimizer gets stable. */); - disable_ascii_optimization = 1; + disable_ascii_optimization = 0; DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input, doc: /* Char table for translating self-inserting characters. diff --git a/src/insdel.c b/src/insdel.c index a60fed0c32e..3dd81ffeb62 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -983,6 +983,9 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, void insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail) { + int ins_charpos = GPT; + int ins_bytepos = GPT_BYTE; + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nchars = nbytes; @@ -1003,18 +1006,18 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail) eassert (GPT <= GPT_BYTE); - adjust_overlays_for_insert (GPT - nchars, nchars); - adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, - GPT, GPT_BYTE, 0); + adjust_overlays_for_insert (ins_charpos, nchars); + adjust_markers_for_insert (ins_charpos, ins_bytepos, + ins_charpos + nchars, ins_bytepos + nbytes, 0); if (buffer_intervals (current_buffer)) { - offset_intervals (current_buffer, GPT - nchars, nchars); - graft_intervals_into_buffer (NULL, GPT - nchars, nchars, + offset_intervals (current_buffer, ins_charpos, nchars); + graft_intervals_into_buffer (NULL, ins_charpos, nchars, current_buffer, 0); } - if (! text_at_gap_tail && GPT - nchars < PT) + if (ins_charpos < PT) adjust_point (nchars, nbytes); check_markers (); -- 2.39.2