emacs-devel
[Top][All Lists]
Advanced

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

Re: Bidirectional text and URLs


From: Eli Zaretskii
Subject: Re: Bidirectional text and URLs
Date: Sat, 29 Nov 2014 20:18:29 +0200

> From: Lars Magne Ingebrigtsen <address@hidden>
> Date: Sat, 29 Nov 2014 18:49:21 +0100
> 
> It seems pretty clear that stuff like
> 
>http://myspace.com/#/segami/moc.koobecaf//:sptth
> 
> where you have a buffer with only left-to-right text, but then you have
> a single right-to-left indicator, is suspicious.

The "single right-to-left indicator" is a fallacy: the correct use of
these formatting controls calls for a u+202E RIGHT-TO-LEFT OVERRIDE
(RLO) character before the text and a u+202C POP DIRECTIONAL
FORMATTing (PDF) character after the text.  Your example only works
because the UBA mandates that all embeddings end at the end of a
physical line, so omitting a PDF here doesn't affect the display,
since the URL stands out on its own line.

So you could actually see a URL enclosed in the RLO..PDF pair as well,
and we need to handle that in the same manner.

> And since Latin characters are strongly left-to-right, you don't get
> confusing URLs in the middle of right-to-left text:

As Stephen pointed out earlier, the same effect can be achieved with
RTL text by using the LRO..PDF embedding (LRO is u+202D).

> So...  would a possible solution here be as simple as removing all
> right-to-left indicators in mail and web modes if those right-to-left
> indicators apply to URLs?

I think instead of removing them it is better to display them
prominently, e.g., by changing their entry in the
glyphless-char-display char-table.  The advantage is that you don't
accidentally harm the display where these controls are used
legitimately, and OTOH make their presence acutely evident.

> But currently Emacs doesn't really have a mechanism for querying the
> directionality of a buffer region, I think?

What do you mean by "directionality of a buffer region"?  At least
under some definitions of that, I can think of a very easy
implementation.




reply via email to

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