Mercurial > emacs
comparison lisp/simple.el @ 8309:a4dbf8e6c78f
(line-move, next-line): Check last line moved over
has a newline, in a way that intangible text does not confuse.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 24 Jul 1994 01:10:14 +0000 |
parents | 7f13bc5470d9 |
children | 40ab7df62402 |
comparison
equal
deleted
inserted
replaced
8308:9c9cbb121c37 | 8309:a4dbf8e6c78f |
---|---|
1489 using `forward-line' instead. It is usually easier to use | 1489 using `forward-line' instead. It is usually easier to use |
1490 and more reliable (no dependence on goal column, etc.)." | 1490 and more reliable (no dependence on goal column, etc.)." |
1491 (interactive "p") | 1491 (interactive "p") |
1492 (if (and next-line-add-newlines (= arg 1)) | 1492 (if (and next-line-add-newlines (= arg 1)) |
1493 (let ((opoint (point))) | 1493 (let ((opoint (point))) |
1494 (forward-line 1) | 1494 (end-of-line) |
1495 (if (or (= opoint (point)) (not (eq (preceding-char) ?\n))) | 1495 (if (eobp) |
1496 (insert ?\n) | 1496 (insert ?\n) |
1497 (goto-char opoint) | 1497 (goto-char opoint) |
1498 (line-move arg))) | 1498 (line-move arg))) |
1499 (line-move arg)) | 1499 (line-move arg)) |
1500 nil) | 1500 nil) |
1540 ;; unless we just did explicit end-of-line. | 1540 ;; unless we just did explicit end-of-line. |
1541 (or (not (bolp)) (eq last-command 'end-of-line))) | 1541 (or (not (bolp)) (eq last-command 'end-of-line))) |
1542 9999 | 1542 9999 |
1543 (current-column)))) | 1543 (current-column)))) |
1544 (if (not (integerp selective-display)) | 1544 (if (not (integerp selective-display)) |
1545 (or (and (zerop (forward-line arg)) | 1545 (or (if (> arg 0) |
1546 (bolp)) | 1546 (progn (if (> arg 1) (forward-line (1- arg))) |
1547 ;; This way of moving forward ARG lines | |
1548 ;; verifies that we have a newline after the last one. | |
1549 ;; It doesn't get confused by intangible text. | |
1550 (end-of-line) | |
1551 (zerop (forward-line 1))) | |
1552 (and (zerop (forward-line arg)) | |
1553 (bolp))) | |
1547 (signal (if (bobp) | 1554 (signal (if (bobp) |
1548 'beginning-of-buffer | 1555 'beginning-of-buffer |
1549 'end-of-buffer) | 1556 'end-of-buffer) |
1550 nil)) | 1557 nil)) |
1551 ;; Move by arg lines, but ignore invisible ones. | 1558 ;; Move by arg lines, but ignore invisible ones. |