From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: bidi-display-reordering is now non-nil by default Date: Sun, 07 Aug 2011 22:32:40 +0300 Message-ID: <83wrepyq3r.fsf@gnu.org> References: <87fwlm7fam.fsf@fencepost.gnu.org> <87bowa7dza.fsf@fencepost.gnu.org> <877h6y7chn.fsf@fencepost.gnu.org> <831ux6cv5o.fsf@gnu.org> <87d3gpku3o.fsf@gnus.org> <834o1ypa2b.fsf@gnu.org> <87aabnn3mz.fsf@stupidchicken.com> <83mxfnwwyd.fsf@gnu.org> <87ipqbzogt.fsf@stupidchicken.com> <83liv7wqhe.fsf@gnu.org> <87liv75xsh.fsf@stupidchicken.com> <83k4arvx05.fsf@gnu.org> <87bow116je.fsf@stupidchicken.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1312745579 25682 80.91.229.12 (7 Aug 2011 19:32:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 7 Aug 2011 19:32:59 +0000 (UTC) Cc: larsi@gnus.org, list-general@mohsen.1.banan.byname.net, emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 07 21:32:54 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qq95h-0004Cl-UA for ged-emacs-devel@m.gmane.org; Sun, 07 Aug 2011 21:32:54 +0200 Original-Received: from localhost ([::1]:34200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qq95h-0000Vd-3E for ged-emacs-devel@m.gmane.org; Sun, 07 Aug 2011 15:32:53 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qq95c-0000VP-L5 for emacs-devel@gnu.org; Sun, 07 Aug 2011 15:32:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qq95Y-0002VQ-4E for emacs-devel@gnu.org; Sun, 07 Aug 2011 15:32:48 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:33916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qq95X-0002VK-Tg for emacs-devel@gnu.org; Sun, 07 Aug 2011 15:32:44 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LPK00100OW0OY00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Sun, 07 Aug 2011 22:32:42 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.94.185]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LPK0008QOYGZVJ0@a-mtaout22.012.net.il>; Sun, 07 Aug 2011 22:32:41 +0300 (IDT) In-reply-to: <87bow116je.fsf@stupidchicken.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:142971 Archived-At: > From: Chong Yidong > Cc: larsi@gnus.org, list-general@mohsen.1.banan.byname.net, > emacs-devel@gnu.org > 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.