From 572eed83fcce65c3f81cbbfd777f5020bed1d81a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 14 Nov 2021 12:56:11 -0500 Subject: [PATCH] * src/lread.c (read_escape): Fix handling of ?\C- for chars 128-255 --- src/lread.c | 2 +- test/src/lread-tests.el | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lread.c b/src/lread.c index 3052bcbd063..2e63ec48912 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2709,7 +2709,7 @@ read_escape (Lisp_Object readcharfun, bool stringp) c = read_escape (readcharfun, 0); if ((c & ~CHAR_MODIFIER_MASK) == '?') return 0177 | (c & CHAR_MODIFIER_MASK); - else if (! SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK))) + else if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK))) return c | ctrl_modifier; /* ASCII control chars are made from letters (both cases), as well as the non-letters within 0100...0137. */ diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index be685fe999f..c635c592b28 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -115,6 +115,10 @@ (should-error (read "#24r") :type 'invalid-read-syntax) (should-error (read "#") :type 'invalid-read-syntax)) +(ert-deftest lread-char-modifiers () + (should (eq ?\C-\M-é (+ (- ?\M-a ?a) ?\C-é))) + (should (eq (- ?\C-ŗ ?ŗ) (- ?\C-é ?é)))) + (ert-deftest lread-record-1 () (should (equal '(#s(foo) #s(foo)) (read "(#1=#s(foo) #1#)")))) -- 2.39.5