From: Andy Moreton <andrewjmoreton@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: `C-b' is backward-char, `left' is left-char - why?
Date: Thu, 02 Jun 2011 17:23:01 +0100 [thread overview]
Message-ID: <vz1hb88w6ca.fsf@gmail.com> (raw)
In-Reply-To: E1QS9WH-00053a-QD@fencepost.gnu.org
On Thu 02 Jun 2011, Eli Zaretskii wrote:
>> From: Andy Moreton <andrewjmoreton@gmail.com>
>> Date: Thu, 02 Jun 2011 13:59:48 +0100
>>
>> > Maybe the following variant of the 2nd sentence sounds better:
>> >
>> > The effect on the screen is to place the cursor on the character N
>> > buffer positions forward, which could be to the left or to the
>> > right, depending on the bidirectional context.
>> >
>> > That's because Emacs doesn't really move point one character at a
>> > time (when N is more than 1).
>>
>> I think that is definitely clearer than what we have now.
>
> Thanks, I will make this change.
>
>> (right-char &optional N)
>>
>> Move point N characters to the right (to the left if N is negative). On
>> reaching beginning or end of buffer, stop and signal error.
>>
>> The effect on the buffer is to place the cursor on the character N
>> screen positions to the right, which could be forward or backward from
>> the current position, depending on the bidirectional context.
>
> Here, as they say, the plot thickens: unlike C-f/C-b that _always_
> move forward resp backward in the buffer, <right> and <left> don't
> always move to the right resp to the left. E.g., if you press <right>
> in a paragraph whose bidi-paragraph-direction is left-to-right, then
> the cursor will actually move to the _left_ when you get to some R2L
> text embedded within this paragraph. You can see an example of this
> in etc/HELLO, in the lines that show Arabic and Hebrew welcome
> phrases.
>
> So if you invoke (right-char 10) when point is on characters from some
> R2L script, the cursor could move to the left!
I find this to be baffling, but then I'm not the target audience for R2L
languages. Is this motion what users expect to happen for bidi text ?
So C-f/C-b move N characters in the buffer, then work out where that
lives on the screen (which may be to the right or left of the start
position. So far, so good.
> IOW, the names of <right> and <left> only express the _global_,
> "grosso modo" direction of motion. That generally DTRT (according to
> user expectations) assuming that left-to-right paragraphs contain
> mostly L2R text and only occasionally short sequences of R2L text; and
> vice versa in right-to-left paragraphs. But if a left-to-right
> paragraph is made solely out of R2L text (a very rare and unusual
> phenomenon), <right> will almost always move to the _left_, and <left>
> to the right! So in this case, even the large-scale movement is in
> the "wrong" direction.
Now my head hurts :-)
> But while we could (for the doc string purposes) quite safely
> disregard the use case of paragraph having the "wrong" direction and
> disrupting the global movement direction as described above, the doc
> string you suggest is wrong even locally, when short sequences of R2L
> text are embedded in an otherwise left-to-right paragraph, or vice
> versa. This cannot be disregarded, so we must find a better way of
> describing the effect of the arrow keys in mixed bidirectional text.
> Ideas are welcome.
OK, I completely misunderstood the semantics here, but your explanation
has again beeen enlightening.
So is it that right-char means advance forward in screen display order
(which may move to the right or the left) and then work out which
buffer position it corresponds to ?
AndyM
next prev parent reply other threads:[~2011-06-02 16:23 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-27 20:40 `C-b' is backward-char, `left' is left-char - why? Drew Adams
2011-05-27 20:48 ` Pascal J. Bourguignon
2011-05-27 21:11 ` Eli Zaretskii
2011-05-27 22:08 ` Drew Adams
2011-05-28 0:19 ` Nix
2011-05-27 21:09 ` Eli Zaretskii
2011-05-27 21:13 ` Eli Zaretskii
2011-05-27 22:08 ` Drew Adams
2011-05-27 22:23 ` Antoine Levitt
2011-05-27 23:19 ` Drew Adams
2011-05-28 0:46 ` Mohsen BANAN
2011-05-28 1:53 ` Drew Adams
2011-05-28 2:24 ` Mohsen BANAN
2011-05-28 8:00 ` Eli Zaretskii
2011-05-27 23:09 ` PJ Weisberg
2011-05-27 23:23 ` Drew Adams
2011-05-28 0:25 ` PJ Weisberg
2011-05-28 0:39 ` Drew Adams
2011-05-28 6:57 ` David Kastrup
2011-05-28 8:21 ` Eli Zaretskii
2011-05-28 0:48 ` Stefan Monnier
2011-05-28 1:54 ` Drew Adams
2011-05-28 7:07 ` David Kastrup
2011-05-28 8:26 ` Eli Zaretskii
2011-05-30 3:57 ` Stefan Monnier
2011-05-31 14:18 ` Davis Herring
2011-05-31 14:39 ` Eli Zaretskii
2011-06-01 11:48 ` Andy Moreton
2011-06-01 13:23 ` Eli Zaretskii
2011-06-01 23:26 ` Andy Moreton
2011-06-02 4:37 ` Eli Zaretskii
2011-06-02 10:38 ` Andy Moreton
2011-06-02 11:12 ` Eli Zaretskii
2011-06-02 12:59 ` Andy Moreton
2011-06-02 15:09 ` Eli Zaretskii
2011-06-02 16:23 ` Andy Moreton [this message]
2011-06-02 17:43 ` Eli Zaretskii
2011-06-02 21:42 ` Andy Moreton
2011-06-03 7:01 ` Eli Zaretskii
2011-06-02 17:09 ` David Kastrup
2011-06-02 18:05 ` Eli Zaretskii
2011-06-03 14:35 ` David Kastrup
2011-06-03 15:08 ` Eli Zaretskii
2011-06-03 15:14 ` David Kastrup
2011-06-03 16:48 ` Eli Zaretskii
2011-06-03 20:56 ` David Kastrup
2011-06-04 6:28 ` Eli Zaretskii
2011-06-05 16:51 ` Ehud Karni
2011-06-05 17:10 ` Eli Zaretskii
2011-06-05 17:19 ` Ehud Karni
2011-06-05 17:26 ` David Kastrup
2011-06-05 17:44 ` Eli Zaretskii
2011-06-05 18:26 ` David Kastrup
2011-06-05 19:22 ` Eli Zaretskii
2011-06-07 8:51 ` David Kastrup
2011-06-07 10:54 ` Eli Zaretskii
2011-06-02 15:35 ` PJ Weisberg
2011-06-02 17:44 ` Eli Zaretskii
2011-06-02 19:29 ` PJ Weisberg
2011-06-02 21:10 ` Eli Zaretskii
2011-06-03 0:47 ` Kenichi Handa
2011-06-03 7:13 ` Eli Zaretskii
2011-06-05 11:27 ` Kenichi Handa
2011-06-05 13:04 ` Eli Zaretskii
2011-06-02 7:23 ` David Kastrup
2011-06-02 8:59 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vz1hb88w6ca.fsf@gmail.com \
--to=andrewjmoreton@gmail.com \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).