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: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs. Date: Fri, 12 Aug 2011 10:21:16 +0300 Message-ID: <8362m3xfgz.fsf@gnu.org> References: <83ei0sy7jk.fsf@gnu.org> <87aabfojr7.fsf@stupidchicken.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1313133711 9144 80.91.229.12 (12 Aug 2011 07:21:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 12 Aug 2011 07:21:51 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 12 09:21:46 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 1Qrm3t-00084e-3q for ged-emacs-devel@m.gmane.org; Fri, 12 Aug 2011 09:21:45 +0200 Original-Received: from localhost ([::1]:57505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrm3r-0000SL-Ih for ged-emacs-devel@m.gmane.org; Fri, 12 Aug 2011 03:21:43 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:53607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrm3o-0000SG-Sc for emacs-devel@gnu.org; Fri, 12 Aug 2011 03:21:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qrm3n-0004CF-Ej for emacs-devel@gnu.org; Fri, 12 Aug 2011 03:21:40 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:57981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrm3n-0004C7-88 for emacs-devel@gnu.org; Fri, 12 Aug 2011 03:21:39 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LPT001000B2QY00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Fri, 12 Aug 2011 10:21:13 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.94.185]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LPT000A30FCU880@a-mtaout22.012.net.il>; Fri, 12 Aug 2011 10:21:13 +0300 (IDT) In-reply-to: <87aabfojr7.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:143151 Archived-At: > From: Chong Yidong > Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org > Date: Thu, 11 Aug 2011 15:01:16 -0400 >=20 > OK, so basically we have to scan the entire string like this, right= ? Yes. Btw, is there a way to regex-search for a character by its bidi category? That would make the code more elegant, and probably quite faster as well. > (let ((len (length str)) > =09(n 0) > =09rtl-found) > (while (and (not rtl-found) (< n len)) > (setq rtl-found (memq (get-char-code-property > =09=09=09 (aref str n) 'bidi-class) '(R AL)) ^^^^^^^ Make that '(R AL RLO), since the RLO character overrides the bidirectional properties of all the following characters with R. > > And since buffer-menu.el was already modified to use this functio= n, it > > is easy to see how this algorithm fails: make a buffer whose name= is > > made of all R2L characters with the "<1>" tail appended, then typ= e > > "C-x C-b" and watch the messed-up display. The original code tre= ated > > this case correctly. >=20 > Actually, it looks as though the <1> is not treated properly, even = with > the old code. If I do >=20 > (rename-buffer (concat "=D8=A7=D9=84=D8=B3=D9=91=D9=84=D8=A7= =D9=85 =D8=B9=D9=84=D9=8A=D9=83=D9=85" > =09=09=09 "<1>")) >=20 > then the buffer is displayed as 1>[some Arabic text]>, both in the > mode-line and in the buffer menu. I didn't mean the display of the buffer name itself; that is a separate issue, as discussed here: https://lists.gnu.org/archive/html/emacs-devel/2011-06/msg00712.htm= l I meant the buffer menu layout: with the current bzr tip, the buffer size was displayed to the left of the buffer name, whereas the previous code displayed it to the right of the name, as with buffer names without R2L characters. > For extra hilarity, get rid of the newline in this code fragment an= d > watch as the redisplayed Emacs Lisp code turns into gibberish... That's one of the problems that are not yet solved in Emacs: how to display code with comments and strings in R2L languages without messing up the display and without giving up the reordering of the strings and comments.