all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 55738@debbugs.gnu.org
Subject: bug#55738: character escape bugs in the reader
Date: Tue, 31 May 2022 13:33:09 +0200	[thread overview]
Message-ID: <20BC6F3C-1C72-4469-946D-8B9583C73024@acm.org> (raw)

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.






             reply	other threads:[~2022-05-31 11:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 11:33 Mattias Engdegård [this message]
2022-06-01 10:00 ` bug#55738: character escape bugs in the reader 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20BC6F3C-1C72-4469-946D-8B9583C73024@acm.org \
    --to=mattiase@acm.org \
    --cc=55738@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.