comparison lisp/simple.el @ 61864:af1b504ffc35

(line-move-1): Avoid using vertical-motion in easy cases.
author Richard M. Stallman <rms@gnu.org>
date Tue, 26 Apr 2005 18:31:19 +0000
parents c0bf74e7fc30
children 5f3a630ef0ac
comparison
equal deleted inserted replaced
61863:2fe5da3b3da2 61864:af1b504ffc35
3401 ;; skip all characters with that same `invisible' property value. 3401 ;; skip all characters with that same `invisible' property value.
3402 (while (and (not (eobp)) (line-move-invisible-p (point))) 3402 (while (and (not (eobp)) (line-move-invisible-p (point)))
3403 (goto-char (next-char-property-change (point)))) 3403 (goto-char (next-char-property-change (point))))
3404 ;; Now move a line. 3404 ;; Now move a line.
3405 (end-of-line) 3405 (end-of-line)
3406 (and (zerop (vertical-motion 1)) 3406 ;; If there's no invisibility here, move over the newline.
3407 (if (not noerror) 3407 (if (not (line-move-invisible-p (point)))
3408 (signal 'end-of-buffer nil) 3408 ;; We avoid vertical-motion when possible
3409 (setq done t))) 3409 ;; because that has to fontify.
3410 (if (eobp)
3411 (setq done t)
3412 (forward-line 1))
3413 ;; Otherwise move a more sophisticated way.
3414 ;; (What's the logic behind this code?)
3415 (and (zerop (vertical-motion 1))
3416 (if (not noerror)
3417 (signal 'end-of-buffer nil)
3418 (setq done t))))
3410 (unless done 3419 (unless done
3411 (setq arg (1- arg)))) 3420 (setq arg (1- arg))))
3421 ;; The logic of this is the same as the loop above,
3422 ;; it just goes in the other direction.
3412 (while (and (< arg 0) (not done)) 3423 (while (and (< arg 0) (not done))
3413 (beginning-of-line) 3424 (beginning-of-line)
3414 3425 (if (not (line-move-invisible-p (1- (point))))
3415 (if (zerop (vertical-motion -1)) 3426 (if (bobp)
3416 (if (not noerror) 3427 (setq done t)
3417 (signal 'beginning-of-buffer nil) 3428 (forward-line -1))
3418 (setq done t))) 3429 (if (zerop (vertical-motion -1))
3430 (if (not noerror)
3431 (signal 'beginning-of-buffer nil)
3432 (setq done t))))
3419 (unless done 3433 (unless done
3420 (setq arg (1+ arg)) 3434 (setq arg (1+ arg))
3421 (while (and ;; Don't move over previous invis lines 3435 (while (and ;; Don't move over previous invis lines
3422 ;; if our target is the middle of this line. 3436 ;; if our target is the middle of this line.
3423 (or (zerop (or goal-column temporary-goal-column)) 3437 (or (zerop (or goal-column temporary-goal-column))