emacs-devel
[Top][All Lists]
Advanced

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

Scroll lock


From: Ralf Angeli
Subject: Scroll lock
Date: Wed, 22 Jun 2005 00:26:39 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Hi everybody,

in a German newsgroup somebody asked if it would be possible to keep
the position of point fixed while doing vertical motion, i.e. to have
a behavior commonly referred to as scroll lock.  Such a behavior can
be useful when you are primarily reading (in contrast to editing) a
file and want to scroll by line or paragraph up and down without
having to move point to the window top or bottom respectively.

As I could not find anything doing this in Emacs I wrote some code you
can find in the file attached to this message.  In case people find
this useful I'd be happy to sign papers for it and have it integrated
into Emacs proper.  In that case, however, I'd implement some parts of
it differently.

First, I would not use the scroll lock key for toggling unless it can
be supported correctly.  Instead, a "normal" key binding can be used.

Second, instead of using the Lisp functions `scroll-lock-mwheel-scroll'
and `scroll-lock-scroll-bar-toolkit-scroll', preserving screen
position should be handled in the scroll functions in window.c.  A
non-nil value of `scroll-preserve-screen-position' could not only mean
to preserve position if point moved out of the window during scrolling
(like it is now), but in any case.  This behavior is actually what I
expected when setting the variable to t.  Its doc string unfortunately
isn't very verbose about when the position is preserved and when it is
not.

Anyway, in case the functionality is not found to be useful or such an
addition should not be integrated because of the feature freeze I can
put the file into the Lisp repository on my.gnus.org for people
interested in it.

-- 
Ralf

Attachment: scroll-lock.el
Description: application/emacs-lisp


reply via email to

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