diff options
| author | Eric S. Raymond | 1993-04-25 06:14:13 +0000 |
|---|---|---|
| committer | Eric S. Raymond | 1993-04-25 06:14:13 +0000 |
| commit | 3ab1f5b5ef5f7bd4753cec1c511c7dadde4a7b82 (patch) | |
| tree | 60e75a866c5e58229657754c02da01a552ff57df | |
| parent | 2f3067de92814d0b2f7236097a095e57c202dfe7 (diff) | |
| download | emacs-3ab1f5b5ef5f7bd4753cec1c511c7dadde4a7b82.tar.gz emacs-3ab1f5b5ef5f7bd4753cec1c511c7dadde4a7b82.zip | |
(down-arrow): New function. Uses next-line-add-newlines to suppress
addition of new lines at end of buffer.
(up-arrow): Alias of previous-line, added for consistency.
These changes complete terminal-type-independent support for arrow keys.
| -rw-r--r-- | lisp/simple.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 1662127fe57..3731fbebb13 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1387,6 +1387,11 @@ The goal column is stored in the variable `goal-column'." | |||
| 1387 | goal-column)) | 1387 | goal-column)) |
| 1388 | nil) | 1388 | nil) |
| 1389 | 1389 | ||
| 1390 | ;;; Make arrow keys do the right thing for improved terminal support | ||
| 1391 | ;;; When we implement true horizontal autoscrolling, right-arrow and | ||
| 1392 | ;;; left-arrow can lose the (if truncate-lines ...) clause and become | ||
| 1393 | ;;; aliases. | ||
| 1394 | |||
| 1390 | (defun right-arrow (arg) | 1395 | (defun right-arrow (arg) |
| 1391 | "Move right one character on the screen (with prefix ARG, that many chars). | 1396 | "Move right one character on the screen (with prefix ARG, that many chars). |
| 1392 | Scroll right if needed to keep point horizontally onscreen." | 1397 | Scroll right if needed to keep point horizontally onscreen." |
| @@ -1404,6 +1409,15 @@ Scroll left if needed to keep point horizontally onscreen." | |||
| 1404 | (if truncate-lines | 1409 | (if truncate-lines |
| 1405 | (let ((x (current-column)) (w (- (window-width) 2))) | 1410 | (let ((x (current-column)) (w (- (window-width) 2))) |
| 1406 | (set-window-hscroll (selected-window) (- x (% x w)) )))) | 1411 | (set-window-hscroll (selected-window) (- x (% x w)) )))) |
| 1412 | |||
| 1413 | (defun down-arrow (arg) | ||
| 1414 | "Move down one line on the screen (with prefix ARG, that many lines). | ||
| 1415 | If doing so would add lines to the end of the buffer, raise an error." | ||
| 1416 | (interactive "P") | ||
| 1417 | (let ((next-line-add-newlines nil)) | ||
| 1418 | (next-line 1))) | ||
| 1419 | |||
| 1420 | (defalias 'up-arrow 'previous-line) | ||
| 1407 | 1421 | ||
| 1408 | (defun transpose-chars (arg) | 1422 | (defun transpose-chars (arg) |
| 1409 | "Interchange characters around point, moving forward one character. | 1423 | "Interchange characters around point, moving forward one character. |