unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andy Moreton <andrewjmoreton@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: `C-b' is backward-char, `left' is left-char - why?
Date: Thu, 02 Jun 2011 00:37:20 -0400	[thread overview]
Message-ID: <E1QRzeq-0007Gl-LO@fencepost.gnu.org> (raw)
In-Reply-To: <82y61l16bg.fsf@gmail.com> (message from Andy Moreton on Thu, 02 Jun 2011 00:26:59 +0100)

> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Thu, 02 Jun 2011 00:26:59 +0100
> 
> Having not looked at these functions previously, I found the doc strings
> to be essentially the same for both of them, which was confusing.

I can understand the confusion, given the deceptively simple idea of
"forward" and "back" in the unidirectional world.

> Having looked at the manual, I think the description there of <left> and
> <right> does a better job of explaining what happens in bidi enabled
> text than the doc strings.

Well, we could duplicate the description from the manual in the doc
string, if deemed useful.

>  - forward-char moves forward one character in the buffer, which in
>    right-to-left text moves backward one position on the screen.

Not "backward", but to the left.  "Forward" and "backward" are not
well-defined on the screen in bidirectional context.  For someone who
reads the bidirectional text, C-f always moves forward, i.e. in the
reading direction, the direction in which we scan characters while
reading the text.

>  - right-char moves forward one position on the screen, which in
>    right-to-left text moves backward one character in the buffer.

This is misleading.  "Forward one position on the screen" is not well-
defined, so using it will confuse the reader.  Using "to the right"
instead is well-defined, but only _mostly_ correct, because there's no
pure right-to-left or left-to-right text.  Almost always there's some
left-to-right text (e.g., digits) embedded in predominantly
right-to-left text and vice versa.  (That's why the thing is called
"bidirectional".)  When you use right-char to move over left-to-right
characters embedded in otherwise right-to-left text, the cursor will
move to the left.  And that's even before we consider further
complications such as directional overrides (the RLE, RLO,
etc. control characters).

It would be more precise to tell that right-char will advance in the
buffer when used in a paragraph whose direction is left-to-right, but
will move backward in the buffer when used in a paragraph with
right-to-left direction.  But I'm not sure such a description will do
a better job, because explaining a simple idea such as cursor motion
via a much more complex issue of bidi-paragraph-direction doesn't
sound right.  By analogy, if you ask about laws wrt to traffic lights,
you will not be amused to first get a lecture about special relativity
theory that could potentially make the red light look green due to
Doppler effect.

> (forward-char &optional N)
> 
> Move point N characters forward (backward if N is negative).
> On reaching end or beginning of buffer, stop and signal error.
> 
> Movement on the screen depends on the bidirectional context. Moving
> forward over left-to-right text moves to the right on the screen, but
> moving forward over right-to-left text moves _backward_ on the screen.
                                               ^^^^^^^^^^^
Should be "_to_the_left_"

> This is in contrast with right-char, which see.

I'm okay with this if it helps to make the issue less vague, but you
should realize that it is also inaccurate, because "left-to-right
text" is not well-defined.  There are "weak" and "neutral" characters
whose directionality is defined by surrounding strong directional
characters.  There are directional override control characters that
can override the intrinsic properties of the following characters.
Etc., etc. -- all these can invalidate the simple description above.



  reply	other threads:[~2011-06-02  4:37 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 [this message]
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
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=E1QRzeq-0007Gl-LO@fencepost.gnu.org \
    --to=eliz@gnu.org \
    --cc=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).