bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#52459: 28.0.90; prin1-to-string does not escape bidi control charact


From: Eli Zaretskii
Subject: bug#52459: 28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t
Date: Mon, 13 Dec 2021 17:24:41 +0200

> From: Daniel Mendler <mail@daniel-mendler.de>
> Cc: 52459@debbugs.gnu.org
> Date: Mon, 13 Dec 2021 14:30:13 +0100
> 
> In other words, there is a need for a functionality which makes it
> possible to turn a string into a string literal in a form which could be
> used in source code for example.
> 
> If you look at the definition of bidi-directional-controls-chars in
> simple.el, the bidi characters are escaped there. Why is this? Why did
> you write this definition in this form and not with unescaped bidi
> characters?
> 
> (defvar bidi-directional-controls-chars "\x202a-\x202e\x2066-\x2069"
>   "Character set that matches bidirectional formatting control characters.")

So you want a feature that would produce strings suitable for using in
program source files, like we did in the above example?  Is that the
meaning of "sanitize" you have been using?

Are there other use cases for those "escaped" or "sanitized" strings?
If so, please describe them as well.

Or if that's not the correct meaning of "sanitized", please define it
more accurately.

You see, this discussion is hard because I still don't understand what
is it that you want Emacs to provide, and for what purposes.  Please
try to clarify that, to make the discussion more efficient and avoid
misunderstandings.

For now, I understand that those strings are not necessarily required
to be readable on the Emacs display, at least not in all cases,
because some of the reordering that these controls produce will be
disabled when they are represented by ASCII escapes, and the character
order on display will change as result.  If the string includes RTL
characters, the result might not be easily readable.  But AFAIU, this
is not a problem for the use cases you have in mind?

> Therefore my proposal to add two variables
> `print-escape-ascii-control-characters` and
> `print-escape-unicode-control-characters`.

I'd prefer to wait with concrete proposals until the requirements are
clear.  It seems like a variable like those you mention, which only
affect the Emacs display, but not the string contents, is not what you
need.  You need to actually produce the ASCII characters \x2023a, so
that you could put them in a string like you show above.  Or am I
misunderstanding again?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]