emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100476: Implement bidi-sensitive wor


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100476: Implement bidi-sensitive word movement with arrow keys.
Date: Sat, 29 May 2010 18:19:13 +0300
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100476
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2010-05-29 18:19:13 +0300
message:
  Implement bidi-sensitive word movement with arrow keys.
  
   lisp/subr.el (right-arrow-command, left-arrow-command): Move to bindings.el.
   lisp/bindings.el (right-char, left-char): Move from subr.el and
   rename from right-arrow-command and left-arrow-command.
   (right-word, left-word): New functions.
   (global-map) <right>: Bind to right-char.
   (global-map) <left>: Bind to left-char.
   (global-map) <C-right>: Bind to right-word.
   (global-map) <C-left>: Bind to left-word.
  
   doc/emacs/basic.texi (Moving Point): Update due to renaming of commands bound
   to arrows.  Document bidi-aware behavior of C-<right> and C-<left>.
modified:
  doc/emacs/ChangeLog
  doc/emacs/basic.texi
  lisp/ChangeLog
  lisp/bindings.el
  lisp/subr.el
=== modified file 'doc/emacs/ChangeLog'
--- a/doc/emacs/ChangeLog       2010-05-18 11:49:10 +0000
+++ b/doc/emacs/ChangeLog       2010-05-29 15:19:13 +0000
@@ -1,3 +1,8 @@
+2010-05-29  Eli Zaretskii  <address@hidden>
+
+       * basic.texi (Moving Point): Update due to renaming of commands bound
+       to arrows.  Document bidi-aware behavior of C-<right> and C-<left>.
+
 2010-05-18  Eli Zaretskii  <address@hidden>
 
        * display.texi (Fringes): Document reversal of fringe arrows for R2L

=== modified file 'doc/emacs/basic.texi'
--- a/doc/emacs/basic.texi      2010-05-18 10:58:56 +0000
+++ b/doc/emacs/basic.texi      2010-05-29 15:19:13 +0000
@@ -146,8 +146,8 @@
 @findex move-end-of-line
 @findex forward-char
 @findex backward-char
address@hidden right-arrow-command
address@hidden left-arrow-command
address@hidden right-char
address@hidden left-char
 @findex next-line
 @findex previous-line
 @findex beginning-of-buffer
@@ -165,7 +165,7 @@
 @item C-f
 Move forward one character (@code{forward-char}).
 @item @key{right}
-Move one character to the right (@code{right-arrow-command}).  This
+Move one character to the right (@code{right-char}).  This
 moves one character forward in text that is read in the usual
 left-to-right direction, but one character @emph{backward} if the text
 is read right-to-left, as needed for right-to-left scripts such as
@@ -173,17 +173,23 @@
 @item C-b
 Move backward one character (@code{backward-char}).
 @item @key{left}
-Move one character to the left (@code{left-arrow-command}).  This
+Move one character to the left (@code{left-char}).  This
 moves one character backward in left-to-right text and one character
 forward in right-to-left text.
 @item M-f
 @itemx address@hidden
address@hidden address@hidden
 Move forward one word (@code{forward-word}).
address@hidden address@hidden
+Move one word to the right (@code{right-word}).  This moves one word
+forward in left-to-right text and one word backward in right-to-left
+text.
 @item M-b
 @itemx address@hidden
address@hidden address@hidden
 Move backward one word (@code{backward-word}).
address@hidden address@hidden
+Move one word to the left (@code{left-word}).  This moves one word
+backward in left-to-right text and one word forward in right-to-left
+text.
 @item C-n
 @itemx @key{down}
 Move down one screen line (@code{next-line}).  This command attempts

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-05-29 07:55:40 +0000
+++ b/lisp/ChangeLog    2010-05-29 15:19:13 +0000
@@ -1,5 +1,17 @@
 2010-05-29  Eli Zaretskii  <address@hidden>
 
+       Bidi-sensitive word movement with arrow keys.
+       * subr.el (right-arrow-command, left-arrow-command): Move to
+       bindings.el.
+
+       * bindings.el (right-char, left-char): Move from subr.el and
+       rename from right-arrow-command and left-arrow-command.
+       (right-word, left-word): New functions.
+       (global-map) <right>: Bind to right-char.
+       (global-map) <left>: Bind to left-char.
+       (global-map) <C-right>: Bind to right-word.
+       (global-map) <C-left>: Bind to left-word.
+
        * ls-lisp.el (ls-lisp-classify-file): New function.
        (ls-lisp-insert-directory): Call it if switches include -F (bug#6294).
        (ls-lisp-classify): Call ls-lisp-classify-file.

=== modified file 'lisp/bindings.el'
--- a/lisp/bindings.el  2010-05-15 13:23:48 +0000
+++ b/lisp/bindings.el  2010-05-29 15:19:13 +0000
@@ -678,6 +678,63 @@
 ;but they are not assigned to keys there.
 (put 'narrow-to-region 'disabled t)
 
+;; Moving with arrows in bidi-sensitive direction.
+(defun 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.
+
+Depending on the bidirectional context, this may move either forward
+or backward in the buffer.  This is in contrast with \\[forward-char]
+and \\[backward-char], which see."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (forward-char n)
+    (backward-char n)))
+
+(defun left-char ( &optional n)
+  "Move point N characters to the left (to the right if N is negative).
+On reaching beginning or end of buffer, stop and signal error.
+
+Depending on the bidirectional context, this may move either backward
+or forward in the buffer.  This is in contrast with \\[backward-char]
+and \\[forward-char], which see."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (backward-char n)
+    (forward-char n)))
+
+(defun right-word (&optional n)
+  "Move point N words to the right (to the left if N is negative).
+
+Depending on the bidirectional context, this may move either forward
+or backward in the buffer.  This is in contrast with \\[forward-word]
+and \\[backward-word], which see.
+
+Value is normally t.
+If an edge of the buffer or a field boundary is reached, point is left there
+there and the function returns nil.  Field boundaries are not noticed
+if `inhibit-field-text-motion' is non-nil."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (forward-word n)
+    (backward-word n)))
+
+(defun left-word (&optional n)
+  "Move point N words to the left (to the right if N is negative).
+
+Depending on the bidirectional context, this may move either backward
+or forward in the buffer.  This is in contrast with \\[backward-word]
+and \\[forward-word], which see.
+
+Value is normally t.
+If an edge of the buffer or a field boundary is reached, point is left there
+there and the function returns nil.  Field boundaries are not noticed
+if `inhibit-field-text-motion' is non-nil."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (backward-word n)
+    (forward-word n)))
+
 (defvar narrow-map (make-sparse-keymap)
   "Keymap for narrowing commands.")
 (define-key ctl-x-map "n" narrow-map)
@@ -828,9 +885,9 @@
 (define-key global-map [C-home]                'beginning-of-buffer)
 (define-key global-map [M-home]                
'beginning-of-buffer-other-window)
 (define-key esc-map    [home]          'beginning-of-buffer-other-window)
-(define-key global-map [left]          'left-arrow-command)
+(define-key global-map [left]          'left-char)
 (define-key global-map [up]            'previous-line)
-(define-key global-map [right]         'right-arrow-command)
+(define-key global-map [right]         'right-char)
 (define-key global-map [down]          'next-line)
 (define-key global-map [prior]         'scroll-down-command)
 (define-key global-map [next]          'scroll-up-command)
@@ -1030,8 +1087,8 @@
 (global-set-key [M-left]   'backward-word)
 (define-key esc-map [left] 'backward-word)
 ;; address@hidden says these bindings are standard on PC editors.
-(global-set-key [C-right]  'forward-word)
-(global-set-key [C-left]   'backward-word)
+(global-set-key [C-right]  'right-word)
+(global-set-key [C-left]   'left-word)
 ;; This is not quite compatible, but at least is analogous
 (global-set-key [C-delete] 'kill-word)
 (global-set-key [C-backspace] 'backward-kill-word)

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2010-05-25 00:54:13 +0000
+++ b/lisp/subr.el      2010-05-29 15:19:13 +0000
@@ -3802,30 +3802,5 @@
                          (prin1-to-string (make-hash-table)))))
   (provide 'hashtable-print-readable))
 
-;; Moving with arrows in bidi-sensitive direction.
-(defun right-arrow-command (&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.
-
-Depending on the bidirectional context, this may move either forward
-or backward in the buffer.  This is in contrast with \\[forward-char]
-and \\[backward-char], which see."
-  (interactive "^p")
-  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
-      (forward-char n)
-    (backward-char n)))
-
-(defun left-arrow-command ( &optional n)
-  "Move point N characters to the left (to the right if N is negative).
-On reaching beginning or end of buffer, stop and signal error.
-
-Depending on the bidirectional context, this may move either backward
-or forward in the buffer.  This is in contrast with \\[backward-char]
-and \\[forward-char], which see."
-  (interactive "^p")
-  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
-      (backward-char n)
-    (forward-char n)))
-
 ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc
 ;;; subr.el ends here


reply via email to

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