help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to scroll while keeping the position of the point with respect t


From: Yevgeniy Makarov
Subject: Re: How to scroll while keeping the position of the point with respect to the text?
Date: Wed, 05 Sep 2007 19:49:48 -0000
User-agent: G2/1.0

> (global-set-key [M-up]
>  (lambda() (interactive) (scroll-down 1) (previous-line 1)))
> (global-set-key [M-down]
>  (lambda() (interactive) (scroll-up 1) (next-line 1)))
> (global-set-key [S-up]
>  (lambda() (interactive) (scroll-up 1)))
> (global-set-key [S-down]
>  (lambda() (interactive) (scroll-down 1)))
>
> in my .emacs. Thus I could use Shift-up/down to scroll and keep the
> position of the point wrt the text (Ithink that was what you were
> looking for) or use M-up/down to scroll the text underneath the point.

I am sorry, something does not fit here. Your Shift-up does scroll-up,
which does change the position of the cursor. Second, "(scroll-down 1)
(previous-line 1)" moves the point *two* lines w.r.t. the text. You
probably meant "(scroll-down 1) (next-line 1)". Finally, the problem
with this is that the point is moved to the beginning of the line. And
preserving the horizontal position is not easy, because if some line
is shorter but the following one is long, I'd like for the point to
keep the horizontal position. This calls for watching for the unbroken
series of scrolling commands.



reply via email to

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