aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2014-01-29 22:21:25 +0900
committerKenichi Handa2014-01-29 22:21:25 +0900
commit52840a9cc870d3e8946b6edebe2b0a0a23d23cec (patch)
tree29612750f2c3c31f51a7e81bcddb5fc2589143f7 /src
parent4988180d710ad2ed9c0d9211dca9d9ef23c46716 (diff)
downloademacs-52840a9cc870d3e8946b6edebe2b0a0a23d23cec.tar.gz
emacs-52840a9cc870d3e8946b6edebe2b0a0a23d23cec.zip
Fix bug#16286 by the different way than 2014-01-26T00:32:30Z!eggert@cs.ucla.edu to preserve the code detection behavior of 24.3.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/coding.c6
-rw-r--r--src/coding.h4
-rw-r--r--src/fileio.c1
4 files changed, 20 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4ed9ef9d2cf..aa3a65ccb60 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12014-01-27 K. Handa <handa@gnu.org>
2
3 Fix bug#16286 by the different way than revno:116158 to preserve
4 the code detection behavior of 24.3.
5
6 * coding.h (struct coding_system): New member detected_utf8_bytes.
7
8 * coding.c (detect_coding_utf_8): Set coding->detected_utf8_bytes.
9 (decode_coding_gap): Use short cut for UTF-8 file reading only
10 when coding->detected_utf8_bytes equals to coding->src_bytes.
11
12 * fileio.c (Finsert_file_contents): Cancel the previous change.
13
12014-01-26 Jan Djärv <jan.h.d@swipnet.se> 142014-01-26 Jan Djärv <jan.h.d@swipnet.se>
2 15
3 * xterm.c (x_focus_changed): Check for non-X terminal-frame (Bug#16540) 16 * xterm.c (x_focus_changed): Check for non-X terminal-frame (Bug#16540)
diff --git a/src/coding.c b/src/coding.c
index 01964eba4d3..654e39c0e3d 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1300,6 +1300,7 @@ detect_coding_utf_8 (struct coding_system *coding,
1300 means that we found a valid non-ASCII characters. */ 1300 means that we found a valid non-ASCII characters. */
1301 detect_info->found |= CATEGORY_MASK_UTF_8_AUTO | CATEGORY_MASK_UTF_8_NOSIG; 1301 detect_info->found |= CATEGORY_MASK_UTF_8_AUTO | CATEGORY_MASK_UTF_8_NOSIG;
1302 } 1302 }
1303 coding->detected_utf8_bytes = src_base - coding->source;
1303 coding->detected_utf8_chars = nchars; 1304 coding->detected_utf8_chars = nchars;
1304 return 1; 1305 return 1;
1305} 1306}
@@ -7890,7 +7891,7 @@ decode_coding_gap (struct coding_system *coding,
7890 coding->dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); 7891 coding->dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
7891 7892
7892 coding->head_ascii = -1; 7893 coding->head_ascii = -1;
7893 coding->detected_utf8_chars = -1; 7894 coding->detected_utf8_bytes = coding->detected_utf8_chars = -1;
7894 coding->eol_seen = EOL_SEEN_NONE; 7895 coding->eol_seen = EOL_SEEN_NONE;
7895 if (CODING_REQUIRE_DETECTION (coding)) 7896 if (CODING_REQUIRE_DETECTION (coding))
7896 detect_coding (coding); 7897 detect_coding (coding);
@@ -7907,7 +7908,8 @@ decode_coding_gap (struct coding_system *coding,
7907 if (chars != bytes) 7908 if (chars != bytes)
7908 { 7909 {
7909 /* There exists a non-ASCII byte. */ 7910 /* There exists a non-ASCII byte. */
7910 if (EQ (CODING_ATTR_TYPE (attrs), Qutf_8)) 7911 if (EQ (CODING_ATTR_TYPE (attrs), Qutf_8)
7912 && coding->detected_utf8_bytes == coding->src_bytes)
7911 { 7913 {
7912 if (coding->detected_utf8_chars >= 0) 7914 if (coding->detected_utf8_chars >= 0)
7913 chars = coding->detected_utf8_chars; 7915 chars = coding->detected_utf8_chars;
diff --git a/src/coding.h b/src/coding.h
index c9c19762d80..4e8b1056e43 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -468,7 +468,9 @@ struct coding_system
468 the eol format. */ 468 the eol format. */
469 ptrdiff_t head_ascii; 469 ptrdiff_t head_ascii;
470 470
471 ptrdiff_t detected_utf8_chars; 471 /* How many bytes/chars at the source are detected as valid utf-8
472 sequence. Set by detect_coding_utf_8. */
473 ptrdiff_t detected_utf8_bytes, detected_utf8_chars;
472 474
473 /* Used internally in coding.c. See the comment of detect_ascii. */ 475 /* Used internally in coding.c. See the comment of detect_ascii. */
474 int eol_seen; 476 int eol_seen;
diff --git a/src/fileio.c b/src/fileio.c
index 22db4602249..d03a2bcf02f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4298,7 +4298,6 @@ by calling `format-decode', which see. */)
4298 Z_BYTE -= inserted; 4298 Z_BYTE -= inserted;
4299 ZV -= inserted; 4299 ZV -= inserted;
4300 Z -= inserted; 4300 Z -= inserted;
4301 coding.mode |= CODING_MODE_LAST_BLOCK;
4302 decode_coding_gap (&coding, inserted, inserted); 4301 decode_coding_gap (&coding, inserted, inserted);
4303 inserted = coding.produced_char; 4302 inserted = coding.produced_char;
4304 coding_system = CODING_ID_NAME (coding.id); 4303 coding_system = CODING_ID_NAME (coding.id);