diff options
author | Eli Zaretskii <eliz@gnu.org> | 2010-05-15 16:23:48 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2010-05-15 16:23:48 +0300 |
commit | d20e1419fda6f29478d79f69db8e128d043d4ee1 (patch) | |
tree | 6c3d55edc1c753f3578111b10802397974fc61cc /lisp | |
parent | 98d8b17e45bb1246df61e51f8917b98faa9f1cdd (diff) | |
download | emacs-d20e1419fda6f29478d79f69db8e128d043d4ee1.tar.gz emacs-d20e1419fda6f29478d79f69db8e128d043d4ee1.tar.bz2 emacs-d20e1419fda6f29478d79f69db8e128d043d4ee1.zip |
Implement bidi-sensitive movement with arrow keys.
src/bidi.c (bidi_paragraph_init): Don't leave alone garbage values
of bidi_it->paragraph_dir. Call bidi_initialize if needed.
src/xdisp.c (Fcurrent_bidi_paragraph_direction): New function.
(syms_of_xdisp): Defsubr it.
src/cmds.c (Fforward_char, Fbackward_char): Doc fix.
src/subr.el (right-arrow-command, left-arrow-command): New functions.
src/bindings.el (global-map): Bind them to right and left arrow keys.
etc/NEWS: Mention current-bidi-paragraph-direction
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/bindings.el | 4 | ||||
-rw-r--r-- | lisp/subr.el | 25 |
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 |