emacs-devel
[Top][All Lists]
Advanced

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

Re: recenter-top-bottom


From: Juri Linkov
Subject: Re: recenter-top-bottom
Date: Sun, 11 Nov 2007 23:47:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>   (cond (arg (recenter arg))
>         (t
>          (let* ((top (1+ (count-lines 1 (window-start))))
>                 (bottom (1+ (count-lines 1 (window-end))))
>                 (current (1+ (count-lines 1 (point))))
>                 (total (window-height)))
>            (cond ((< (- current top) (/ total 3))
>                   (recenter (1- (- scroll-conservatively))))
>                  ((< (- bottom current) (/ total 3)) (recenter))
>                  (t (recenter scroll-conservatively)))))))

I like the new definition of `recenter-top-bottom'.  But there is one
problem: it doesn't work when point is close to the end of the buffer.
It doesn't put point to the upper half of the window but this
is possible with other commands (because the end of the buffer
is not attached to the end of the window in Emacs).

Also I suggest replacing `(recenter)' with `(recenter '(4))' to not redraw
the frame when moving point to the center, to not make it different from
moving point to other parts of the window that doesn't redraw the frame.

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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