Mercurial > emacs
comparison lisp/subr.el @ 108824:8aaae2681a62
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>.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 29 May 2010 18:19:13 +0300 |
parents | fe3c51344472 |
children | 2f74da21b147 |
comparison
equal
deleted
inserted
replaced
108823:99cde7115a1a | 108824:8aaae2681a62 |
---|---|
3800 ;; be used there. | 3800 ;; be used there. |
3801 (when (hash-table-p (car (read-from-string | 3801 (when (hash-table-p (car (read-from-string |
3802 (prin1-to-string (make-hash-table))))) | 3802 (prin1-to-string (make-hash-table))))) |
3803 (provide 'hashtable-print-readable)) | 3803 (provide 'hashtable-print-readable)) |
3804 | 3804 |
3805 ;; Moving with arrows in bidi-sensitive direction. | |
3806 (defun right-arrow-command (&optional n) | |
3807 "Move point N characters to the right (to the left if N is negative). | |
3808 On reaching beginning or end of buffer, stop and signal error. | |
3809 | |
3810 Depending on the bidirectional context, this may move either forward | |
3811 or backward in the buffer. This is in contrast with \\[forward-char] | |
3812 and \\[backward-char], which see." | |
3813 (interactive "^p") | |
3814 (if (eq (current-bidi-paragraph-direction) 'left-to-right) | |
3815 (forward-char n) | |
3816 (backward-char n))) | |
3817 | |
3818 (defun left-arrow-command ( &optional n) | |
3819 "Move point N characters to the left (to the right if N is negative). | |
3820 On reaching beginning or end of buffer, stop and signal error. | |
3821 | |
3822 Depending on the bidirectional context, this may move either backward | |
3823 or forward in the buffer. This is in contrast with \\[backward-char] | |
3824 and \\[forward-char], which see." | |
3825 (interactive "^p") | |
3826 (if (eq (current-bidi-paragraph-direction) 'left-to-right) | |
3827 (backward-char n) | |
3828 (forward-char n))) | |
3829 | |
3830 ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc | 3805 ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc |
3831 ;;; subr.el ends here | 3806 ;;; subr.el ends here |