[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55738: character escape bugs in the reader
From: |
Mattias Engdegård |
Subject: |
bug#55738: character escape bugs in the reader |
Date: |
Tue, 31 May 2022 13:33:09 +0200 |
Some character escape oddities observed in the Emacs reader:
1. ?\LF => -1
This is clearly a bug (no character literal should be -1) and an artefact of
the underlying implementation.
The correct value should be 10.
(In string literals \LF is ignored entirely, as documented.)
2. The Control modifier (\C- or \^) is nonidempotent. For example,
?\C-a => 1
?\C-\C-a => #x4000001
Similarly, "\C-\C-a" signals a reader error.
This too is an artefact of the implementation. The correct value should be as
if only a single control modifier were present, eg. ?\C-\C-a => 1.
3. Control-space yields NUL in strings but not as a char literal:
"\C-SPC" => "NUL"
"\^SPC" => "NUL"
?\C-SPC => #x4000020
?\^SPC => #x4000020
Emacs takes a conservative stance and normally only generates control
characters from upper and lower case ASCII letters and the symbols ?@[\]^_
because that agrees with custom and suffices for all C0 controls. Since most
terminals also map Control-SPC to NUL, it would be more consistent to do so in
both string and character literals.
The first two bugs are straightforward to fix (I have a patch) and doing so is
unlikely to cause any harm.
I honestly don't think making ?\C-SPC => 0 would either (because of how key
binding words) but we should investigate further just in case.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#55738: character escape bugs in the reader,
Mattias Engdegård <=