From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: emacs 24's forward-char vs right-char behavior Date: Thu, 26 Apr 2012 07:24:06 -0700 (PDT) Organization: http://groups.google.com Message-ID: <976d7086-55cd-4d39-8ed6-1f49c7c1b0ed@u4g2000pbu.googlegroups.com> References: <379c8837-79c2-4692-8103-0bfa473f221e@wp13g2000pbb.googlegroups.com> <6251ec09-a82e-4843-9b52-1074dc20eaf1@a8g2000pbe.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1335450914 5837 80.91.229.3 (26 Apr 2012 14:35:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 26 Apr 2012 14:35:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 26 16:35:13 2012 Return-path: Envelope-to: geh-help-gnu-emacs@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 1SNPmr-0004mo-5h for geh-help-gnu-emacs@m.gmane.org; Thu, 26 Apr 2012 16:35:13 +0200 Original-Received: from localhost ([::1]:34807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNPmq-0003Gg-EL for geh-help-gnu-emacs@m.gmane.org; Thu, 26 Apr 2012 10:35:12 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!u4g2000pbu.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 64 Original-NNTP-Posting-Host: 76.126.112.84 Original-X-Trace: posting.google.com 1335450687 20092 127.0.0.1 (26 Apr 2012 14:31:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 26 Apr 2012 14:31:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u4g2000pbu.googlegroups.com; posting-host=76.126.112.84; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:192234 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84644 Archived-At: On Apr 25, 1:21=C2=A0am, Eli Zaretskii wrote: > > From: Xah Lee > > Date: Wed, 25 Apr 2012 00:43:22 -0700 (PDT) > > > Now, paste this sentence in emacs =E2=80=9C(=D9=83=D8=AA=D8=A7=D8=A8 = =D8=A3=D9=84=D9=81 =D9=84=D9=8A=D9=84=D8=A9 =D9=88 =D9=84=D9=8A=D9=84=D8=A9= )=E2=80=9D. Then, hold > > down right arrow key (which is bound to =E2=80=9Cright-char=E2=80=9D), = then when > > cursor moves into the Arabic text, it'll suddenly reverse direction, > > and move right to left, until it reaches the left most arabic char > > sequence, it'll jump back to the english text and continue move right. > > > Now, do the same but using =E2=80=9Cforward-char=E2=80=9D =E3=80=90Ctrl= +f=E3=80=91. Actually, the same > > behavior is observed visually! > > > from Eli's post, it seems to be the expected behavior. > > Indeed, expected behavior. > > > But then what's the difference of forward-char and right-char? Am > > totally confused now. > > Don't feel bad: this bidi business is complicated, especially for > someone who is not a native speaker of one of the bidi languages. > > To see the difference between forward-char and right-char, do this: > > =C2=A0 emacs -Q > =C2=A0 C-x b foo RET > > Now paste the string "(=D9=83=D8=AA=D8=A7=D8=A8 =D8=A3=D9=84=D9=81 =D9=84= =D9=8A=D9=84=D8=A9 =D9=88 =D9=84=D9=8A=D9=84=D8=A9)" into the buffer "foo" > you just created, and then try both C-f and . =C2=A0See the > difference now? > > Explanation: the difference only shows up in paragraphs whose "base > direction" is right-to-left. =C2=A0(See the Emacs manual's "Bidirectional > Editing" node for more about this.) =C2=A0In the *scratch* buffer, all > paragraphs are forced to be left-to-right, because *scratch* is mostly > used for code snippets. =C2=A0When you create a new buffer "foo", its > default value of bidi-paragraph-direction is nil, which means Emacs > determines the direction from the text of the paragraph. =C2=A0Pasting > Arabic text causes Emacs to treat the paragraph as right-to-left and > render it starting at the right margin of the window. =C2=A0As a side > effect, that affects the behavior of vs forward-char. > > > In emacs 23, holding right arrow (or Ctrl+f) simply move cursor to the > > right, ALWAYS. I was expecting this from emacs 24's =E2=80=9Cright-char= =E2=80=9D. > > Type "C-h k ", and you will see that the commands bound to this > key in Emacs 23 and Emacs 24 are different. =C2=A0Then follow the link to > the code of right-char in Emacs 24, and look at its definition. =C2=A0I > think the code is self-explanatory. Eli, thanks a lot for the explanation and Joost. Just one curious question, can't right-char always move to the right even in mixed R2L/L2R situations? is it because logically it shouldn't? Xah