unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55738: character escape bugs in the reader
@ 2022-05-31 11:33 Mattias Engdegård
  2022-06-01 10:00 ` Mattias Engdegård
  0 siblings, 1 reply; 12+ messages in thread
From: Mattias Engdegård @ 2022-05-31 11:33 UTC (permalink / raw)
  To: 55738

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.






^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-09-06  1:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 11:33 bug#55738: character escape bugs in the reader Mattias Engdegård
2022-06-01 10:00 ` Mattias Engdegård
2022-06-01 13:42   ` Lars Ingebrigtsen
2022-06-01 17:56     ` Mattias Engdegård
2022-06-01 20:48       ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-01 20:53         ` Mattias Engdegård
2022-06-01 21:05           ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-02 15:12             ` Mattias Engdegård
2022-06-03 11:07               ` Mattias Engdegård
2022-06-18  6:54               ` Stefan Kangas
2022-06-18  9:34                 ` Mattias Engdegård
2023-09-06  1:56                   ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).