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

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

Re: Set-window-vscroll sometimes doesn't work


From: Eli Zaretskii
Subject: Re: Set-window-vscroll sometimes doesn't work
Date: Sun, 18 Oct 2020 20:31:21 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Sun, 18 Oct 2020 13:24:25 -0400
> Cc: help-gnu-emacs@gnu.org
> 
>  No.  The problem is in your code.  First, you use set-window-start and
>  scroll-down, both of which tramp window-vscroll (as you probably
>  realize if you think about what those do).  
> 
> Why is so? Is there any material that I can read about these?

These two functions force Emacs to display the buffer starting at a
particular position, so vscroll is zeroed out.  Otherwise, how could
Emacs obey the forced start point?

> This works, but brings flickers: the image first shows completely then the 
> vscroll takes effect, which is
> reasonable but not preferred.

It was just an example to explain to you what should be done.  E.g.,
when you scroll a tall image with C-n there's no flickering.  You just
cannot mix vscroll with other code that affects the window display,
that's all.

> I found that using (set-window-start nil (point) t) with the third argument 
> non-nil
> gives me the desired effect. My guess is that, as the doctoring said, setting 
> that to non-nil prevents redisplay
> to try to make point completely visible, so redisplay doesn’t modify vscroll, 
> so my vscroll value survived. Is
> that right?

NOFORCE non-nil means Emacs doesn't have to display the window
starting at the position if there are valid reasons, so yes.  But my
suggestion is not to use set-window-start when you want to vscroll,
it's unsafe.  You in effect create a conflict for the display engine,
and have no control on how it will resolve that conflict.




reply via email to

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