aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-06-29 21:36:37 +0000
committerRichard M. Stallman1997-06-29 21:36:37 +0000
commit9e7a6b30920538f39e135c58f869e1298a6c19f4 (patch)
tree7247e4712d2f27b9b3e3a6e98c9ab12bb8e6157c
parentaf26b38bd113fc3e90fee6c0137df22fe3e4ea74 (diff)
downloademacs-9e7a6b30920538f39e135c58f869e1298a6c19f4.tar.gz
emacs-9e7a6b30920538f39e135c58f869e1298a6c19f4.zip
(forward-visible-line): Handle 0 arg correctly.
-rw-r--r--lisp/simple.el46
1 files changed, 25 insertions, 21 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index bcf03192b6a..ac3ad50cecd 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1157,28 +1157,32 @@ when given no argument at the beginning of a line."
1157 (point)))) 1157 (point))))
1158 1158
1159(defun forward-visible-line (arg) 1159(defun forward-visible-line (arg)
1160 "Move forward by ARG lines, ignoring currently invisible newlines only." 1160 "Move forward by ARG lines, ignoring currently invisible newlines only.
1161If ARG is negative, move backward -ARG lines.
1162If ARG is zero, move to the beginning of the current line."
1161 (condition-case nil 1163 (condition-case nil
1162 (progn 1164 (if (>= arg 0)
1163 (while (> arg 0) 1165 (while (>= arg 0)
1164 (or (zerop (forward-line 1)) 1166 (if (zerop arg)
1165 (signal 'end-of-buffer nil)) 1167 (beginning-of-line)
1166 ;; If the following character is currently invisible, 1168 (or (zerop (forward-line 1))
1167 ;; skip all characters with that same `invisible' property value, 1169 (signal 'end-of-buffer nil)))
1168 ;; then find the next newline. 1170 ;; If the following character is currently invisible,
1169 (while (and (not (eobp)) 1171 ;; skip all characters with that same `invisible' property value,
1170 (let ((prop 1172 ;; then find the next newline.
1171 (get-char-property (point) 'invisible))) 1173 (while (and (not (eobp))
1172 (if (eq buffer-invisibility-spec t) 1174 (let ((prop
1173 prop 1175 (get-char-property (point) 'invisible)))
1174 (or (memq prop buffer-invisibility-spec) 1176 (if (eq buffer-invisibility-spec t)
1175 (assq prop buffer-invisibility-spec))))) 1177 prop
1176 (if (get-text-property (point) 'invisible) 1178 (or (memq prop buffer-invisibility-spec)
1177 (goto-char (next-single-property-change (point) 'invisible)) 1179 (assq prop buffer-invisibility-spec)))))
1178 (goto-char (next-overlay-change (point)))) 1180 (if (get-text-property (point) 'invisible)
1179 (or (zerop (forward-line 1)) 1181 (goto-char (next-single-property-change (point) 'invisible))
1180 (signal 'end-of-buffer nil))) 1182 (goto-char (next-overlay-change (point))))
1181 (setq arg (1- arg))) 1183 (or (zerop (forward-line 1))
1184 (signal 'end-of-buffer nil)))
1185 (setq arg (1- arg)))
1182 (while (< arg 0) 1186 (while (< arg 0)
1183 (or (zerop (vertical-motion -1)) 1187 (or (zerop (vertical-motion -1))
1184 (signal 'beginning-of-buffer nil)) 1188 (signal 'beginning-of-buffer nil))