aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2009-11-23 05:32:25 +0000
committerStefan Monnier2009-11-23 05:32:25 +0000
commit216349f89edbd3476f04fc971ab545cea6239ee6 (patch)
tree972a3f5b90bbb91e1dc8632dfabfed6ae0526775
parentc10e06335efc44a628996547291c7b82b7ffe17a (diff)
downloademacs-216349f89edbd3476f04fc971ab545cea6239ee6.tar.gz
emacs-216349f89edbd3476f04fc971ab545cea6239ee6.zip
(move-to-window-line-last-op): New var.
(move-to-window-line-top-bottom): New command. (global-map): Bind M-r move-to-window-line-top-bottom.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/window.el33
3 files changed, 42 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 87c11dd17a2..543d6612578 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -150,6 +150,9 @@ For instance, this can complete M-x lch to list-command-history.
150** Completions in the *Completions* buffer are sorted vertically 150** Completions in the *Completions* buffer are sorted vertically
151when the value of the new variable `completions-format' is `vertical'. 151when the value of the new variable `completions-format' is `vertical'.
152 152
153** M-r is bound to the new `move-to-window-line-top-bottom'
154to mirror the new behavior of C-l in Emacs-23.1.
155
153 156
154* Changes in Specialized Modes and Packages in Emacs 23.2 157* Changes in Specialized Modes and Packages in Emacs 23.2
155 158
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 797e258b339..70a183b7764 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12009-11-23 Deniz Dogan <deniz.a.m.dogan@gmail.com> (tiny change)
2
3 * window.el (move-to-window-line-last-op): New var.
4 (move-to-window-line-top-bottom): New command.
5 (global-map): Bind M-r move-to-window-line-top-bottom.
6
12009-11-23 Sven Joachim <svenjoac@gmx.de> 72009-11-23 Sven Joachim <svenjoac@gmx.de>
2 8
3 * dired-x.el (dired-guess-shell-alist-default): 9 * dired-x.el (dired-guess-shell-alist-default):
diff --git a/lisp/window.el b/lisp/window.el
index 6d32e42ef1d..e93d3a55d26 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1652,6 +1652,39 @@ Top and bottom destinations are actually `scroll-margin' lines
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
1656(defvar move-to-window-line-last-op nil
1657 "Indicates the last move-to-window-line operation performed.
1658Possible values: `top', `middle', `bottom'.")
1659
1660(defun move-to-window-line-top-bottom (&optional arg)
1661 "Position point relative to window.
1662
1663With an argument, acts like `move-to-window-line'.
1664
1665With no argument, positions point at center of window.
1666Successive calls positions point at the top, the bottom and again
1667at the center of the window."
1668 (interactive "P")
1669 (cond
1670 (arg (move-to-window-line arg)) ; Always respect ARG.
1671 ((or (not (eq this-command last-command))
1672 (eq move-to-window-line-last-op 'bottom))
1673 (setq move-to-window-line-last-op 'middle)
1674 (call-interactively 'move-to-window-line))
1675 (t
1676 (let ((this-scroll-margin
1677 (min (max 0 scroll-margin)
1678 (truncate (/ (window-body-height) 4.0)))))
1679 (cond ((eq move-to-window-line-last-op 'middle)
1680 (setq move-to-window-line-last-op 'top)
1681 (move-to-window-line this-scroll-margin))
1682 ((eq move-to-window-line-last-op 'top)
1683 (setq move-to-window-line-last-op 'bottom)
1684 (move-to-window-line (- -1 this-scroll-margin))))))))
1685
1686(define-key global-map [?\M-r] 'move-to-window-line-top-bottom)
1687
1655 1688
1656(defvar mouse-autoselect-window-timer nil 1689(defvar mouse-autoselect-window-timer nil
1657 "Timer used by delayed window autoselection.") 1690 "Timer used by delayed window autoselection.")