all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs 24's forward-char vs right-char behavior
Date: Thu, 26 Apr 2012 07:24:06 -0700 (PDT)	[thread overview]
Message-ID: <976d7086-55cd-4d39-8ed6-1f49c7c1b0ed@u4g2000pbu.googlegroups.com> (raw)
In-Reply-To: mailman.613.1335342081.751.help-gnu-emacs@gnu.org

On Apr 25, 1:21 am, Eli Zaretskii <e...@gnu.org> wrote:
> > From: Xah Lee <xah...@gmail.com>
> > 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
shouldn't?

 Xah


  parent reply	other threads:[~2012-04-26 14:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24 22:19 emacs 24's forward-char vs right-char behavior Xah Lee
2012-04-24 23:07 ` Joost Kremers
2012-04-25  6:07 ` Eli Zaretskii
     [not found] ` <mailman.610.1335334014.751.help-gnu-emacs@gnu.org>
2012-04-25  7:43   ` Xah Lee
2012-04-25  8:21     ` Eli Zaretskii
2012-04-25  8:32     ` Joost Kremers
2012-04-25  8:50       ` Eli Zaretskii
     [not found]       ` <mailman.614.1335343852.751.help-gnu-emacs@gnu.org>
2012-04-25 12:48         ` Joost Kremers
2012-04-26 11:17           ` Eli Zaretskii
     [not found]           ` <mailman.81.1335439086.855.help-gnu-emacs@gnu.org>
2012-04-26 18:19             ` Joost Kremers
2012-04-26 20:15               ` Eli Zaretskii
2012-04-27  1:58         ` Jason Rumney
     [not found]     ` <mailman.613.1335342081.751.help-gnu-emacs@gnu.org>
2012-04-26 14:24       ` Xah Lee [this message]
2012-04-26 15:00         ` Eli Zaretskii
2012-04-25  8:16   ` Joost Kremers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=976d7086-55cd-4d39-8ed6-1f49c7c1b0ed@u4g2000pbu.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.