changeset 2577:b28675709d41

(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.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Sun, 25 Apr 1993 06:14:13 +0000
parents 48318133e7a6
children f694fc6cdd33
files lisp/simple.el
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sun Apr 25 06:14:10 1993 +0000
+++ b/lisp/simple.el	Sun Apr 25 06:14:13 1993 +0000
@@ -1387,6 +1387,11 @@
 	     goal-column))
   nil)
 
+;;; Make arrow keys do the right thing for improved terminal support
+;;; When we implement true horizontal autoscrolling, right-arrow and
+;;; left-arrow can lose the (if truncate-lines ...) clause and become
+;;; aliases.
+
 (defun right-arrow (arg)
   "Move right one character on the screen (with prefix ARG, that many chars).
 Scroll right if needed to keep point horizontally onscreen."
@@ -1404,6 +1409,15 @@
   (if truncate-lines
       (let ((x (current-column)) (w (- (window-width) 2)))
 	(set-window-hscroll (selected-window) (- x (% x w)) ))))
+
+(defun down-arrow (arg)
+  "Move down one line on the screen (with prefix ARG, that many lines).
+If doing so would add lines to the end of the buffer, raise an error."
+  (interactive "P")
+  (let ((next-line-add-newlines nil))
+    (next-line 1)))
+
+(defalias 'up-arrow 'previous-line)
 
 (defun transpose-chars (arg)
   "Interchange characters around point, moving forward one character.