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: Dmitry Gutov
Subject: bug#52459: 28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t
Date: Tue, 14 Dec 2021 21:40:50 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 14.12.2021 21:32, Daniel Mendler wrote:
On 12/14/21 7:23 PM, Dmitry Gutov wrote:
I just did a little testing, and it seems
'print-escape-control-characters' only affects 'prin1-to-string' and
'prin1' but not 'message' or 'format'.
No, `print-escape-multibyte` also applies to `format  and `message`. Try
the following:

(let ((print-escape-multibyte t))
   (format "%S" bidi-directional-controls-chars)
   (message "%S" bidi-directional-controls-chars))

This is interesting, because print-escape-control-characters (which I mentioned) does not:

ELISP> (let ((print-escape-control-characters t)) (prin1 "\b"))

"\10"
""
ELISP> (let ((print-escape-control-characters t)) (prin1-to-string "\b"))
"\"\\10\""
ELISP> (let ((print-escape-control-characters t)) (format "\b"))
""
ELISP> (let ((print-escape-control-characters t)) (message "\b"))
""

>> Is that a problem?
>>
>> If not, adding a new variable which makes the same distinction seems
>> consistent with the current design.
> Exactly. My proposal is consistent with the current design.

...but indeed if the new variable has the same scope as either of the existing ones, it seems easy to justify.

Maybe reconcile the scopes of the existing vars, too. 'print-escape-multibyte' is documented as "This affects only ‘prin1’", but it is the other var which makes the distinction.





reply via email to

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