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 14:22:35 +0200

> From: Daniel Mendler <mail@daniel-mendler.de>
> Cc: 52459@debbugs.gnu.org
> Date: Sun, 12 Dec 2021 22:33:50 +0100
> 
> On 12/12/21 10:11 PM, Daniel Mendler wrote:
> > Example packages which are affected by this issue are for example the
> > Helpful package, which provides an enhanced Help buffer. Another package
> > affected by the issue is the Marginalia package which adds annotations
> > to `describe-variable` in the minibuffer. The annotations show the
> > variable value. I would like to print the variable values in a safe way
> > which does not mess up the display. Instead of "string" these packages
> > show "str"gnandallthatfollowsisgarbage. How is this supposed to be done?
> > 
> > I propose the addition of an additional variable which configures
> > prin1-string such that all control characters which affect the display
> > in special ways are escaped. Is there an alternative approach to achieve
> > this goal?
> 
> There is actually one function which comes close in functionality -
> `bidi-string-mark-left-to-right`. However this function is not really a
> pure string manipulation function since it adds display properties. So
> this function can only be used if the string is directly displayed as
> is. The function is not a good fit if the resulting string is
> manipulated further, truncated, etc.

Sorry, I don't understand.  The examples you provided are of text
being displayed.  Which is expected, since these controls have no
other effect _except_ when the text is displayed.  So why isn't the
existing function bidi-string-mark-left-to-right (which was introduced
precisely for the situations like you describe, and is actually used
in Emacs for those purposes) the solution for the class of problems
that you described?

And can we agree that displaying these characters as escapes would not
solve the problems you had in mind, so it is off the table for the
rest of this discussion?





reply via email to

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