aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorRichard M. Stallman2002-01-13 04:02:49 +0000
committerRichard M. Stallman2002-01-13 04:02:49 +0000
commite9cd25fe9de33da7e2fdd905647ec31ae1b8a231 (patch)
tree6c7d8725eb545a395db5d58766cd2bed9465c8a1 /lisp/simple.el
parent879fa8d0a9557474ebb4f7a6d621433fdf3b1d52 (diff)
downloademacs-e9cd25fe9de33da7e2fdd905647ec31ae1b8a231.tar.gz
emacs-e9cd25fe9de33da7e2fdd905647ec31ae1b8a231.zip
(line-move): If we can't move enough lines, go to beginning or end of line.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el20
1 files changed, 16 insertions, 4 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 6cfc1b306af..56b45e03836 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2562,18 +2562,21 @@ Outline mode sets this."
2562 (if (and (not (integerp selective-display)) 2562 (if (and (not (integerp selective-display))
2563 (not line-move-ignore-invisible)) 2563 (not line-move-ignore-invisible))
2564 ;; Use just newline characters. 2564 ;; Use just newline characters.
2565 ;; Set ARG to 0 if we move as many lines as requested.
2565 (or (if (> arg 0) 2566 (or (if (> arg 0)
2566 (progn (if (> arg 1) (forward-line (1- arg))) 2567 (progn (if (> arg 1) (forward-line (1- arg)))
2567 ;; This way of moving forward ARG lines 2568 ;; This way of moving forward ARG lines
2568 ;; verifies that we have a newline after the last one. 2569 ;; verifies that we have a newline after the last one.
2569 ;; It doesn't get confused by intangible text. 2570 ;; It doesn't get confused by intangible text.
2570 (end-of-line) 2571 (end-of-line)
2571 (zerop (forward-line 1))) 2572 (if (zerop (forward-line 1))
2573 (setq arg 0)))
2572 (and (zerop (forward-line arg)) 2574 (and (zerop (forward-line arg))
2573 (bolp))) 2575 (bolp)
2576 (setq arg 0)))
2574 (signal (if (< arg 0) 2577 (signal (if (< arg 0)
2575 'beginning-of-buffer 2578 'beginning-of-buffer
2576a 'end-of-buffer) 2579 'end-of-buffer)
2577 nil)) 2580 nil))
2578 ;; Move by arg lines, but ignore invisible ones. 2581 ;; Move by arg lines, but ignore invisible ones.
2579 (while (> arg 0) 2582 (while (> arg 0)
@@ -2594,7 +2597,16 @@ a 'end-of-buffer)
2594 (while (and (not (bobp)) (line-move-invisible (1- (point)))) 2597 (while (and (not (bobp)) (line-move-invisible (1- (point))))
2595 (goto-char (previous-char-property-change (point))))))) 2598 (goto-char (previous-char-property-change (point)))))))
2596 2599
2597 (line-move-finish (or goal-column temporary-goal-column) opoint))) 2600 (cond ((> arg 0)
2601 ;; If we did not move down as far as desired,
2602 ;; at least go to end of line.
2603 (end-of-line))
2604 ((< arg 0)
2605 ;; If we did not move down as far as desired,
2606 ;; at least go to end of line.
2607 (beginning-of-line))
2608 (t
2609 (line-move-finish (or goal-column temporary-goal-column) opoint)))))
2598 nil) 2610 nil)
2599 2611
2600(defun line-move-finish (column opoint) 2612(defun line-move-finish (column opoint)