2009/4/19 Deniz Dogan : > Hi > > I recently found out about the M-r keybinding, which by default is > bound to move-to-window-line. Already knowing about the C-l keybinding > (recenter-top-bottom) I was a bit thrown off when I found out that M-r > doesn't behave in the same way. This got me thinking that the behavior > of M-r should be changed to behave somewhat like C-l. So I basically > stole the code for recenter-top-bottom and modified it to work with > move-to-window-line instead. > > This is the result: > > (defvar move-to-window-line-last-op nil >  "Indicates the last move-to-window-line operation performed. > Possible values: `top', `middle', `bottom'.") > > (defun move-to-window-line-top-bottom (&optional arg) >  (interactive "P") >  (cond >   (arg (move-to-window-line arg))                      ; Always respect ARG. >   ((or (not (eq this-command last-command))            ; If this is > not a repetition >        (eq move-to-window-line-last-op 'bottom))       ; or if the last one > put us at the bottom >    (setq move-to-window-line-last-op 'middle)          ; then move it > to the middle >    (call-interactively 'move-to-window-line)) >   (t >    (let ((this-scroll-margin >           (min (max 0 scroll-margin) >                (truncate (/ (window-body-height) 4.0))))) >      (cond ((eq move-to-window-line-last-op 'middle)   ; If we're at the middle >             (setq move-to-window-line-last-op 'top)    ; then move to the top >             (move-to-window-line this-scroll-margin)) >            ((eq move-to-window-line-last-op 'top)      ; If we're at the top >             (setq move-to-window-line-last-op 'bottom) ; then move to the bottom >             (move-to-window-line (- -1 this-scroll-margin)))))))) > > Please, do consider changing the behavior of M-r, of course not > necessarily using the code above. If the code became a bit obfuscated > on its way to the mailing list, I pasted it on lisp.org as well: > http://paste.lisp.org/display/78841 > > Thanks, > Deniz Dogan > I'm guessing that no one is interested after all, but for convenience I tried compiling a couple of patches for this change: one which adds this functionality to lisp/window.el (and also binds it to M-r) and one which updates etc/NEWS if it needs to be documented there. -- Deniz Dogan