[Apologies for the lack of threading, etc.]
> With a prefix arg, it's the same as `recenter'. Otherwise, it alternately
> moves the current line to the center, top, and bottom of the window. In
> this, it's a bit like `C-M-l'. It's a trivial change, but I find it useful -
> I have no need for repeated `C-l' to keep doing the same thing.
> It looks good to me. What do others think?
I wouldn't like it, because I'd find it too slow. I've
had defuns bound to C-S-<right>/<left> for years, which
move point directly to the top/bottom of the window
without passing Go or collecting $200. If I want to zap
point to BOW, I want it done NOW, atomically, not as a
triple key-sequence.
For this reason, I'd find the new command an irritation.
I think it would thus be better to have a user option to
request this new behaviour: something like this (untested):
[I've also edited the doc string; "alternately" is
inappropriate for three things; "successively" is right.]
(defvar recenter-triple-action-flag t ; or nil ???
"....")
(defun recenter-top-bottom (&optional arg)
"Move current line successively to window center, top, and bottom. <=====
With prefix ARG, move current line to window-line ARG.
If option `recenter-triple-action-flag' is NIL, just recenter." ; <=====
(interactive "P")
(cond ((and recenter-triple-action-flag ; <=========
(eq this-command last-command) (not arg))
(setq this-command 'recenter-top-bottom-1)
(recenter 0))
((and recenter-triple-action-flag ; <=========
(eq 'recenter-top-bottom-1 last-command) (not arg))
(setq this-command 'recenter-top-bottom-2)
(recenter -1))
(t
(recenter arg))))
Perhaps its behaviour could be changed so that the
current window line is the criterion for where to go,
thusly:
(or <RANDOM> <BOTTOM>) -> <MIDDLE>
<MIDDLE> -> <TOP>
<TOP> -> <BOTTOM>.
This would make the new command more consistent with
C-M-l `reposition-window'.
--
Alan Mackenzie (Nuremberg, Germany).