summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/bindings.el4
-rw-r--r--lisp/subr.el25
3 files changed, 32 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 760e373d095..359cc63ca98 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
2010-05-15 Eli Zaretskii <eliz@gnu.org>
+ Bidi-sensitive movement with arrow keys.
+ * subr.el (right-arrow-command, left-arrow-command): New functions.
+
+ * bindings.el (global-map): Bind them to right and left arrow keys.
+
Don't override standard definition of convert-standard-filename.
* files.el (convert-standard-filename): Call
w32-convert-standard-filename and dos-convert-standard-filename on
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 05a0ac8bc11..14cebfeda8f 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -828,9 +828,9 @@ is okay. See `mode-line-format'.")
(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] 'backward-char)
+(define-key global-map [left] 'left-arrow-command)
(define-key global-map [up] 'previous-line)
-(define-key global-map [right] 'forward-char)
+(define-key global-map [right] 'right-arrow-command)
(define-key global-map [down] 'next-line)
(define-key global-map [prior] 'scroll-down-command)
(define-key global-map [next] 'scroll-up-command)
diff --git a/lisp/subr.el b/lisp/subr.el
index 0cc05a78bc7..1c399f89b9c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3804,5 +3804,30 @@ which is higher than \"1alpha\"."
(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