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
Subject: Re: recenter-top-bottom
Date: Sun, 11 Nov 2007 08:27:39 +0000
User-agent: Mutt/1.5.9i

Hi, Drew!

A couple more technical points:

On Tue, Nov 06, 2007 at 08:53:39AM -0800, 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.

`recenter' already has two functions: C-l means "redraw screen, scrolling
point to centre" and C-u C-l means "scroll point to centre,
flicker-free".  Having thought about it, I very rarely use a bare C-l.

I reassert my view that any further functionality on C-l should be
optional.

> (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)   <===============

PLEASE DON'T DO THIS!!!!  This is an abuse of `\(this\|last\)-command',
and will surely cause some other emacs function, present or future, to
fail.  In particular, the contents of these variables have always been
executable commands.  Surely you can defyourownvar for this.

>          (recenter 0))
>         ((and (eq 'recenter-top-bottom-1 last-command) (not arg))
>          (setq this-command 'recenter-top-bottom-2)   <================
>          (recenter -1))
>         (t
>          (recenter arg))))

-- 
Alan Mackenzie (Ittersbach, Germany).




reply via email to

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