summaryrefslogtreecommitdiff
path: root/src/syntax.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2022-01-16 11:58:00 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2022-01-20 11:44:07 +0100
commitb929bdaeb6bcb919d4d1a5d02713cdcac3fc44d0 (patch)
tree8b0ee1ce3c8a355b67ac46ee26c3ec064997afc6 /src/syntax.c
parentb1488a6582d8557e3e3fd894d81bab165d4aca77 (diff)
downloademacs-b929bdaeb6bcb919d4d1a5d02713cdcac3fc44d0.tar.gz
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/syntax.c')
-rw-r--r--src/syntax.c5
1 files changed, 3 insertions, 2 deletions
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
`syntax-after' instead. */)
(Lisp_Object character)
{
- int char_int;
CHECK_CHARACTER (character);
- char_int = XFIXNUM (character);
+ int char_int = XFIXNAT (character);
SETUP_BUFFER_SYNTAX_TABLE ();
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
+ char_int = make_char_multibyte (char_int);
return make_fixnum (syntax_code_spec[SYNTAX (char_int)]);
}