emacs-devel
[Top][All Lists]
Advanced

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

Re: recenter-top-bottom


From: Lennart Borgman (gmail)
Subject: Re: recenter-top-bottom
Date: Tue, 06 Nov 2007 18:02:19 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

Drew Adams wrote:
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))))


I like it, there is less to remember this way.




reply via email to

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