emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recenter-top-bottom


From: Alan Mackenzie_JWA
Subject: Re: recenter-top-bottom
Date: Wed, 7 Nov 2007 14:16:23 +0100

[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).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]