diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-11-18 18:29:49 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-11-18 18:29:49 +0200 |
commit | 37c790b38599cc80a16c6a76152abbf8160fe2a1 (patch) | |
tree | a2f40d0acba8cdcf5c6502f4c07093f138772887 /src/coding.c | |
parent | f2cbfd4442bf194bd277101357a86f96707ec36c (diff) | |
download | emacs-37c790b38599cc80a16c6a76152abbf8160fe2a1.tar.gz emacs-37c790b38599cc80a16c6a76152abbf8160fe2a1.tar.bz2 emacs-37c790b38599cc80a16c6a76152abbf8160fe2a1.zip |
Fix bug #15841 with assertion violations due to newline cache.
src/insdel.c (invalidate_buffer_caches): New function, consolidated
from part of prepare_to_modify_buffer.
(insert_from_gap, prepare_to_modify_buffer):
src/coding.c (code_convert_region, code_convert_string): Call
invalidate_buffer_caches.
src/lisp.h (invalidate_buffer_caches): Add prototype.
Diffstat (limited to 'src/coding.c')
-rw-r--r-- | src/coding.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/coding.c b/src/coding.c index ac828a48683..6c0633f2d93 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9358,6 +9358,14 @@ code_convert_region (Lisp_Object start, Lisp_Object end, setup_coding_system (coding_system, &coding); coding.mode |= CODING_MODE_LAST_BLOCK; + if (BUFFERP (dst_object) && !EQ (dst_object, src_object)) + { + struct buffer *buf = XBUFFER (dst_object); + ptrdiff_t buf_pt = BUF_PT (buf); + + invalidate_buffer_caches (buf, buf_pt, buf_pt); + } + if (encodep) encode_coding_object (&coding, src_object, from, from_byte, to, to_byte, dst_object); @@ -9447,6 +9455,15 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system, coding.mode |= CODING_MODE_LAST_BLOCK; chars = SCHARS (string); bytes = SBYTES (string); + + if (BUFFERP (dst_object)) + { + struct buffer *buf = XBUFFER (dst_object); + ptrdiff_t buf_pt = BUF_PT (buf); + + invalidate_buffer_caches (buf, buf_pt, buf_pt); + } + if (encodep) encode_coding_object (&coding, string, 0, 0, chars, bytes, dst_object); else |