# HG changeset patch # User Richard M. Stallman # Date 1114540279 0 # Node ID af1b504ffc35568e5ca12ff4cad39a19b0e6e103 # Parent 2fe5da3b3da2de366eebff5b2b884733b7701ab8 (line-move-1): Avoid using vertical-motion in easy cases. diff -r 2fe5da3b3da2 -r af1b504ffc35 lisp/simple.el --- a/lisp/simple.el Tue Apr 26 18:24:52 2005 +0000 +++ b/lisp/simple.el Tue Apr 26 18:31:19 2005 +0000 @@ -3403,19 +3403,33 @@ (goto-char (next-char-property-change (point)))) ;; Now move a line. (end-of-line) - (and (zerop (vertical-motion 1)) - (if (not noerror) - (signal 'end-of-buffer nil) - (setq done t))) + ;; If there's no invisibility here, move over the newline. + (if (not (line-move-invisible-p (point))) + ;; We avoid vertical-motion when possible + ;; because that has to fontify. + (if (eobp) + (setq done t) + (forward-line 1)) + ;; Otherwise move a more sophisticated way. + ;; (What's the logic behind this code?) + (and (zerop (vertical-motion 1)) + (if (not noerror) + (signal 'end-of-buffer nil) + (setq done t)))) (unless done (setq arg (1- arg)))) + ;; The logic of this is the same as the loop above, + ;; it just goes in the other direction. (while (and (< arg 0) (not done)) (beginning-of-line) - - (if (zerop (vertical-motion -1)) - (if (not noerror) - (signal 'beginning-of-buffer nil) - (setq done t))) + (if (not (line-move-invisible-p (1- (point)))) + (if (bobp) + (setq done t) + (forward-line -1)) + (if (zerop (vertical-motion -1)) + (if (not noerror) + (signal 'beginning-of-buffer nil) + (setq done t)))) (unless done (setq arg (1+ arg)) (while (and ;; Don't move over previous invis lines