emacs-devel
[Top][All Lists]
Advanced

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

recenter-top-bottom


From: Drew Adams
Subject: recenter-top-bottom
Date: Tue, 6 Nov 2007 08:53:39 -0800

Any interest in this or something like it? I bind it to `C-l' in place of
`recenter'. If there is interest, then perhaps `recenter' itself could have
this behavior (but the frame redisplay behavior might need to be taken into
account).

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.

(defun recenter-top-bottom (&optional arg)
  "Move current line to window center, top, and bottom, alternately.
With prefix ARG, move current line to window-line ARG."
  (interactive "P")
  (cond ((and (eq this-command last-command) (not arg))
         (setq this-command 'recenter-top-bottom-1)
         (recenter 0))
        ((and (eq 'recenter-top-bottom-1 last-command) (not arg))
         (setq this-command 'recenter-top-bottom-2)
         (recenter -1))
        (t
         (recenter arg))))





reply via email to

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