comparison lisp/window.el @ 106200:34a3dd721f80

(move-to-window-line-last-op): Remove. (move-to-window-line-top-bottom): Reuse recenter-last-op instead.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 23 Nov 2009 05:37:34 +0000
parents eaae8a5d935f
children 8cb41d65f821
comparison
equal deleted inserted replaced
106199:eaae8a5d935f 106200:34a3dd721f80
1651 (setq recenter-last-op 'bottom) 1651 (setq recenter-last-op 'bottom)
1652 (recenter (- -1 this-scroll-margin)))))))) 1652 (recenter (- -1 this-scroll-margin))))))))
1653 1653
1654 (define-key global-map [?\C-l] 'recenter-top-bottom) 1654 (define-key global-map [?\C-l] 'recenter-top-bottom)
1655 1655
1656 (defvar move-to-window-line-last-op nil
1657 "Indicates the last move-to-window-line operation performed.
1658 Possible values: `top', `middle', `bottom'.")
1659
1660 (defun move-to-window-line-top-bottom (&optional arg) 1656 (defun move-to-window-line-top-bottom (&optional arg)
1661 "Position point relative to window. 1657 "Position point relative to window.
1662 1658
1663 With an argument, acts like `move-to-window-line'. 1659 With a prefix argument ARG, acts like `move-to-window-line'.
1664 1660
1665 With no argument, positions point at center of window. 1661 With no argument, positions point at center of window.
1666 Successive calls positions point at the top, the bottom and again 1662 Successive calls position point at the top, the bottom and again
1667 at the center of the window." 1663 at the center of the window."
1668 (interactive "P") 1664 (interactive "P")
1669 (cond 1665 (cond
1670 (arg (move-to-window-line arg)) ; Always respect ARG. 1666 (arg (move-to-window-line arg)) ; Always respect ARG.
1671 ((or (not (eq this-command last-command)) 1667 ((or (not (eq this-command last-command))
1672 (eq move-to-window-line-last-op 'bottom)) 1668 (eq recenter-last-op 'bottom))
1673 (setq move-to-window-line-last-op 'middle) 1669 (setq recenter-last-op 'middle)
1674 (call-interactively 'move-to-window-line)) 1670 (call-interactively 'move-to-window-line))
1675 (t 1671 (t
1676 (let ((this-scroll-margin 1672 (let ((this-scroll-margin
1677 (min (max 0 scroll-margin) 1673 (min (max 0 scroll-margin)
1678 (truncate (/ (window-body-height) 4.0))))) 1674 (truncate (/ (window-body-height) 4.0)))))
1679 (cond ((eq move-to-window-line-last-op 'middle) 1675 (cond ((eq recenter-last-op 'middle)
1680 (setq move-to-window-line-last-op 'top) 1676 (setq recenter-last-op 'top)
1681 (move-to-window-line this-scroll-margin)) 1677 (move-to-window-line this-scroll-margin))
1682 ((eq move-to-window-line-last-op 'top) 1678 ((eq recenter-last-op 'top)
1683 (setq move-to-window-line-last-op 'bottom) 1679 (setq recenter-last-op 'bottom)
1684 (move-to-window-line (- -1 this-scroll-margin)))))))) 1680 (move-to-window-line (- -1 this-scroll-margin))))))))
1685 1681
1686 (define-key global-map [?\M-r] 'move-to-window-line-top-bottom) 1682 (define-key global-map [?\M-r] 'move-to-window-line-top-bottom)
1687 1683
1688 1684