comparison lisp/simple.el @ 90600:84dd84b43e1b

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 423-426) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 131-133) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-109
author Miles Bader <miles@gnu.org>
date Wed, 06 Sep 2006 07:30:39 +0000
parents c358d0861b16 aa474eace5e0
children a1a25ac6c88a
comparison
equal deleted inserted replaced
90599:c358d0861b16 90600:84dd84b43e1b
3475 (if (eq buffer-invisibility-spec t) 3475 (if (eq buffer-invisibility-spec t)
3476 prop 3476 prop
3477 (or (memq prop buffer-invisibility-spec) 3477 (or (memq prop buffer-invisibility-spec)
3478 (assq prop buffer-invisibility-spec))))) 3478 (assq prop buffer-invisibility-spec)))))
3479 3479
3480 ;; Returns non-nil if partial move was done.
3481 (defun line-move-partial (arg noerror to-end)
3482 (if (< arg 0)
3483 ;; Move backward (up).
3484 ;; If already vscrolled, reduce vscroll
3485 (let ((vs (window-vscroll nil t)))
3486 (when (> vs (frame-char-height))
3487 (set-window-vscroll nil (- vs (frame-char-height)) t)))
3488
3489 ;; Move forward (down).
3490 (let* ((ppos (posn-at-point))
3491 (py (cdr (or (posn-actual-col-row ppos)
3492 (posn-col-row ppos))))
3493 (vs (window-vscroll nil t))
3494 (evis (or (pos-visible-in-window-p (window-end nil t) nil t)
3495 (pos-visible-in-window-p (1- (window-end nil t)) nil t)))
3496 (rbot (nth 3 evis))
3497 (vpos (nth 5 evis)))
3498 (cond
3499 ;; (0) Last window line should be visible - fail if not.
3500 ((null evis)
3501 nil)
3502 ;; If last line of window is fully visible, move forward.
3503 ((null rbot)
3504 nil)
3505 ;; If cursor is not in the bottom scroll margin, move forward.
3506 ((< py (min (- (window-text-height) scroll-margin 1)
3507 (1- vpos)))
3508 nil)
3509 ;; When already vscrolled, we vscroll some more if we can,
3510 ;; or clear vscroll and move forward at end of tall image.
3511 ((> vs 0)
3512 (when (> rbot 0)
3513 (set-window-vscroll nil (+ vs (min rbot (frame-char-height))) t)))
3514 ;; If cursor just entered the bottom scroll margin, move forward,
3515 ;; but also vscroll one line so redisplay wont recenter.
3516 ((= py (min (- (window-text-height) scroll-margin 1)
3517 (1- vpos)))
3518 (set-window-vscroll nil (frame-char-height) t)
3519 (line-move-1 arg noerror to-end)
3520 t)
3521 ;; If there are lines above the last line, scroll-up one line.
3522 ((> vpos 0)
3523 (scroll-up 1)
3524 t)
3525 ;; Finally, start vscroll.
3526 (t
3527 (set-window-vscroll nil (frame-char-height) t))))))
3528
3529
3480 ;; This is like line-move-1 except that it also performs 3530 ;; This is like line-move-1 except that it also performs
3481 ;; vertical scrolling of tall images if appropriate. 3531 ;; vertical scrolling of tall images if appropriate.
3482 ;; That is not really a clean thing to do, since it mixes 3532 ;; That is not really a clean thing to do, since it mixes
3483 ;; scrolling with cursor motion. But so far we don't have 3533 ;; scrolling with cursor motion. But so far we don't have
3484 ;; a cleaner solution to the problem of making C-n do something 3534 ;; a cleaner solution to the problem of making C-n do something
3485 ;; useful given a tall image. 3535 ;; useful given a tall image.
3486 (defun line-move (arg &optional noerror to-end try-vscroll) 3536 (defun line-move (arg &optional noerror to-end try-vscroll)
3487 (if (and auto-window-vscroll try-vscroll 3537 (unless (and auto-window-vscroll try-vscroll
3488 ;; But don't vscroll in a keyboard macro. 3538 ;; Only vscroll for single line moves
3489 (not defining-kbd-macro) 3539 (= (abs arg) 1)
3490 (not executing-kbd-macro)) 3540 ;; But don't vscroll in a keyboard macro.
3491 (let ((forward (> arg 0)) 3541 (not defining-kbd-macro)
3492 (part (nth 2 (pos-visible-in-window-p (point) nil t)))) 3542 (not executing-kbd-macro)
3493 (if (and (consp part) 3543 (line-move-partial arg noerror to-end))
3494 (> (if forward (cdr part) (car part)) 0)) 3544 (set-window-vscroll nil 0 t)
3495 (set-window-vscroll nil
3496 (if forward
3497 (+ (window-vscroll nil t)
3498 (min (cdr part)
3499 (* (frame-char-height) arg)))
3500 (max 0
3501 (- (window-vscroll nil t)
3502 (min (car part)
3503 (* (frame-char-height) (- arg))))))
3504 t)
3505 (set-window-vscroll nil 0)
3506 (when (line-move-1 arg noerror to-end)
3507 (when (not forward)
3508 ;; Update display before calling pos-visible-in-window-p,
3509 ;; because it depends on window-start being up-to-date.
3510 (sit-for 0)
3511 ;; If the current line is partly hidden at the bottom,
3512 ;; scroll it partially up so as to unhide the bottom.
3513 (if (and (setq part (nth 2 (pos-visible-in-window-p
3514 (line-beginning-position) nil t)))
3515 (> (cdr part) 0))
3516 (set-window-vscroll nil (cdr part) t)))
3517 t)))
3518 (line-move-1 arg noerror to-end))) 3545 (line-move-1 arg noerror to-end)))
3519 3546
3520 ;; This is the guts of next-line and previous-line. 3547 ;; This is the guts of next-line and previous-line.
3521 ;; Arg says how many lines to move. 3548 ;; Arg says how many lines to move.
3522 ;; The value is t if we can move the specified number of lines. 3549 ;; The value is t if we can move the specified number of lines.