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: Persian RTL problem Date: Tue, 27 Sep 2011 20:37:46 +0300 Message-ID: <83oby5ga39.fsf@gnu.org> References: <87sjnl8e9i.fsf@m17n.org> <83fwjk1opg.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1317145079 30588 80.91.229.12 (27 Sep 2011 17:37:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Sep 2011 17:37:59 +0000 (UTC) Cc: emacs-devel@gnu.org To: mehran khajavi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 27 19:37:55 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 1R8bbM-0005Mt-EV for ged-emacs-devel@m.gmane.org; Tue, 27 Sep 2011 19:37:52 +0200 Original-Received: from localhost ([::1]:33769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8bbL-0005Dq-Vo for ged-emacs-devel@m.gmane.org; Tue, 27 Sep 2011 13:37:51 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8bbI-0004yV-Je for emacs-devel@gnu.org; Tue, 27 Sep 2011 13:37:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8bbH-0007yd-7s for emacs-devel@gnu.org; Tue, 27 Sep 2011 13:37:48 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:34221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8bbH-0007vi-0q for emacs-devel@gnu.org; Tue, 27 Sep 2011 13:37:47 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LS600500ZK4FT00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Tue, 27 Sep 2011 20:37:45 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.8.215]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LS60054LZMW2V80@a-mtaout20.012.net.il>; Tue, 27 Sep 2011 20:37:45 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.166 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:144420 Archived-At: > From: mehran khajavi > Date: Tue, 27 Sep 2011 15:49:07 +0330 > Cc: emacs-devel@gnu.org, handa@m17n.org > > In some buffers for example ERC irc channels RTL doesn't work > It aligned as Left , Is there any function to set buffer as RTL? > or is there any option to set if most of the text is in Persian language set > this line as RTL? I think you want bidi-paragraph-direction, it's described in the user manual. When it is set to its default nil value, Emacs determines the paragraph direction dynamically from the paragraph contents. It is possible that ERC sets this variable to `left-to-right', in which case all the paragraphs will be aligned to the left. This is a user variable, specific to each buffer, so you can change it if the default does not suit you. > 2.there is some bugs that I see in Emacs 24 pretest with RTL > according to attachment , text that bordered with sign "1" should be in > right of the buffer > when I enter a blank line and enter the same line it will be aligned in the > right way(signed as 4) > after that I entered an English text without blank line (signed as 2),it > aligned at right but it should be in left These are all by design. Emacs does not consider each line a separate paragraph, because that would look dreadfully in usual Emacs plain-text buffers that have a newline at the end of each line. Instead, Emacs implements what the Unicode Bidirectional Algorithm (UBA) calls "higher protocols" to define paragraph beginning; an empty line signals a new paragraph. See the manual for details (node "Bidirectional Editing"). > numbers of persian language will be aligned at left but it should aligned in > right(signed as 3) This is what the UBA mandates. Arabic numbers are not strong directional characters, they are weak characters. Only paragraphs that begin with a character of type R (strong right-to-left) or AL (strong right-to-left Arabic) cause the paragraph direction to become right-to-left. If you follow the numbers with a Persian letter, the paragraph will become right-to-left. Here's the relevant portion from the UBA: 3.3.1 The Paragraph Level P1. Split the text into separate paragraphs. A paragraph separator is kept with the previous paragraph. Within each paragraph, apply all the other rules of this algorithm. P2. In each paragraph, find the first character of type L, AL, or R. Because paragraph separators delimit text in this algorithm, this will generally be the first strong character after a paragraph separator or at the very beginning of the text. Note that the characters of type LRE, LRO, RLE, or RLO are ignored in this rule. This is because typically they are used to indicate that the embedded text is the opposite direction than the paragraph level. P3. If a character is found in P2 and it is of type AL or R, then set the paragraph embedding level to one; otherwise, set it to zero. "Paragraph embedding level" being one means the paragraph is aligned to the right and displayed right to left. Thanks.