all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bidi-string-strip-control-characters
@ 2022-01-20  9:23 Eli Zaretskii
  2022-01-20  9:29 ` bidi-string-strip-control-characters Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2022-01-20  9:23 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars, I'm not sure I understand the purpose of this function.  Can you
explain?

The way it is currently used is also strange, to say the least: you
apply it to a string made of a single character, so either it does
nothing to the string, or it will return an empty string.  So the
following code will present the user with a riddle:

  (textsec-email-address-header-suspicious-p
   "Lars Ingebrigtsen <larsi@\N{RIGHT-TO-LEFT OVERRIDE}gnus.org>")
  "Disallowed character: `' (#x202e, RIGHT-TO-LEFT OVERRIDE)"

The empty string between quotes is the riddle.

I think I understand the original problem: displaying a literal U+202E
there will mess up the text on display, but if that is the reason, the
right way is not to remove the character, it is to append to it the
necessary bidi controls to prevent the messup (and make the appended
controls be invisible).

Here's an example:

  (insert (format "Disallowed character: `%s' (#x202e, RIGHT-TO-LEFT OVERRIDE)"
		(concat (string ?\x202e)
			(propertize (string ?\x202c ?\x200e) 'invisible t))))

This displays the RLO character, but doesn't mess up the description
after it.

We do something like that in descr-text.el, so I guess we need to
factor out that code and use it here.



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-01-21  9:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-20  9:23 bidi-string-strip-control-characters Eli Zaretskii
2022-01-20  9:29 ` bidi-string-strip-control-characters Lars Ingebrigtsen
2022-01-20 10:14   ` bidi-string-strip-control-characters Eli Zaretskii
2022-01-20 12:47     ` bidi-string-strip-control-characters Lars Ingebrigtsen
2022-01-20 11:04   ` bidi-string-strip-control-characters Po Lu
2022-01-20 11:19     ` bidi-string-strip-control-characters Eli Zaretskii
2022-01-20 11:21       ` bidi-string-strip-control-characters Po Lu
2022-01-20 11:23       ` bidi-string-strip-control-characters Lars Ingebrigtsen
2022-01-20 11:33         ` bidi-string-strip-control-characters Eli Zaretskii
2022-01-20 12:46           ` bidi-string-strip-control-characters Lars Ingebrigtsen
2022-01-20 13:02             ` bidi-string-strip-control-characters Eli Zaretskii
2022-01-20 13:36               ` bidi-string-strip-control-characters Lars Ingebrigtsen
2022-01-20 16:51                 ` bidi-string-strip-control-characters Eli Zaretskii
2022-01-21  9:18                   ` bidi-string-strip-control-characters Lars Ingebrigtsen

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.