diff options
| author | Kenichi Handa | 2002-03-01 01:07:51 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-03-01 01:07:51 +0000 |
| commit | 8f348ed597e29b4ba05b426dba08124623236329 (patch) | |
| tree | 2198a8fd1f173cff8dfd623e69026dfa8a3b83d1 /src/buffer.c | |
| parent | 9d80e8839bb6086ae5b1bf430ea8a3720b4ea849 (diff) | |
| download | emacs-8f348ed597e29b4ba05b426dba08124623236329.tar.gz emacs-8f348ed597e29b4ba05b426dba08124623236329.zip | |
Include "character.h" instead of "charset.h", don't include
"coding.h".
(Fset_buffer_multibyte): Adjuted for UTF-8.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/buffer.c b/src/buffer.c index 49f8f346012..87075e03372 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -45,7 +45,7 @@ extern int errno; | |||
| 45 | #include "window.h" | 45 | #include "window.h" |
| 46 | #include "commands.h" | 46 | #include "commands.h" |
| 47 | #include "buffer.h" | 47 | #include "buffer.h" |
| 48 | #include "charset.h" | 48 | #include "character.h" |
| 49 | #include "region-cache.h" | 49 | #include "region-cache.h" |
| 50 | #include "indent.h" | 50 | #include "indent.h" |
| 51 | #include "blockinput.h" | 51 | #include "blockinput.h" |
| @@ -2085,9 +2085,9 @@ but the contents viewed as characters do change. */) | |||
| 2085 | p = GAP_END_ADDR; | 2085 | p = GAP_END_ADDR; |
| 2086 | stop = Z; | 2086 | stop = Z; |
| 2087 | } | 2087 | } |
| 2088 | if (MULTIBYTE_STR_AS_UNIBYTE_P (p, bytes)) | 2088 | if (ASCII_BYTE_P (*p)) |
| 2089 | p += bytes, pos += bytes; | 2089 | p++, pos++; |
| 2090 | else | 2090 | else if (CHAR_BYTE8_HEAD_P (*p)) |
| 2091 | { | 2091 | { |
| 2092 | c = STRING_CHAR (p, stop - pos); | 2092 | c = STRING_CHAR (p, stop - pos); |
| 2093 | /* Delete all bytes for this 8-bit character but the | 2093 | /* Delete all bytes for this 8-bit character but the |
| @@ -2104,6 +2104,11 @@ but the contents viewed as characters do change. */) | |||
| 2104 | zv -= bytes; | 2104 | zv -= bytes; |
| 2105 | stop = Z; | 2105 | stop = Z; |
| 2106 | } | 2106 | } |
| 2107 | else | ||
| 2108 | { | ||
| 2109 | bytes = BYTES_BY_CHAR_HEAD (*p); | ||
| 2110 | p += bytes, pos += bytes; | ||
| 2111 | } | ||
| 2107 | } | 2112 | } |
| 2108 | if (narrowed) | 2113 | if (narrowed) |
| 2109 | Fnarrow_to_region (make_number (begv), make_number (zv)); | 2114 | Fnarrow_to_region (make_number (begv), make_number (zv)); |
| @@ -2112,11 +2117,11 @@ but the contents viewed as characters do change. */) | |||
| 2112 | { | 2117 | { |
| 2113 | int pt = PT; | 2118 | int pt = PT; |
| 2114 | int pos, stop; | 2119 | int pos, stop; |
| 2115 | unsigned char *p; | 2120 | unsigned char *p, *pend; |
| 2116 | 2121 | ||
| 2117 | /* Be sure not to have a multibyte sequence striding over the GAP. | 2122 | /* Be sure not to have a multibyte sequence striding over the GAP. |
| 2118 | Ex: We change this: "...abc\201 _GAP_ \241def..." | 2123 | Ex: We change this: "...abc\302 _GAP_ \241def..." |
| 2119 | to: "...abc _GAP_ \201\241def..." */ | 2124 | to: "...abc _GAP_ \302\241def..." */ |
| 2120 | 2125 | ||
| 2121 | if (GPT_BYTE > 1 && GPT_BYTE < Z_BYTE | 2126 | if (GPT_BYTE > 1 && GPT_BYTE < Z_BYTE |
| 2122 | && ! CHAR_HEAD_P (*(GAP_END_ADDR))) | 2127 | && ! CHAR_HEAD_P (*(GAP_END_ADDR))) |
| @@ -2137,6 +2142,7 @@ but the contents viewed as characters do change. */) | |||
| 2137 | pos = BEG; | 2142 | pos = BEG; |
| 2138 | stop = GPT; | 2143 | stop = GPT; |
| 2139 | p = BEG_ADDR; | 2144 | p = BEG_ADDR; |
| 2145 | pend = GPT_ADDR; | ||
| 2140 | while (1) | 2146 | while (1) |
| 2141 | { | 2147 | { |
| 2142 | int bytes; | 2148 | int bytes; |
| @@ -2146,10 +2152,11 @@ but the contents viewed as characters do change. */) | |||
| 2146 | if (pos == Z) | 2152 | if (pos == Z) |
| 2147 | break; | 2153 | break; |
| 2148 | p = GAP_END_ADDR; | 2154 | p = GAP_END_ADDR; |
| 2155 | pend = Z_ADDR; | ||
| 2149 | stop = Z; | 2156 | stop = Z; |
| 2150 | } | 2157 | } |
| 2151 | 2158 | ||
| 2152 | if (UNIBYTE_STR_AS_MULTIBYTE_P (p, stop - pos, bytes)) | 2159 | if ((bytes = MULTIBYTE_LENGTH (p, pend)) > 0) |
| 2153 | p += bytes, pos += bytes; | 2160 | p += bytes, pos += bytes; |
| 2154 | else | 2161 | else |
| 2155 | { | 2162 | { |
| @@ -4261,8 +4268,6 @@ buffer_slot_type_mismatch (offset) | |||
| 4261 | #include <fcntl.h> | 4268 | #include <fcntl.h> |
| 4262 | #endif | 4269 | #endif |
| 4263 | 4270 | ||
| 4264 | #include "coding.h" | ||
| 4265 | |||
| 4266 | 4271 | ||
| 4267 | /* Memory is allocated in regions which are mapped using mmap(2). | 4272 | /* Memory is allocated in regions which are mapped using mmap(2). |
| 4268 | The current implementation lets the system select mapped | 4273 | The current implementation lets the system select mapped |