From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: emacs 24's forward-char vs right-char behavior Date: Wed, 25 Apr 2012 09:07:04 +0300 Message-ID: <83ipgofipj.fsf@gnu.org> References: <379c8837-79c2-4692-8103-0bfa473f221e@wp13g2000pbb.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1335334024 25984 80.91.229.3 (25 Apr 2012 06:07:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 25 Apr 2012 06:07:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 25 08:07:03 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 1SMvNS-0000ff-No for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Apr 2012 08:06:58 +0200 Original-Received: from localhost ([::1]:49319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMvNR-00078K-OK for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Apr 2012 02:06:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMvNM-00078A-Sn for help-gnu-emacs@gnu.org; Wed, 25 Apr 2012 02:06:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SMvNK-0002nJ-VX for help-gnu-emacs@gnu.org; Wed, 25 Apr 2012 02:06:52 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:63102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMvNK-0002nC-NS for help-gnu-emacs@gnu.org; Wed, 25 Apr 2012 02:06:50 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M3000M00U9C3V00@a-mtaout22.012.net.il> for help-gnu-emacs@gnu.org; Wed, 25 Apr 2012 09:06:49 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.229.249.186]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M3000L5DUBCQ990@a-mtaout22.012.net.il> for help-gnu-emacs@gnu.org; Wed, 25 Apr 2012 09:06:49 +0300 (IDT) In-reply-to: <379c8837-79c2-4692-8103-0bfa473f221e@wp13g2000pbb.googlegroups.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.172 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:84622 Archived-At: > From: Xah Lee > Date: Tue, 24 Apr 2012 15:19:29 -0700 (PDT) >=20 > if it's not too late, i think the semantics of =93forward-char=94 a= nd > =93right-char=94 should be exchanged (from what it currently is in = emacs > 24). >=20 > =93forward-char=94's direction should be context sensitive. What exactly do you mean by "direction"? There are 2 "directions" involved here: the direction of the movement in the buffer (either forward or backward), and the direction on the screen (either right o= r left). 'forward-char' always moves forward in the buffer, but as result could move either to the right or to the left on the screen, because with bidirectional languages screen position is no longer monotonically increasing with buffer position. > =93right-char=94 should always move to the right. It mostly does. It always does move to the right when the surroundin= g text is either all made of left-to-right characters (which is what happens in Latin languages, for example), and also when the surrounding text is all made of right-to-left characters. If the surrounding text is mixed L2R and R2L, then 'right-char' switches its screen direction, but still generally moves to the right, i.e. movements to the left are normally short (e.g., when short sequences of Latin text or numbers are embedded in a generally right-to-left text). IOW, Emacs 24 implements the so-called "logical" cursor motion. Visual cursor motion, the one where 'right-char' would always move to the right, no matter what the surrounding text, is not implemented. > At first i thought emacs can't do that because lots elisp code depe= nds > on =93forward-char=94's existing behavior. That's one reason. The more important one is that reordering of bidirectional text in Emacs is a display-only feature. It was designed not to affect any buffer-related commands and movements. Therefore, 'forward-char' must still move in the forward direction, i.e. in the direction of increasing buffer or string positions. > But on second thought, am thinking it's probably rare that elisp is > used to process {Arabic, Persian (Iran), Hebrew} languages. Emacs 24 includes full support for editing and displaying plain text in these languages. And there was no conflict related to 'forward-char' in adding that support that would require a kind of compromise you are hinting at. Btw, the cursor movement implemented in Emacs 24 is the same one you will see in MS products, like Word or Notepad. Emacs didn't invent anything in this area, at least from the user POV. > So, perhaps changing =93forward-char=94's behavior isn't too bad? The behavior of 'forward-char' didn't change at all. It still moves forward.