changeset 72853:4ee2b4b1cf76

(line-move-partial): Optimize.
author Kim F. Storm <storm@cua.dk>
date Wed, 13 Sep 2006 22:28:03 +0000
parents 4cbfea1dd65e
children f295b430aa3a
files lisp/simple.el
diffstat 1 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Wed Sep 13 22:27:51 2006 +0000
+++ b/lisp/simple.el	Wed Sep 13 22:28:03 2006 +0000
@@ -3487,28 +3487,27 @@
 	  (set-window-vscroll nil (- vs (frame-char-height)) t)))
 
     ;; Move forward (down).
-    (let* ((ppos (posn-at-point))
-	   (py (cdr (or (posn-actual-col-row ppos)
-			(posn-col-row ppos))))
-	   (vs (window-vscroll nil t))
-	   (evis (or (pos-visible-in-window-p (window-end nil t) nil t)
+    (let* ((evis (or (pos-visible-in-window-p (window-end nil t) nil t)
 		     (pos-visible-in-window-p (1- (window-end nil t)) nil t)))
 	   (rbot (nth 3 evis))
-	   (vpos (nth 5 evis)))
+	   (vpos (nth 5 evis))
+	   ppos py vs)
       (cond
-       ;; (0) Last window line should be visible - fail if not.
+       ;; Last window line should be visible - fail if not.
        ((null evis)
 	nil)
        ;; If last line of window is fully visible, move forward.
        ((null rbot)
 	nil)
        ;; If cursor is not in the bottom scroll margin, move forward.
-       ((< py (min (- (window-text-height) scroll-margin 1)
-		   (1- vpos)))
+       ((< (setq ppos (posn-at-point)
+		 py (cdr (or (posn-actual-col-row ppos)
+			     (posn-col-row ppos))))
+	   (min (- (window-text-height) scroll-margin 1) (1- vpos)))
 	nil)
        ;; When already vscrolled, we vscroll some more if we can,
        ;; or clear vscroll and move forward at end of tall image.
-       ((> vs 0)
+       ((> (setq vs (window-vscroll nil t)) 0)
 	(when (> rbot 0)
 	  (set-window-vscroll nil (+ vs (min rbot (frame-char-height))) t)))
        ;; If cursor just entered the bottom scroll margin, move forward,