emacs-devel
[Top][All Lists]
Advanced

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

Re: Allowing point to be outside the window?


From: Eli Zaretskii
Subject: Re: Allowing point to be outside the window?
Date: Thu, 09 Dec 2021 13:45:03 +0200

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Mon, 06 Dec 2021 10:11:47 +0800
> 
> WDYT about the attached patch?  It recenters the display whenever PT !=
> w->last_point, and it seems to work very well.
> 
> It also introduces a new variable `scroll-move-point' that controls if
> the scrolling commands will try to move point to stay visible.

Once again, it's hard to understand the main ideas behind the
feature.  You explained above when it brings point into the view, but
what I'm looking for is an explanation for how to modify
redisplay_window when this feature is turned ON, without losing too
much of the existing redisplay functionality.

Also, a large part of the patch seems to change mainly whitespace, so
please use the -w switch to show diffs ignoring the whitespace
changes, because otherwise it's very hard to spot the real changes.

A couple of comments below:

> --- a/src/window.c
> +++ b/src/window.c
> @@ -5576,7 +5576,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
> bool whole, bool noerror)

It seems you made changes for GUI scrolling, but not for TTY
scrolling?  Is this feature supposed to be disabled on TTY frames?

> @@ -17768,6 +17770,9 @@ try_scrolling (Lisp_Object window, bool 
> just_this_one_p,
>    else
>      scroll_max = 0;
>  
> +  if (!keep_point_visible)
> +    goto out;
> +
>   too_near_end:

I'm confused here.  This bypasses all of try_scrolling's code, which
can select a new window-start because, for example, point moved out of
the visible portion of the window.  Does this mean that when
this feature is turned ON, scrolling of the window in these cases is
no longer supported?  For example, let's say I pressed C-n and that
moved point below the window's end (with the default zero value of
scroll-margin) -- does it mean the window will not scroll, leaving
point invisible in this case?  That brings me back to a question I
already asked: how do users tell Emacs when they deliberately want to
move point outside of the window and when they want Emacs to scroll
the window to make point visible, as before?

> @@ -18183,6 +18190,10 @@ try_cursor_movement (Lisp_Object window, struct 
> text_pos startp,
>      return rc;
>  #endif
>  
> +  /* TODO: enable this optimization.  */
> +  if (!keep_point_visible)
> +    return CURSOR_MOVEMENT_CANNOT_BE_USED;

Likewise here: you are disabling one of the more important redisplay
optimizations, which minimizes redisplay work when the user just move
point a little ways.  Can you tell why this needs to be disabled under
the new behavior? it seems to be unrelated, because the optimization
only does its thing when point didn't leave the window.

> +  debug_method_add (w, "real redisplay starts");

This will have to go eventually, as this trace is not useful in
general.

> +  /* TODO: enable this optimization.  */
> +  if (!keep_point_visible)
> +    return false;

This optimization also doesn't necessarily have anything to do with
point being outside of the window.



reply via email to

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