diff options
| author | Mattias EngdegÄrd | 2022-01-16 11:58:00 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2022-01-20 11:44:07 +0100 |
| commit | b929bdaeb6bcb919d4d1a5d02713cdcac3fc44d0 (patch) | |
| tree | 8b0ee1ce3c8a355b67ac46ee26c3ec064997afc6 /src | |
| parent | b1488a6582d8557e3e3fd894d81bab165d4aca77 (diff) | |
| download | emacs-b929bdaeb6bcb919d4d1a5d02713cdcac3fc44d0.tar.gz emacs-b929bdaeb6bcb919d4d1a5d02713cdcac3fc44d0.zip | |
Fix Fchar_syntax for non-ASCII in unibyte buffers
Fchar_syntax did not convert unibyte characters to multibyte when the
current buffer was unibyte, in contrast to `char-syntax` in
byte-compiled code (bug#53260).
* src/bytecode.c (exec_byte_code): Call out to Fchar_syntax;
the dynamic frequency is too low to justify inlining here, and it
did lead to implementations diverging.
* src/syntax.c (Fchar_syntax): Convert non-ASCII unibyte values to
multibyte.
* test/src/syntax-tests.el (syntax-char-syntax): New test.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bytecode.c | 8 | ||||
| -rw-r--r-- | src/syntax.c | 5 |
2 files changed, 4 insertions, 9 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index 472992be180..b7e65d05aef 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -1167,13 +1167,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1167 | NEXT; | 1167 | NEXT; |
| 1168 | 1168 | ||
| 1169 | CASE (Bchar_syntax): | 1169 | CASE (Bchar_syntax): |
| 1170 | { | 1170 | TOP = Fchar_syntax (TOP); |
| 1171 | CHECK_CHARACTER (TOP); | ||
| 1172 | int c = XFIXNAT (TOP); | ||
| 1173 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) | ||
| 1174 | c = make_char_multibyte (c); | ||
| 1175 | XSETFASTINT (TOP, syntax_code_spec[SYNTAX (c)]); | ||
| 1176 | } | ||
| 1177 | NEXT; | 1171 | NEXT; |
| 1178 | 1172 | ||
| 1179 | CASE (Bbuffer_substring): | 1173 | CASE (Bbuffer_substring): |
diff --git a/src/syntax.c b/src/syntax.c index 9df878b8edf..13c36fdf3cd 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -1101,10 +1101,11 @@ this is probably the wrong function to use, because it can't take | |||
| 1101 | `syntax-after' instead. */) | 1101 | `syntax-after' instead. */) |
| 1102 | (Lisp_Object character) | 1102 | (Lisp_Object character) |
| 1103 | { | 1103 | { |
| 1104 | int char_int; | ||
| 1105 | CHECK_CHARACTER (character); | 1104 | CHECK_CHARACTER (character); |
| 1106 | char_int = XFIXNUM (character); | 1105 | int char_int = XFIXNAT (character); |
| 1107 | SETUP_BUFFER_SYNTAX_TABLE (); | 1106 | SETUP_BUFFER_SYNTAX_TABLE (); |
| 1107 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) | ||
| 1108 | char_int = make_char_multibyte (char_int); | ||
| 1108 | return make_fixnum (syntax_code_spec[SYNTAX (char_int)]); | 1109 | return make_fixnum (syntax_code_spec[SYNTAX (char_int)]); |
| 1109 | } | 1110 | } |
| 1110 | 1111 | ||