comparison lisp/simple.el @ 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 15014ba142a7
children 562d2dea4f05
comparison
equal deleted inserted replaced
2576:48318133e7a6 2577:b28675709d41
1385 (message (substitute-command-keys 1385 (message (substitute-command-keys
1386 "Goal column %d (use \\[set-goal-column] with an arg to unset it)") 1386 "Goal column %d (use \\[set-goal-column] with an arg to unset it)")
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."
1393 (interactive "P") 1398 (interactive "P")
1394 (forward-char arg) 1399 (forward-char arg)
1402 (interactive "P") 1407 (interactive "P")
1403 (backward-char arg) 1408 (backward-char arg)
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.
1410 With prefix arg ARG, effect is to take character before point 1424 With prefix arg ARG, effect is to take character before point
1411 and drag it forward past ARG other characters (backward if ARG negative). 1425 and drag it forward past ARG other characters (backward if ARG negative).