aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-03-10 03:27:46 +0000
committerRichard M. Stallman1995-03-10 03:27:46 +0000
commit098fc1fbf12372d7d9e5ebcf3fb6b40df29f693a (patch)
tree1faf3c553d44ae6d6f26a34142ff74d209700dc5
parentc3de2bf0018ce0bb6e147dbbc010ae02869c64d5 (diff)
downloademacs-098fc1fbf12372d7d9e5ebcf3fb6b40df29f693a.tar.gz
emacs-098fc1fbf12372d7d9e5ebcf3fb6b40df29f693a.zip
(line-move-ignore-invisible): New variable.
(line-move): If that var is set, use vertical-motion. Skip any extra invis chars beyond where vertical-motion stops.
-rw-r--r--lisp/simple.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 8fc7727b0fb..50ee7a90cc0 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1569,6 +1569,10 @@ It is the column where point was
1569at the start of current run of vertical motion commands. 1569at the start of current run of vertical motion commands.
1570When the `track-eol' feature is doing its job, the value is 9999.") 1570When the `track-eol' feature is doing its job, the value is 9999.")
1571 1571
1572(defvar line-move-ignore-invisible nil
1573 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
1574Outline mode sets this.")
1575
1572(defun line-move (arg) 1576(defun line-move (arg)
1573 (if (not (or (eq last-command 'next-line) 1577 (if (not (or (eq last-command 'next-line)
1574 (eq last-command 'previous-line))) 1578 (eq last-command 'previous-line)))
@@ -1579,7 +1583,9 @@ When the `track-eol' feature is doing its job, the value is 9999.")
1579 (or (not (bolp)) (eq last-command 'end-of-line))) 1583 (or (not (bolp)) (eq last-command 'end-of-line)))
1580 9999 1584 9999
1581 (current-column)))) 1585 (current-column))))
1582 (if (not (integerp selective-display)) 1586 (if (and (not (integerp selective-display))
1587 (not line-move-ignore-invisible))
1588 ;; Use just newline characters.
1583 (or (if (> arg 0) 1589 (or (if (> arg 0)
1584 (progn (if (> arg 1) (forward-line (1- arg))) 1590 (progn (if (> arg 1) (forward-line (1- arg)))
1585 ;; This way of moving forward ARG lines 1591 ;; This way of moving forward ARG lines
@@ -1598,11 +1604,27 @@ When the `track-eol' feature is doing its job, the value is 9999.")
1598 (end-of-line) 1604 (end-of-line)
1599 (and (zerop (vertical-motion 1)) 1605 (and (zerop (vertical-motion 1))
1600 (signal 'end-of-buffer nil)) 1606 (signal 'end-of-buffer nil))
1607 ;; If the following character is currently invisible,
1608 ;; skip all characters with that same `invisible' property value.
1609 (while (and (not (eobp))
1610 (let ((prop
1611 (get-char-property (point) 'invisible)))
1612 (if (eq buffer-invisibility-spec t)
1613 prop
1614 (memq prop buffer-invisibility-spec))))
1615 (goto-char (next-single-property-change (point) 'invisible)))
1601 (setq arg (1- arg))) 1616 (setq arg (1- arg)))
1602 (while (< arg 0) 1617 (while (< arg 0)
1603 (beginning-of-line) 1618 (beginning-of-line)
1604 (and (zerop (vertical-motion -1)) 1619 (and (zerop (vertical-motion -1))
1605 (signal 'beginning-of-buffer nil)) 1620 (signal 'beginning-of-buffer nil))
1621 (while (and (not (bobp))
1622 (let ((prop
1623 (get-char-property (point) 'invisible)))
1624 (if (eq buffer-invisibility-spec t)
1625 prop
1626 (memq prop buffer-invisibility-spec))))
1627 (goto-char (previous-single-property-change (point) 'invisible)))
1606 (setq arg (1+ arg)))) 1628 (setq arg (1+ arg))))
1607 (move-to-column (or goal-column temporary-goal-column)) 1629 (move-to-column (or goal-column temporary-goal-column))
1608 nil) 1630 nil)