[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs 24's forward-char vs right-char behavior

From: Xah Lee
Subject: Re: emacs 24's forward-char vs right-char behavior
Date: Thu, 26 Apr 2012 07:24:06 -0700 (PDT)
User-agent: G2/1.0

On Apr 25, 1:21 am, Eli Zaretskii <address@hidden> wrote:
> > From: Xah Lee <address@hidden>
> > Date: Wed, 25 Apr 2012 00:43:22 -0700 (PDT)
> > Now, paste this sentence in emacs “(كتاب ألف ليلة و ليلة)”. Then, hold
> > down right arrow key (which is bound to “right-char”), 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 “forward-char” 【Ctrl+f】. 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:
>   emacs -Q
>   C-x b foo RET
> Now paste the string "(كتاب ألف ليلة و ليلة)" into the buffer "foo"
> you just created, and then try both C-f and <right>.  See the
> difference now?
> Explanation: the difference only shows up in paragraphs whose "base
> direction" is right-to-left.  (See the Emacs manual's "Bidirectional
> Editing" node for more about this.)  In the *scratch* buffer, all
> paragraphs are forced to be left-to-right, because *scratch* is mostly
> used for code snippets.  When 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.  Pasting
> Arabic text causes Emacs to treat the paragraph as right-to-left and
> render it starting at the right margin of the window.  As a side
> effect, that affects the behavior of <right> 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 “right-char”.
> Type "C-h k <right>", and you will see that the commands bound to this
> key in Emacs 23 and Emacs 24 are different.  Then follow the link to
> the code of right-char in Emacs 24, and look at its definition.  I
> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]