diff options
| author | Eli Zaretskii | 2010-05-15 16:23:48 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2010-05-15 16:23:48 +0300 |
| commit | d20e1419fda6f29478d79f69db8e128d043d4ee1 (patch) | |
| tree | 6c3d55edc1c753f3578111b10802397974fc61cc /lisp | |
| parent | 98d8b17e45bb1246df61e51f8917b98faa9f1cdd (diff) | |
| download | emacs-d20e1419fda6f29478d79f69db8e128d043d4ee1.tar.gz 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 @@ | |||
| 1 | 2010-05-15 Eli Zaretskii <eliz@gnu.org> | 1 | 2010-05-15 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | Bidi-sensitive movement with arrow keys. | ||
| 4 | * subr.el (right-arrow-command, left-arrow-command): New functions. | ||
| 5 | |||
| 6 | * bindings.el (global-map): Bind them to right and left arrow keys. | ||
| 7 | |||
| 3 | Don't override standard definition of convert-standard-filename. | 8 | Don't override standard definition of convert-standard-filename. |
| 4 | * files.el (convert-standard-filename): Call | 9 | * files.el (convert-standard-filename): Call |
| 5 | w32-convert-standard-filename and dos-convert-standard-filename on | 10 | 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'.") | |||
| 828 | (define-key global-map [C-home] 'beginning-of-buffer) | 828 | (define-key global-map [C-home] 'beginning-of-buffer) |
| 829 | (define-key global-map [M-home] 'beginning-of-buffer-other-window) | 829 | (define-key global-map [M-home] 'beginning-of-buffer-other-window) |
| 830 | (define-key esc-map [home] 'beginning-of-buffer-other-window) | 830 | (define-key esc-map [home] 'beginning-of-buffer-other-window) |
| 831 | (define-key global-map [left] 'backward-char) | 831 | (define-key global-map [left] 'left-arrow-command) |
| 832 | (define-key global-map [up] 'previous-line) | 832 | (define-key global-map [up] 'previous-line) |
| 833 | (define-key global-map [right] 'forward-char) | 833 | (define-key global-map [right] 'right-arrow-command) |
| 834 | (define-key global-map [down] 'next-line) | 834 | (define-key global-map [down] 'next-line) |
| 835 | (define-key global-map [prior] 'scroll-down-command) | 835 | (define-key global-map [prior] 'scroll-down-command) |
| 836 | (define-key global-map [next] 'scroll-up-command) | 836 | (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\"." | |||
| 3804 | (prin1-to-string (make-hash-table))))) | 3804 | (prin1-to-string (make-hash-table))))) |
| 3805 | (provide 'hashtable-print-readable)) | 3805 | (provide 'hashtable-print-readable)) |
| 3806 | 3806 | ||
| 3807 | ;; Moving with arrows in bidi-sensitive direction. | ||
| 3808 | (defun right-arrow-command (&optional n) | ||
| 3809 | "Move point N characters to the right (to the left if N is negative). | ||
| 3810 | On reaching beginning or end of buffer, stop and signal error. | ||
| 3811 | |||
| 3812 | Depending on the bidirectional context, this may move either forward | ||
| 3813 | or backward in the buffer. This is in contrast with \\[forward-char] | ||
| 3814 | and \\[backward-char], which see." | ||
| 3815 | (interactive "^p") | ||
| 3816 | (if (eq (current-bidi-paragraph-direction) 'left-to-right) | ||
| 3817 | (forward-char n) | ||
| 3818 | (backward-char n))) | ||
| 3819 | |||
| 3820 | (defun left-arrow-command ( &optional n) | ||
| 3821 | "Move point N characters to the left (to the right if N is negative). | ||
| 3822 | On reaching beginning or end of buffer, stop and signal error. | ||
| 3823 | |||
| 3824 | Depending on the bidirectional context, this may move either backward | ||
| 3825 | or forward in the buffer. This is in contrast with \\[backward-char] | ||
| 3826 | and \\[forward-char], which see." | ||
| 3827 | (interactive "^p") | ||
| 3828 | (if (eq (current-bidi-paragraph-direction) 'left-to-right) | ||
| 3829 | (backward-char n) | ||
| 3830 | (forward-char n))) | ||
| 3831 | |||
| 3807 | ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc | 3832 | ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc |
| 3808 | ;;; subr.el ends here | 3833 | ;;; subr.el ends here |