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, LaTeX (auctex) and the =?utf-8?B?wqtldmlswrs=?= backslash Date: Sat, 21 May 2016 20:34:40 +0300 Message-ID: <83iny771sf.fsf@gnu.org> References: <874m9r4it5.fsf@mat.ucm.es> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1463852096 19961 80.91.229.3 (21 May 2016 17:34:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 May 2016 17:34:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Uwe Brauer Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 21 19:34:52 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b4Anc-000746-0Z for ged-emacs-devel@m.gmane.org; Sat, 21 May 2016 19:34:52 +0200 Original-Received: from localhost ([::1]:40829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4Anb-00067O-2e for ged-emacs-devel@m.gmane.org; Sat, 21 May 2016 13:34:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4AnU-00066N-LK for emacs-devel@gnu.org; Sat, 21 May 2016 13:34:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4AnQ-0004nL-NH for emacs-devel@gnu.org; Sat, 21 May 2016 13:34:43 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4AnQ-0004nC-KA; Sat, 21 May 2016 13:34:40 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1206 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b4AnN-0007SP-E6; Sat, 21 May 2016 13:34:39 -0400 In-reply-to: <874m9r4it5.fsf@mat.ucm.es> (message from Uwe Brauer on Sat, 21 May 2016 13:55:18 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:203928 Archived-At: > From: Uwe Brauer > Date: Sat, 21 May 2016 13:55:18 +0000 > Cc: auctex-devel > > In my understanding UTF distinguish between What is "UTF" in this context? > - LTR chars such as a,b,c > > - RLT chars such as א,ב,ג > > - «neutral» chars such as (),\ etc. You should read the description of UBA, the Unicode Bidirectional Algorithm (which Emacs implements). There you will see that there are actually 4 classes of characters: . string (LTR and RTL) . weak (numbers, number separators, diacriticals) . neutral (punctuation and whitespace) . formatting control characters (RLM etc.) So: (get-char-code-property ?\\ 'bidi-class) => ON ("ON" stands for "other neutral", see the node "Character Properties" in the ELisp manual.) > - set bidi-paragraph-direction to left (shown in the next > screenshot.) The display is correct, however typing Hebrew, when > bidi-paragraph-direction is set to left is as unpleasant as > writing English with bidi-paragraph-direction set to right. > > - use LRM chars before the backslash (see the last screenshot; > having set `glyphless-char-display-control' to `acronym'. > This looks well to but adding these chars is cumbersome. > > - hack auctex (CC to the auctex list): a new variable is > introduced, say bidi-support, which is per default nil, but if it > is t, then LRM chars are inserted before a backslash. I am > pretty sure the auctex team will not like this idea very much. > > - back emacs: in a LaTeX buffer, backslash is considered as LTR, I > don't know whether this can be done one the lisp level or whether > it can be done at all. > > Comments? The last one is possible, of course (this is Emacs), but that way lies madness: arbitrarily changing bidirectional properties of characters will bite you elsewhere, because the corresponding tables are global. The other 3 alternatives are indeed the available solutions. Personally, I recommend the 1st one; I see no problem with typing RTL text in a left-to-right paragraph (and vice versa), and don't understand what unpleasant things you bump into when doing that. TeX files are fundamentally left-to-right, as any program text, so that would be my suggestion.