unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Scroll lock
@ 2005-06-21 22:26 Ralf Angeli
  2005-06-22  3:41 ` Richard M. Stallman
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Ralf Angeli @ 2005-06-21 22:26 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1652 bytes --]

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 #2: scroll-lock.el --]
[-- Type: application/emacs-lisp, Size: 5642 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-21 22:26 Scroll lock Ralf Angeli
@ 2005-06-22  3:41 ` Richard M. Stallman
  2005-06-22  7:56   ` Ralf Angeli
  2005-06-22 12:13 ` Robert J. Chassell
  2005-06-22 13:23 ` Thien-Thi Nguyen
  2 siblings, 1 reply; 24+ messages in thread
From: Richard M. Stallman @ 2005-06-22  3:41 UTC (permalink / raw)
  Cc: emacs-devel

It seems like a feature worth adding.  However, is it really right
to modify next-line?  It is not a scroll command.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-22  3:41 ` Richard M. Stallman
@ 2005-06-22  7:56   ` Ralf Angeli
  2005-06-22 12:38     ` Juri Linkov
  2005-06-23  0:54     ` Richard M. Stallman
  0 siblings, 2 replies; 24+ messages in thread
From: Ralf Angeli @ 2005-06-22  7:56 UTC (permalink / raw)
  Cc: emacs-devel

* Richard M. Stallman (2005-06-22) writes:

> It seems like a feature worth adding.  However, is it really right
> to modify next-line?  It is not a scroll command.

This is the main point of the mode.  It should make moving in buffers
more pager-like.  For example, in `less' the keys `C-n' and `C-p' will
scroll the buffer, not move point.  That means such a mode could also
improve convenience of browsing manual pages with WoMan or info pages
with the built-in info reader.

Regarding the implementation: If people think it is sensible to extend
the meaning of `scroll-preserve-screen-position' to any kind of scroll
events, I could prepare a patch covering the changes in window.c as
well.

-- 
Ralf

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-21 22:26 Scroll lock Ralf Angeli
  2005-06-22  3:41 ` Richard M. Stallman
@ 2005-06-22 12:13 ` Robert J. Chassell
  2005-06-22 13:23 ` Thien-Thi Nguyen
  2 siblings, 0 replies; 24+ messages in thread
From: Robert J. Chassell @ 2005-06-22 12:13 UTC (permalink / raw)
  Cc: emacs-devel

   in a German newsgroup somebody asked if it would be possible to keep
   the position of point fixed while doing vertical motion ...

Yes.  Here are defuns and keybindings to do this for arrow keys.
These go into a .emacs file.  Point stays fixed until it comes to the
top or bottom of a window; then it stays within the window.  I use
these keybindings very frequently both in read-write buffers and in
read-only buffers.



(defun scroll-forward-one-line ()
  "Scroll the text up one line.
A replacement for the three keystroke sequence
C-u 1 C-v."
  (interactive)
  (scroll-up 1))

(defun scroll-backward-one-line ()
  "Scroll the text down one line.
A replacement for the three keystroke sequence
C-u 1 M-v."
  (interactive)
  (scroll-down 1))

(global-set-key [down] 'scroll-forward-one-line)  ; Down arrow key
(global-set-key [up] 'scroll-backward-one-line)   ; Up arrow key



-- 
    Robert J. Chassell                         
    bob@rattlesnake.com                         GnuPG Key ID: 004B4AC8
    http://www.rattlesnake.com                  http://www.teak.cc

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-22  7:56   ` Ralf Angeli
@ 2005-06-22 12:38     ` Juri Linkov
  2005-06-22 13:38       ` Ralf Angeli
  2005-06-23  0:54     ` Richard M. Stallman
  1 sibling, 1 reply; 24+ messages in thread
From: Juri Linkov @ 2005-06-22 12:38 UTC (permalink / raw)
  Cc: rms, emacs-devel

> Regarding the implementation: If people think it is sensible to extend
> the meaning of `scroll-preserve-screen-position' to any kind of scroll
> events, I could prepare a patch covering the changes in window.c as
> well.

I think extending the `scroll-preserve-screen-position' is a good
thing.  I noticed that now `scroll-preserve-screen-position' even
stopped to do what is described in its docstring.  In a year old
CVS version, when `scroll-preserve-screen-position' is t, `M-1 M-v'
preserved the screen position, but in the current CVS it doesn't do
that.  This looks like a bug.

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-21 22:26 Scroll lock Ralf Angeli
  2005-06-22  3:41 ` Richard M. Stallman
  2005-06-22 12:13 ` Robert J. Chassell
@ 2005-06-22 13:23 ` Thien-Thi Nguyen
  2 siblings, 0 replies; 24+ messages in thread
From: Thien-Thi Nguyen @ 2005-06-22 13:23 UTC (permalink / raw)
  Cc: emacs-devel

Ralf Angeli <angeli@iwi.uni-sb.de> writes:

> I can put the file into the Lisp repository on my.gnus.org for
> people interested in it.

see also scroll-in-place.el by Eric Eide.

thi

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-22 12:38     ` Juri Linkov
@ 2005-06-22 13:38       ` Ralf Angeli
  2005-06-23  0:54         ` Richard M. Stallman
  0 siblings, 1 reply; 24+ messages in thread
From: Ralf Angeli @ 2005-06-22 13:38 UTC (permalink / raw)
  Cc: rms, emacs-devel

* Juri Linkov (2005-06-22) writes:

> I think extending the `scroll-preserve-screen-position' is a good
> thing.  I noticed that now `scroll-preserve-screen-position' even
> stopped to do what is described in its docstring.  In a year old
> CVS version, when `scroll-preserve-screen-position' is t, `M-1 M-v'
> preserved the screen position, but in the current CVS it doesn't do
> that.  This looks like a bug.

AFAICS this behavior is intentional:

,----[ CVS log of window.c ]
| revision 1.490
| date: 2004/12/31 15:07:48;  author: rms;  state: Exp;  lines: +57 -31
| (window_scroll_pixel_based): Only look at
| Vscroll_preserve_screen_position if the old PT can't be kept.
| (syms_of_window) <scroll-preserve-screen-position>: Doc fix.
`----

-- 
Ralf

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-22  7:56   ` Ralf Angeli
  2005-06-22 12:38     ` Juri Linkov
@ 2005-06-23  0:54     ` Richard M. Stallman
  2005-06-23  3:57       ` Miles Bader
  2005-06-23  7:45       ` Ralf Angeli
  1 sibling, 2 replies; 24+ messages in thread
From: Richard M. Stallman @ 2005-06-23  0:54 UTC (permalink / raw)
  Cc: emacs-devel

    > It seems like a feature worth adding.  However, is it really right
    > to modify next-line?  It is not a scroll command.

    This is the main point of the mode.  It should make moving in buffers
    more pager-like.

Forgive me, but previously you said the main point was to change
*scrolling* commands.  Now you say that the main point is something
else.  I do not follow you any more.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-22 13:38       ` Ralf Angeli
@ 2005-06-23  0:54         ` Richard M. Stallman
  2005-06-23  8:17           ` Ralf Angeli
  0 siblings, 1 reply; 24+ messages in thread
From: Richard M. Stallman @ 2005-06-23  0:54 UTC (permalink / raw)
  Cc: juri, emacs-devel

    > I think extending the `scroll-preserve-screen-position' is a good
    > thing.  I noticed that now `scroll-preserve-screen-position' even
    > stopped to do what is described in its docstring.  In a year old
    > CVS version, when `scroll-preserve-screen-position' is t, `M-1 M-v'
    > preserved the screen position, but in the current CVS it doesn't do
    > that.  This looks like a bug.

    AFAICS this behavior is intentional:

I now remember that that's what the variable was originally supposed
to do.  Someone reported it had been changed, so I changed it back.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-23  0:54     ` Richard M. Stallman
@ 2005-06-23  3:57       ` Miles Bader
  2005-06-23  7:45       ` Ralf Angeli
  1 sibling, 0 replies; 24+ messages in thread
From: Miles Bader @ 2005-06-23  3:57 UTC (permalink / raw)
  Cc: Ralf Angeli, emacs-devel

On 6/23/05, Richard M. Stallman <rms@gnu.org> wrote:
>     This is the main point of the mode.  It should make moving in buffers
>     more pager-like.
> 
> Forgive me, but previously you said the main point was to change
> *scrolling* commands.  Now you say that the main point is something
> else.  I do not follow you any more.

I think in many "browser-like" apps, traditional cursor-movement
bindings actually do scrolling (there's no cursor to move anyway). 
E.g., in mozilla, the arrow keys scroll the window by one line or
character (and in the "links" browser, ^N and ^P do the same thing,
though the arrow keys do something completely different!).

This is actually pretty convenient behavior if you're used to it.  In
emacs it might less so because people are used to having a cursor even
in read-only buffers, but as an optional mode it could be nice...

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-23  0:54     ` Richard M. Stallman
  2005-06-23  3:57       ` Miles Bader
@ 2005-06-23  7:45       ` Ralf Angeli
  2005-06-24  5:35         ` Richard M. Stallman
  1 sibling, 1 reply; 24+ messages in thread
From: Ralf Angeli @ 2005-06-23  7:45 UTC (permalink / raw)
  Cc: emacs-devel

* Richard M. Stallman (2005-06-23) writes:

> Forgive me, but previously you said the main point was to change
> *scrolling* commands.  Now you say that the main point is something
> else.  I do not follow you any more.

In my original mail I used the term "vertical motion".  I thought this
covered both scrolling commands as well as commands for vertically
moving point.  Sorry if this was not clear enough.

The mode does two things: First, it fixes point at its vertical
position during scrolling and second, it turns commands for vertically
moving point by lines or paragraphs into commands which scroll the
buffer by the respective amount.  This results in a more pager- or
browser-like (as Miles put it) behavior.  Like this it becomes very
easy to incrementally scroll the buffer up or down.

I hope this description makes it clearer.  In case it doesn't, maybe
you could activate the mode with `M-x scroll-lock-mode RET' and type
`C-p' or `C-n'.  This should show you immediately what it is supposed
to do.

-- 
Ralf

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-23  0:54         ` Richard M. Stallman
@ 2005-06-23  8:17           ` Ralf Angeli
  2005-06-24  5:36             ` Richard M. Stallman
  0 siblings, 1 reply; 24+ messages in thread
From: Ralf Angeli @ 2005-06-23  8:17 UTC (permalink / raw)
  Cc: juri, emacs-devel

* Richard M. Stallman (2005-06-23) writes:

>     > I think extending the `scroll-preserve-screen-position' is a good
>     > thing.  I noticed that now `scroll-preserve-screen-position' even
>     > stopped to do what is described in its docstring.  In a year old
>     > CVS version, when `scroll-preserve-screen-position' is t, `M-1 M-v'
>     > preserved the screen position, but in the current CVS it doesn't do
>     > that.  This looks like a bug.
>
>     AFAICS this behavior is intentional:
>
> I now remember that that's what the variable was originally supposed
> to do.  Someone reported it had been changed, so I changed it back.

That sounds like you want it to stay like it is.  I still think it
might be good to give people a way to have the vertical position of
point fixed for any kind of scroll commands, e.g. when scrolling with
the mouse wheel.  Currently, if `scroll-preserve-screen-position' is
set to t, scrolling with the mouse wheel will move point vertically,
but only till the chunk to be scrolled would move it out of the
window.  That means point will keep a margin from the window top or
bottom respectively which looks a bit awkward.

-- 
Ralf

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-23  7:45       ` Ralf Angeli
@ 2005-06-24  5:35         ` Richard M. Stallman
  2005-06-26 21:38           ` Ralf Angeli
  0 siblings, 1 reply; 24+ messages in thread
From: Richard M. Stallman @ 2005-06-24  5:35 UTC (permalink / raw)
  Cc: emacs-devel

    The mode does two things: First, it fixes point at its vertical
    position during scrolling and second, it turns commands for vertically
    moving point by lines or paragraphs into commands which scroll the
    buffer by the respective amount.  This results in a more pager- or
    browser-like (as Miles put it) behavior.  Like this it becomes very
    easy to incrementally scroll the buffer up or down.

1. If people like this as an option, I won't object to it as a minor
   mode.

2. scroll-preserve-screen-position should not affect anything
   but scroll commands.

3. Do you want this in all buffers, or only in read-only buffers?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-23  8:17           ` Ralf Angeli
@ 2005-06-24  5:36             ` Richard M. Stallman
  2005-06-26 21:38               ` Ralf Angeli
  0 siblings, 1 reply; 24+ messages in thread
From: Richard M. Stallman @ 2005-06-24  5:36 UTC (permalink / raw)
  Cc: juri, emacs-devel

    > I now remember that that's what the variable was originally supposed
    > to do.  Someone reported it had been changed, so I changed it back.

    That sounds like you want it to stay like it is.  I still think it
    might be good to give people a way to have the vertical position of
    point fixed for any kind of scroll commands, e.g. when scrolling with
    the mouse wheel.

I wouldn't object to having such a feature as an option,
but scroll-preserve-screen-position is defined to do a different thing,
and I don't want the new feature to replace the old feature.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-24  5:36             ` Richard M. Stallman
@ 2005-06-26 21:38               ` Ralf Angeli
  0 siblings, 0 replies; 24+ messages in thread
From: Ralf Angeli @ 2005-06-26 21:38 UTC (permalink / raw)


* Richard M. Stallman (2005-06-24) writes:

>     That sounds like you want it to stay like it is.  I still think it
>     might be good to give people a way to have the vertical position of
>     point fixed for any kind of scroll commands, e.g. when scrolling with
>     the mouse wheel.
>
> I wouldn't object to having such a feature as an option,
> but scroll-preserve-screen-position is defined to do a different thing,
> and I don't want the new feature to replace the old feature.

In that case there are two ways feature could be activated.

1) Using a special symbol for `scroll-preserve-screen-position'.
   Setting it e.g. to 'always would preserve screen position of point
   for any scroll command, even those which would not move point out
   of the visible portion of the buffer.  The behavior you get when
   setting the variable to t would stay as is.

2) Using a new variable for activating the new feature,
   e.g. `scroll-preserve-screen-position-always'.

Personally I'd prefer the first approach because the current behavior
and the new one are mutually exclusive, so it doesn't make much sense
controlling them with two independent variables.

-- 
Ralf

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-24  5:35         ` Richard M. Stallman
@ 2005-06-26 21:38           ` Ralf Angeli
  2005-06-27  5:37             ` Richard M. Stallman
  0 siblings, 1 reply; 24+ messages in thread
From: Ralf Angeli @ 2005-06-26 21:38 UTC (permalink / raw)


* Richard M. Stallman (2005-06-24) writes:

> 2. scroll-preserve-screen-position should not affect anything
>    but scroll commands.

It would only affect scrolling commands.  But it will affect
e.g. `C-n' and `C-p' which will be remapped to functions which
actually do scrolling.

> 3. Do you want this in all buffers, or only in read-only buffers?

The minor mode should be able to be turned on in any buffer.

-- 
Ralf

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-26 21:38           ` Ralf Angeli
@ 2005-06-27  5:37             ` Richard M. Stallman
  2005-06-29 11:23               ` Ralf Angeli
  0 siblings, 1 reply; 24+ messages in thread
From: Richard M. Stallman @ 2005-06-27  5:37 UTC (permalink / raw)
  Cc: emacs-devel

    > 2. scroll-preserve-screen-position should not affect anything
    >    but scroll commands.

    It would only affect scrolling commands.  But it will affect
    e.g. `C-n' and `C-p' which will be remapped to functions which
    actually do scrolling.

If you have a minor mode that rebinds these keys to scrolling
commands, then I agree it is natural in that mode for
scroll-preserve-screen-position to affect them.

    > 3. Do you want this in all buffers, or only in read-only buffers?

    The minor mode should be able to be turned on in any buffer.

Ok.

If you only wanted it in read-only buffers, we could perhaps turn it
on by default in those buffers.  If you want it to be available in any
buffer, we'd have to make it a minor mode, and you'd get it only when
you explicitly ask.

    In that case there are two ways feature could be activated.

    1) Using a special symbol for `scroll-preserve-screen-position'.
       Setting it e.g. to 'always would preserve screen position of point
       for any scroll command, even those which would not move point out
       of the visible portion of the buffer.  The behavior you get when
       setting the variable to t would stay as is.

That would be ok with me.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-27  5:37             ` Richard M. Stallman
@ 2005-06-29 11:23               ` Ralf Angeli
  2005-06-30  1:44                 ` Richard M. Stallman
  0 siblings, 1 reply; 24+ messages in thread
From: Ralf Angeli @ 2005-06-29 11:23 UTC (permalink / raw)
  Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2360 bytes --]

* Richard M. Stallman (2005-06-27) writes:

> If you only wanted it in read-only buffers, we could perhaps turn it
> on by default in those buffers.  If you want it to be available in any
> buffer, we'd have to make it a minor mode, and you'd get it only when
> you explicitly ask.

I think it would be nice to have a user option or another convenient
way (e.g. a hook) for enabling the mode automatically in read-only
buffers.  But the criterion "read-only" is probably too wide to
trigger the mode in all cases, so it might be better to simply
activate the mode via the mode hooks of modes in which scroll locking
should be enabled, e.g. Info mode or Woman mode.

>     1) Using a special symbol for `scroll-preserve-screen-position'.
>        Setting it e.g. to 'always would preserve screen position of point
>        for any scroll command, even those which would not move point out
>        of the visible portion of the buffer.  The behavior you get when
>        setting the variable to t would stay as is.
>
> That would be ok with me.

Attached you can find a patch for window.c and an updated
scroll-lock.el file corresponding to the changes in window.c.  Here is
a ChangeLog entry for the window.c changes:

2005-06-29  Ralf Angeli  <angeli@iwi.uni-sb.de>

	* window.c (Qalways): New variable.
	(syms_of_window): Initialize it.
	(window_scroll_pixel_based, window_scroll_line_based): Preserve
	screen position of point if `scroll-preserve-screen-position' is
	set to 'always.
	(scroll-preserve-screen-position): Document 'always value.

An open issue is the key binding for toggling the mode.  If the minor
mode should be able to be activated in some major modes but not in
others, it doesn't make much sense to bind this to the Scroll Lock key
which in my understanding means to enable or disable it globally (not
just for Emacs but for other applications aware of it as well).

So my idea was to make Scroll Lock minor mode a local mode and add
e.g. `C-x %' as a key binding for toggling it.  The binding seems not
be used throughout the Emacs code base (according to some grepping I
did in the lisp/ directory).  And the % character looks a little bit
like scrolls in a shelf.  In addition it could be an option to give
the mode a different name in order to avoid confusion about the mode
not being accessible via the Scroll Lock key.

-- 
Ralf

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: window.c.patch --]
[-- Type: text/x-patch, Size: 2745 bytes --]

--- window.c	21 Jun 2005 11:29:47 -0000	1.505
+++ window.c	29 Jun 2005 10:50:21 -0000
@@ -51,6 +51,7 @@
 
 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
 Lisp_Object Qwindow_size_fixed;
+Lisp_Object Qalways;
 extern Lisp_Object Qleft_margin, Qright_margin;
 
 static int displayed_window_lines P_ ((struct window *));
@@ -4783,7 +4784,8 @@
       /* We moved the window start towards ZV, so PT may be now
 	 in the scroll margin at the top.  */
       move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
-      if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin)
+      if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin
+          && !EQ (Vscroll_preserve_screen_position, Qalways))
 	/* We found PT at a legitimate height.  Leave it alone.  */
 	;
       else if (preserve_y >= 0)
@@ -4836,7 +4838,8 @@
 	  partial_p = it.current_y > it.last_visible_y;
 	}
 
-      if (charpos == PT && !partial_p)
+      if (charpos == PT && !partial_p
+          && !EQ (Vscroll_preserve_screen_position, Qalways))
 	/* We found PT before we found the display margin, so PT is ok.  */
 	;
       else if (preserve_y >= 0)
@@ -4951,7 +4954,8 @@
 	 the window-scroll-functions.  */
       w->force_start = Qt;
 
-      if (whole && !NILP (Vscroll_preserve_screen_position))
+      if ((whole && !NILP (Vscroll_preserve_screen_position))
+          || EQ (Vscroll_preserve_screen_position, Qalways))
 	{
 	  SET_PT_BOTH (pos, pos_byte);
 	  Fvertical_motion (make_number (original_vpos), window);
@@ -6738,6 +6742,9 @@
   minibuf_selected_window = Qnil;
   staticpro (&minibuf_selected_window);
 
+  Qalways = intern ("always");
+  staticpro (&Qalways);
+
   DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function,
 	       doc: /* Non-nil means call as function to display a help buffer.
 The function is called with one argument, the buffer to be displayed.
@@ -6914,9 +6921,13 @@
 
   DEFVAR_LISP ("scroll-preserve-screen-position",
 	       &Vscroll_preserve_screen_position,
-	       doc: /* *Non-nil means scroll commands move point to keep its screen line unchanged.
-This is only when it is impossible to keep point fixed and still
-scroll as specified.  */);
+	       doc: /* *Controls if scroll commands move point to keep its screen line unchanged.
+A value of nil means point does not keep its screen position except
+at the scroll margin or window boundary respectively.
+A value of t means point keeps its screen position if the scroll
+command moved it vertically out of the window, e.g. when scrolling
+by full screens.
+A value of `always' means point always keeps its screen position.  */);
   Vscroll_preserve_screen_position = Qnil;
 
   DEFVAR_LISP ("window-configuration-change-hook",

[-- Attachment #3: scroll-lock.el --]
[-- Type: application/emacs-lisp, Size: 4028 bytes --]

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-29 11:23               ` Ralf Angeli
@ 2005-06-30  1:44                 ` Richard M. Stallman
  2005-06-30  8:54                   ` Ralf Angeli
  2005-07-04 10:01                   ` Juanma Barranquero
  0 siblings, 2 replies; 24+ messages in thread
From: Richard M. Stallman @ 2005-06-30  1:44 UTC (permalink / raw)
  Cc: emacs-devel

Your window.c change is simple enough that we could simply install it.
So I did.

The scroll-lock.el file is larger and would need legal papers.  I
don't like the idea of using up C-x % for this, however.  If users
really want a command to toggle this mode, I would not object, but I
tend to think they won't want to toggle it that often.  I think they'd
rather have this enabled in certain major modes.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-30  1:44                 ` Richard M. Stallman
@ 2005-06-30  8:54                   ` Ralf Angeli
  2005-06-30  9:32                     ` Miles Bader
  2005-07-04 10:01                   ` Juanma Barranquero
  1 sibling, 1 reply; 24+ messages in thread
From: Ralf Angeli @ 2005-06-30  8:54 UTC (permalink / raw)
  Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

* Richard M. Stallman (2005-06-30) writes:

> Your window.c change is simple enough that we could simply install it.
> So I did.

Thanks.  The change should be reflected in the documentation as well.
I attached patches for man/display.texi and lispref/windows.texi.
(Improvements of wording welcome.)

The description of `scroll-preserve-screen-position' in
man/display.texi is not 100% accurate because it tells you that the
vertical position of point is preserved when scrolling by full screens
while it is preserved with any scroll command which would move point
out of the window.  But maybe the description should stay like this in
order to avoid making it too complicated.

> The scroll-lock.el file is larger and would need legal papers.

I just sent a mail to the copyright clerk requesting a copyright
assignment for Emacs.

> I don't like the idea of using up C-x % for this, however.  If users
> really want a command to toggle this mode, I would not object, but I
> tend to think they won't want to toggle it that often.  I think
> they'd rather have this enabled in certain major modes.

Hm, I imagine that personally I'd want it to toggle interactively in
arbitrary modes as well.  For this, a key binding would be nice to
have.  But it probably would not be a problem to tell users that they
can define a key for it themselves.  I'll think about this and also
about if and how to handle it as a global or local minor mode ...

-- 
Ralf

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: display.texi.patch --]
[-- Type: text/x-patch, Size: 671 bytes --]

--- display.texi	29 Jun 2005 12:42:38 +0200	1.95
+++ display.texi	30 Jun 2005 10:36:52 +0200	
@@ -536,6 +536,10 @@
 started.  However, this mode is inconvenient when you move to the next
 screen in order to move point to the text there.
 
+  Setting @code{scroll-preserve-screen-position} to the special symbol
+@code{always} will keep the vertical position of point for any scrolling
+command, not just for those scrolling by full screens.
+
   Another way to do scrolling is with @kbd{C-l} with a numeric argument.
 @kbd{C-l} does not clear the screen when given an argument; it only scrolls
 the selected window.  With a positive argument @var{n}, it repositions text

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: windows.texi.patch --]
[-- Type: text/x-patch, Size: 629 bytes --]

--- windows.texi	29 Jun 2005 12:42:37 +0200	1.83
+++ windows.texi	30 Jun 2005 10:36:43 +0200	
@@ -1524,8 +1524,10 @@
 
 @defopt scroll-preserve-screen-position
 If this option is non-@code{nil}, the scroll functions move point so
-that the vertical position of the cursor is unchanged, when that is
-possible.
+that the vertical position of the cursor is unchanged.  The position is
+kept only if the scroll command moved point vertically out of the
+window.  If the position should be kept with any type of scroll command,
+set the variable to the special symbol @code{always}.
 @end defopt
 
 @defopt next-screen-context-lines

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-30  8:54                   ` Ralf Angeli
@ 2005-06-30  9:32                     ` Miles Bader
  0 siblings, 0 replies; 24+ messages in thread
From: Miles Bader @ 2005-06-30  9:32 UTC (permalink / raw)
  Cc: rms, emacs-devel

Ralf Angeli <angeli@iwi.uni-sb.de> writes:
> Hm, I imagine that personally I'd want it to toggle interactively in
> arbitrary modes as well.  For this, a key binding would be nice to
> have.  But it probably would not be a problem to tell users that they
> can define a key for it themselves.  I'll think about this and also
> about if and how to handle it as a global or local minor mode ...

It would be better to have a local minor mode which you can turn on or
off (maybe combining it in someway with view-mode, but view-mode always
seemed kinda screwed up so maybe not...).

-Miles
-- 
/\ /\
(^.^)
(")")
*This is the cute kitty virus, please copy this into your sig so it can spread.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-06-30  1:44                 ` Richard M. Stallman
  2005-06-30  8:54                   ` Ralf Angeli
@ 2005-07-04 10:01                   ` Juanma Barranquero
  2005-07-04 11:45                     ` Ralf Angeli
  1 sibling, 1 reply; 24+ messages in thread
From: Juanma Barranquero @ 2005-07-04 10:01 UTC (permalink / raw)


With respect to scrolling, etc., one comment (or question, I'm not sure).

I've been using for years Mikael Sjödin's pager.el (available at
http://user.it.uu.se/~mic/pager.el).  It's a tiny module, just five
short functions, and its main advantage is that allows you to do
page-down/page-up and the cursor is back to where it was, column and
all (i.e., it has sort of a `temporary-goal-column', just for paging
and scrolling). That's much more intuitive to me that cursor going
always to the beginning of line. It also has "line scrolling"
functions.

So the comment/question is: could this functionality (not necessarily
pager.el) be included in Emacs, or it is already there and I missed
it?

(Note: currently, the line scrolling functions of the pager.el
available on the website do not work; they move the cursor *and*
scroll the buffer; but the fix is trivial).

-- 
                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-07-04 10:01                   ` Juanma Barranquero
@ 2005-07-04 11:45                     ` Ralf Angeli
  2005-07-04 13:25                       ` Juanma Barranquero
  0 siblings, 1 reply; 24+ messages in thread
From: Ralf Angeli @ 2005-07-04 11:45 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1350 bytes --]

* Juanma Barranquero (2005-07-04) writes:

> I've been using for years Mikael Sjödin's pager.el (available at
> http://user.it.uu.se/~mic/pager.el).  It's a tiny module, just five
> short functions, and its main advantage is that allows you to do
> page-down/page-up and the cursor is back to where it was, column and
> all (i.e., it has sort of a `temporary-goal-column', just for paging
> and scrolling). That's much more intuitive to me that cursor going
> always to the beginning of line. It also has "line scrolling"
> functions.
>
> So the comment/question is: could this functionality (not necessarily
> pager.el) be included in Emacs, or it is already there and I missed
> it?

Attached you can find the current version of scroll-lock.el which will
keep point horizontally fixed (as far as possible) for line- and
paragraph-based scrolling.  This could be extended to page-based
scrolling (`C-v', `M-v') and be made configurable if necessary.

Compared to the last version I removed the key binding for toggling
the mode, made the mode buffer-local, and made it possible for point
to move upwards when `C-p' and similar is typed at the top of the
buffer and to move downward when `C-n' is typed at the bottom of the
buffer.

Apart for the points mentioned above the file is ready for inclusion
into Emacs if people like to have it.

-- 
Ralf

[-- Attachment #2: scroll-lock.el --]
[-- Type: application/emacs-lisp, Size: 4401 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Scroll lock
  2005-07-04 11:45                     ` Ralf Angeli
@ 2005-07-04 13:25                       ` Juanma Barranquero
  0 siblings, 0 replies; 24+ messages in thread
From: Juanma Barranquero @ 2005-07-04 13:25 UTC (permalink / raw)
  Cc: emacs-devel

On 7/4/05, Ralf Angeli <angeli@iwi.uni-sb.de> wrote:

> Attached you can find the current version of scroll-lock.el which will
> keep point horizontally fixed (as far as possible) for line- and
> paragraph-based scrolling.  This could be extended to page-based
> scrolling (`C-v', `M-v') and be made configurable if necessary.

I've tested it with `scroll-preserve-screen-position' set to t and I
find the cursor movement weird (to my tastes, not as a general comment
:)

With `scroll-preserve-screen-position' set to 'always I like it more,
but the fact is: you've designed a very nice scrolling package. What
I'm talking about is not scrolling. I want to move the cursor normally
on forward- and backward-char, but I want it to remember where it is
so scroll-up/down (and perhaps forward/backward-paragraph) can return
to it exactly.

There's quite overlap between what you've done and what I'd like to
have. Perhaps it's only a question of adding commands for
scroll-up/down and making it configurable, as you propose, so I can
have those without having to activate scroll-lock mode (which I would
do, *when* I want a full scroll-lock mode, to read etc/NEWS for
example).

-- 
                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2005-07-04 13:25 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-21 22:26 Scroll lock Ralf Angeli
2005-06-22  3:41 ` Richard M. Stallman
2005-06-22  7:56   ` Ralf Angeli
2005-06-22 12:38     ` Juri Linkov
2005-06-22 13:38       ` Ralf Angeli
2005-06-23  0:54         ` Richard M. Stallman
2005-06-23  8:17           ` Ralf Angeli
2005-06-24  5:36             ` Richard M. Stallman
2005-06-26 21:38               ` Ralf Angeli
2005-06-23  0:54     ` Richard M. Stallman
2005-06-23  3:57       ` Miles Bader
2005-06-23  7:45       ` Ralf Angeli
2005-06-24  5:35         ` Richard M. Stallman
2005-06-26 21:38           ` Ralf Angeli
2005-06-27  5:37             ` Richard M. Stallman
2005-06-29 11:23               ` Ralf Angeli
2005-06-30  1:44                 ` Richard M. Stallman
2005-06-30  8:54                   ` Ralf Angeli
2005-06-30  9:32                     ` Miles Bader
2005-07-04 10:01                   ` Juanma Barranquero
2005-07-04 11:45                     ` Ralf Angeli
2005-07-04 13:25                       ` Juanma Barranquero
2005-06-22 12:13 ` Robert J. Chassell
2005-06-22 13:23 ` Thien-Thi Nguyen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).