emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116195: Fix bug#16286 by the different way than rev


From: Kenichi Handa
Subject: [Emacs-diffs] trunk r116195: Fix bug#16286 by the different way than revno:116158 to preserve the code detection behavior of 24.3.
Date: Wed, 29 Jan 2014 13:39:51 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116195 [merge]
revision-id: address@hidden
parent: address@hidden
parent: address@hidden
committer: K. Handa <address@hidden>
branch nick: trunk
timestamp: Wed 2014-01-29 22:39:42 +0900
message:
  Fix bug#16286 by the different way than revno:116158 to preserve the code 
detection behavior of 24.3.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/coding.c                   coding.c-20091113204419-o5vbwnq5f7feedwu-1077
  src/coding.h                   coding.h-20091113204419-o5vbwnq5f7feedwu-1078
  src/fileio.c                   fileio.c-20091113204419-o5vbwnq5f7feedwu-210
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-01-29 10:29:14 +0000
+++ b/src/ChangeLog     2014-01-29 13:39:00 +0000
@@ -1,3 +1,16 @@
+2014-01-27  K. Handa  <address@hidden>
+
+       Fix bug#16286 by the different way than revno:116158 to preserve
+       the code detection behavior of 24.3.
+
+       * coding.h (struct coding_system): New member detected_utf8_bytes.
+
+       * coding.c (detect_coding_utf_8): Set coding->detected_utf8_bytes.
+       (decode_coding_gap): Use short cut for UTF-8 file reading only
+       when coding->detected_utf8_bytes equals to coding->src_bytes.
+
+       * fileio.c (Finsert_file_contents): Cancel the previous change.
+
 2014-01-29  Martin Rudalics  <address@hidden>
 
        * w32fns.c (x_set_tool_bar_lines): Don't clear area on frames

=== modified file 'src/coding.c'
--- a/src/coding.c      2014-01-26 01:20:24 +0000
+++ b/src/coding.c      2014-01-29 13:21:25 +0000
@@ -1300,6 +1300,7 @@
           means that we found a valid non-ASCII characters.  */
        detect_info->found |= CATEGORY_MASK_UTF_8_AUTO | 
CATEGORY_MASK_UTF_8_NOSIG;
     }
+  coding->detected_utf8_bytes = src_base - coding->source;
   coding->detected_utf8_chars = nchars;
   return 1;
 }
@@ -7890,7 +7891,7 @@
   coding->dst_multibyte = ! NILP (BVAR (current_buffer, 
enable_multibyte_characters));
 
   coding->head_ascii = -1;
-  coding->detected_utf8_chars = -1;
+  coding->detected_utf8_bytes = coding->detected_utf8_chars = -1;
   coding->eol_seen = EOL_SEEN_NONE;
   if (CODING_REQUIRE_DETECTION (coding))
     detect_coding (coding);
@@ -7907,7 +7908,8 @@
       if (chars != bytes)
        {
          /* There exists a non-ASCII byte.  */
-         if (EQ (CODING_ATTR_TYPE (attrs), Qutf_8))
+         if (EQ (CODING_ATTR_TYPE (attrs), Qutf_8)
+             && coding->detected_utf8_bytes == coding->src_bytes)
            {
              if (coding->detected_utf8_chars >= 0)
                chars = coding->detected_utf8_chars;

=== modified file 'src/coding.h'
--- a/src/coding.h      2014-01-26 01:20:24 +0000
+++ b/src/coding.h      2014-01-29 13:21:25 +0000
@@ -468,7 +468,9 @@
      the eol format.  */
   ptrdiff_t head_ascii;
 
-  ptrdiff_t detected_utf8_chars;
+  /* How many bytes/chars at the source are detected as valid utf-8
+     sequence.  Set by detect_coding_utf_8.  */
+  ptrdiff_t detected_utf8_bytes, detected_utf8_chars;
 
   /* Used internally in coding.c.  See the comment of detect_ascii.  */
   int eol_seen;

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2014-01-26 00:32:30 +0000
+++ b/src/fileio.c      2014-01-29 13:21:25 +0000
@@ -4298,7 +4298,6 @@
       Z_BYTE -= inserted;
       ZV -= inserted;
       Z -= inserted;
-      coding.mode |= CODING_MODE_LAST_BLOCK;
       decode_coding_gap (&coding, inserted, inserted);
       inserted = coding.produced_char;
       coding_system = CODING_ID_NAME (coding.id);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]