[Top][All Lists]
[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/
- Re: recenter-top-bottom, (continued)
- Re: recenter-top-bottom, Lennart Borgman (gmail), 2007/11/06
- Re: recenter-top-bottom, Richard Stallman, 2007/11/07
- Re: recenter-top-bottom, Juri Linkov, 2007/11/07
- Re: recenter-top-bottom, Alan Mackenzie, 2007/11/11
- Re: recenter-top-bottom, Alan Mackenzie_JWA, 2007/11/07
- Re: recenter-top-bottom, Lennart Borgman (gmail), 2007/11/07
- Re: recenter-top-bottom, Richard Stallman, 2007/11/07
- RE: recenter-top-bottom, Drew Adams, 2007/11/11
- Re: recenter-top-bottom,
Juri Linkov <=
- RE: recenter-top-bottom, Drew Adams, 2007/11/11
- Re: recenter-top-bottom, Juri Linkov, 2007/11/11
- RE: recenter-top-bottom, Drew Adams, 2007/11/11
- Re: recenter-top-bottom, Bastien, 2007/11/11
- RE: recenter-top-bottom, Drew Adams, 2007/11/11
- Re: recenter-top-bottom, Bastien, 2007/11/11
- RE: recenter-top-bottom, Drew Adams, 2007/11/12
- Re: recenter-top-bottom, Bastien, 2007/11/12
- Re: recenter-top-bottom, Bastien, 2007/11/12
- Re: recenter-top-bottom, Robert J. Chassell, 2007/11/12