diff options
| author | Richard M. Stallman | 1995-04-09 09:34:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-04-09 09:34:05 +0000 |
| commit | 8c7457442dbfacd98146eb30b26cc0a2ab4266e9 (patch) | |
| tree | 567b1d440cce17116f547e10b773bcbcd4144369 | |
| parent | 06ff75391c26ea0de13329717472acfc352c72d8 (diff) | |
| download | emacs-8c7457442dbfacd98146eb30b26cc0a2ab4266e9.tar.gz emacs-8c7457442dbfacd98146eb30b26cc0a2ab4266e9.zip | |
(line-move): Turn off intangibility for intermediate stops.
| -rw-r--r-- | lisp/simple.el | 131 |
1 files changed, 71 insertions, 60 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index b7515e2015e..943155cfab4 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1601,67 +1601,78 @@ When the `track-eol' feature is doing its job, the value is 9999.") | |||
| 1601 | "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. | 1601 | "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. |
| 1602 | Outline mode sets this.") | 1602 | Outline mode sets this.") |
| 1603 | 1603 | ||
| 1604 | ;; This is the guts of next-line and previous-line. | ||
| 1605 | ;; Arg says how many lines to move. | ||
| 1604 | (defun line-move (arg) | 1606 | (defun line-move (arg) |
| 1605 | (if (not (or (eq last-command 'next-line) | 1607 | (let (new) |
| 1606 | (eq last-command 'previous-line))) | 1608 | ;; Don't run any point-motion hooks, and disregard intangibility, |
| 1607 | (setq temporary-goal-column | 1609 | ;; for intermediate positions. |
| 1608 | (if (and track-eol (eolp) | 1610 | (let ((inhibit-point-motion-hooks t)) |
| 1609 | ;; Don't count beg of empty line as end of line | 1611 | (save-excursion |
| 1610 | ;; unless we just did explicit end-of-line. | 1612 | (if (not (or (eq last-command 'next-line) |
| 1611 | (or (not (bolp)) (eq last-command 'end-of-line))) | 1613 | (eq last-command 'previous-line))) |
| 1612 | 9999 | 1614 | (setq temporary-goal-column |
| 1613 | (current-column)))) | 1615 | (if (and track-eol (eolp) |
| 1614 | (if (and (not (integerp selective-display)) | 1616 | ;; Don't count beg of empty line as end of line |
| 1615 | (not line-move-ignore-invisible)) | 1617 | ;; unless we just did explicit end-of-line. |
| 1616 | ;; Use just newline characters. | 1618 | (or (not (bolp)) (eq last-command 'end-of-line))) |
| 1617 | (or (if (> arg 0) | 1619 | 9999 |
| 1618 | (progn (if (> arg 1) (forward-line (1- arg))) | 1620 | (current-column)))) |
| 1619 | ;; This way of moving forward ARG lines | 1621 | (if (and (not (integerp selective-display)) |
| 1620 | ;; verifies that we have a newline after the last one. | 1622 | (not line-move-ignore-invisible)) |
| 1621 | ;; It doesn't get confused by intangible text. | 1623 | ;; Use just newline characters. |
| 1622 | (end-of-line) | 1624 | (or (if (> arg 0) |
| 1623 | (zerop (forward-line 1))) | 1625 | (progn (if (> arg 1) (forward-line (1- arg))) |
| 1624 | (and (zerop (forward-line arg)) | 1626 | ;; This way of moving forward ARG lines |
| 1625 | (bolp))) | 1627 | ;; verifies that we have a newline after the last one. |
| 1626 | (signal (if (< arg 0) | 1628 | ;; It doesn't get confused by intangible text. |
| 1627 | 'beginning-of-buffer | 1629 | (end-of-line) |
| 1628 | 'end-of-buffer) | 1630 | (zerop (forward-line 1))) |
| 1629 | nil)) | 1631 | (and (zerop (forward-line arg)) |
| 1630 | ;; Move by arg lines, but ignore invisible ones. | 1632 | (bolp))) |
| 1631 | (while (> arg 0) | 1633 | (signal (if (< arg 0) |
| 1632 | (end-of-line) | 1634 | 'beginning-of-buffer |
| 1633 | (and (zerop (vertical-motion 1)) | 1635 | 'end-of-buffer) |
| 1634 | (signal 'end-of-buffer nil)) | 1636 | nil)) |
| 1635 | ;; If the following character is currently invisible, | 1637 | ;; Move by arg lines, but ignore invisible ones. |
| 1636 | ;; skip all characters with that same `invisible' property value. | 1638 | (while (> arg 0) |
| 1637 | (while (and (not (eobp)) | 1639 | (end-of-line) |
| 1638 | (let ((prop | 1640 | (and (zerop (vertical-motion 1)) |
| 1639 | (get-char-property (point) 'invisible))) | 1641 | (signal 'end-of-buffer nil)) |
| 1640 | (if (eq buffer-invisibility-spec t) | 1642 | ;; If the following character is currently invisible, |
| 1641 | prop | 1643 | ;; skip all characters with that same `invisible' property value. |
| 1642 | (or (memq prop buffer-invisibility-spec) | 1644 | (while (and (not (eobp)) |
| 1643 | (assq prop buffer-invisibility-spec))))) | 1645 | (let ((prop |
| 1644 | (if (get-text-property (point) 'invisible) | 1646 | (get-char-property (point) 'invisible))) |
| 1645 | (goto-char (next-single-property-change (point) 'invisible)) | 1647 | (if (eq buffer-invisibility-spec t) |
| 1646 | (goto-char (next-overlay-change (point))))) | 1648 | prop |
| 1647 | (setq arg (1- arg))) | 1649 | (or (memq prop buffer-invisibility-spec) |
| 1648 | (while (< arg 0) | 1650 | (assq prop buffer-invisibility-spec))))) |
| 1649 | (beginning-of-line) | 1651 | (if (get-text-property (point) 'invisible) |
| 1650 | (and (zerop (vertical-motion -1)) | 1652 | (goto-char (next-single-property-change (point) 'invisible)) |
| 1651 | (signal 'beginning-of-buffer nil)) | 1653 | (goto-char (next-overlay-change (point))))) |
| 1652 | (while (and (not (bobp)) | 1654 | (setq arg (1- arg))) |
| 1653 | (let ((prop | 1655 | (while (< arg 0) |
| 1654 | (get-char-property (1- (point)) 'invisible))) | 1656 | (beginning-of-line) |
| 1655 | (if (eq buffer-invisibility-spec t) | 1657 | (and (zerop (vertical-motion -1)) |
| 1656 | prop | 1658 | (signal 'beginning-of-buffer nil)) |
| 1657 | (or (memq prop buffer-invisibility-spec) | 1659 | (while (and (not (bobp)) |
| 1658 | (assq prop buffer-invisibility-spec))))) | 1660 | (let ((prop |
| 1659 | (if (get-text-property (1- (point)) 'invisible) | 1661 | (get-char-property (1- (point)) 'invisible))) |
| 1660 | (goto-char (previous-single-property-change (point) 'invisible)) | 1662 | (if (eq buffer-invisibility-spec t) |
| 1661 | (goto-char (previous-overlay-change (point))))) | 1663 | prop |
| 1662 | (setq arg (1+ arg)))) | 1664 | (or (memq prop buffer-invisibility-spec) |
| 1663 | (move-to-column (or goal-column temporary-goal-column)) | 1665 | (assq prop buffer-invisibility-spec))))) |
| 1664 | nil) | 1666 | (if (get-text-property (1- (point)) 'invisible) |
| 1667 | (goto-char (previous-single-property-change (point) 'invisible)) | ||
| 1668 | (goto-char (previous-overlay-change (point))))) | ||
| 1669 | (setq arg (1+ arg)))) | ||
| 1670 | (move-to-column (or goal-column temporary-goal-column)) | ||
| 1671 | (setq new (point)))) | ||
| 1672 | ;; Run any point-motion hooks, deal with intangible text, etc., | ||
| 1673 | ;; once and for all, for the entire motion we did. | ||
| 1674 | (goto-char new) | ||
| 1675 | nil)) | ||
| 1665 | 1676 | ||
| 1666 | ;;; Many people have said they rarely use this feature, and often type | 1677 | ;;; Many people have said they rarely use this feature, and often type |
| 1667 | ;;; it by accident. Maybe it shouldn't even be on a key. | 1678 | ;;; it by accident. Maybe it shouldn't even be on a key. |