all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 27270@debbugs.gnu.org, v.schneidermann@gmail.com,
	npostavs@users.sourceforge.net
Subject: bug#27270: display-raw-bytes-as-hex generates ambiguous output for Emacs strings
Date: Sun, 11 Jun 2017 17:48:04 +0300	[thread overview]
Message-ID: <83r2yq60nv.fsf@gnu.org> (raw)
In-Reply-To: <a69c6508-4b01-d859-5ff8-5417659c6127@cs.ucla.edu> (message from Paul Eggert on Sat, 10 Jun 2017 17:04:40 -0700)

> Cc: npostavs@users.sourceforge.net, 27270@debbugs.gnu.org,
>  v.schneidermann@gmail.com
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sat, 10 Jun 2017 17:04:40 -0700
> 
> On 06/10/2017 12:24 AM, Eli Zaretskii wrote:
> > So your proposal would mean a change to the Lisp reader to support
> > such escapes, right?  If so, isn't such a change
> > backward-incompatible?
> 
> Yes, but only in the sense that undocumented escapes evaluate to 
> themselves, e.g., "\F" is currently the same as "F" in Emacs Lisp 
> because there is no escape sequence \F currently defined for character 
> constants. But there's nothing new here, e.g., when we added "\N{...}" 
> last year we changed the interpretation of the formerly-undocumented \N 
> escape.

Then maybe the new hex display should use the \N{U+nnn} format?

> >> Also, display-raw-bytes-as-hex would cause raw bytes to be displayed with this
> >> new X escape, rather than with with the x escape.
> > It could only do that for codepoints below 256 decimal, so that
> > limitation should be taken into account when deciding on the proposal.
> 
> Ouch, I hadn't thought of that.
> 
> Wait -- doesn't that mean that "display-raw-bytes-as-hex" is a 
> misleading name, because it affects the display not only of raw bytes, 
> but of other undisplayable characters?

That's true, but since the chances of a _user_ changing the
printable-chars char-table are pretty slim, I didn't think it was
justified to obfuscate the name.

> Shouldn't we change its name to 
> something more generic and more accurate, like "display-characters-as-hex"?

Codepoints whose printable-chars entry is nil cannot in good faith be
called "characters", IMO.  "Codepoints", maybe?  But again, that makes
the discoverability harder, so I'm not sure it's worth the hassle.

> Anyway, to address the point you raised: how about a different idea? We 
> extend the existing \x syntax in strings so that \x{dddd} has the same 
> meaning as "\xdddd", except that the "}" terminates the escape. This 
> syntax is used by Perl and so is in the same family as \N{...}. We also 
> change display-raw-bytes-as-hex to use this new syntax when a character 
> is immediately followed by a hexadecimal digit. That way, most 
> characters are displayed as before, but my problematic example is 
> displayed as "x\x{90}5y", which is a good visual cue of the unusual 
> situation.

See above: why not \N{U+...}?  The only downside is that it's much
longer than \xNN.  Could be another option, perhaps.





  reply	other threads:[~2017-06-11 14:48 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07  3:57 bug#27270: display-raw-bytes-as-hex generates ambiguous output for Emacs strings Paul Eggert
2017-06-07  5:17 ` Eli Zaretskii
2017-06-08  0:49   ` Paul Eggert
2017-06-08  1:07     ` npostavs
2017-06-08 15:20       ` Eli Zaretskii
2017-06-08 15:56       ` Paul Eggert
2017-06-08 16:11         ` Eli Zaretskii
2017-06-08 16:24           ` Paul Eggert
2017-06-08 18:59             ` Eli Zaretskii
2017-06-08 19:43               ` Paul Eggert
2017-06-08 19:56                 ` Eli Zaretskii
2017-06-08 20:35                   ` Paul Eggert
2017-06-09  6:00                     ` Eli Zaretskii
2017-06-09 23:44                       ` Paul Eggert
2017-06-10  7:24                         ` Eli Zaretskii
2017-06-11  0:04                           ` Paul Eggert
2017-06-11 14:48                             ` Eli Zaretskii [this message]
2017-06-11 17:26                               ` Paul Eggert
2017-09-02 13:25                                 ` Eli Zaretskii
2022-04-23 14:00                         ` Lars Ingebrigtsen
2022-04-24  7:10                           ` Paul Eggert
2022-04-24  9:56                             ` Vasilij Schneidermann
2022-04-24 10:26                               ` Andreas Schwab
2022-04-24 10:51                                 ` Vasilij Schneidermann
2022-04-24 11:01                                   ` Andreas Schwab
2022-04-24 11:29                                     ` Lars Ingebrigtsen
2022-04-24 22:46                               ` Paul Eggert
2022-04-24 11:24                             ` Lars Ingebrigtsen
2022-04-24 22:35                               ` Paul Eggert
2022-04-25  7:40                                 ` Lars Ingebrigtsen
2022-04-25 16:49                                   ` Paul Eggert
2022-04-26 10:06                                     ` Lars Ingebrigtsen
2022-04-26 16:48                                       ` Paul Eggert
2022-04-27 12:13                                         ` Lars Ingebrigtsen
2022-04-27 17:21                                           ` Paul Eggert
2022-04-27 17:22                                             ` Lars Ingebrigtsen
2022-04-28 17:58                                               ` Paul Eggert
2017-06-10 22:52         ` npostavs
2017-06-11  0:10           ` Paul Eggert

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=83r2yq60nv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=27270@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=npostavs@users.sourceforge.net \
    --cc=v.schneidermann@gmail.com \
    /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.