NEXT;
CASE (Bchar_syntax):
- {
- CHECK_CHARACTER (TOP);
- int c = XFIXNAT (TOP);
- if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
- c = make_char_multibyte (c);
- XSETFASTINT (TOP, syntax_code_spec[SYNTAX (c)]);
- }
+ TOP = Fchar_syntax (TOP);
NEXT;
CASE (Bbuffer_substring):
`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)]);
}
(should (parse-partial-sexp 1 1))
(should-error (parse-partial-sexp 2 1))))
+(ert-deftest syntax-char-syntax ()
+ ;; Verify that char-syntax behaves identically in interpreted and
+ ;; byte-compiled code (bug#53260).
+ (let ((cs (byte-compile (lambda (x) (char-syntax x)))))
+ ;; Use a unibyte buffer with a syntax table using symbol syntax
+ ;; for raw byte 128.
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (let ((st (make-syntax-table)))
+ (modify-syntax-entry (unibyte-char-to-multibyte 128) "_" st)
+ (set-syntax-table st)
+ (should (equal (eval '(char-syntax 128) t) ?_))
+ (should (equal (funcall cs 128) ?_))))
+ (list (char-syntax 128) (funcall cs 128))))
+
;;; syntax-tests.el ends here