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/subr.el | |
| parent | 98d8b17e45bb1246df61e51f8917b98faa9f1cdd (diff) | |
| download | emacs-d20e1419fda6f29478d79f69db8e128d043d4ee1.tar.gz | |
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/subr.el')
| -rw-r--r-- | lisp/subr.el | 25 |
1 files changed, 25 insertions, 0 deletions
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 |
