emacs-devel
[Top][All Lists]
Advanced

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

Re: bidi-display-reordering is now non-nil by default


From: Eli Zaretskii
Subject: Re: bidi-display-reordering is now non-nil by default
Date: Sun, 07 Aug 2011 22:32:40 +0300

> From: Chong Yidong <address@hidden>
> Cc: address@hidden, address@hidden,
>         address@hidden
> Date: Sun, 07 Aug 2011 13:21:41 -0400
> 
> (defun string-mark-left-to-right (str)
>   "Return a string based on STR that can be embedded in LTR text.
> If STR ends in right-to-left (RTL) script, return a string
> consisting of STR followed by a left-to-right mark (LRM)
> character.  Otherwise, return STR."
>   (if --??--this-string-needs-an-lrm--??--
>       (concat str "\u200E")
>     str))
> 
> (Can you tell us how to fill in the missing piece above?)

How about

  (if t

?

Seriously, though: why do you need any conditions here?  An LRM will
have no effect if str is not reordered, so why not put it there
unconditionally?

But if you insist on doing that only when str might need that, then I
think you want to check each character in str with
get-char-code-property, like this:

  (get-char-code-property (aref str i) 'bidi-class)

If this returns 'R for any character, it means the string _might_ need
LRM to be appended.



reply via email to

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