emacs-devel
[Top][All Lists]
Advanced

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

Re: Scrolling commands and skipping redisplay, was: Re: emacs rendering


From: Eli Zaretskii
Subject: Re: Scrolling commands and skipping redisplay, was: Re: emacs rendering comparisson between emacs23 and emacs26.3
Date: Fri, 17 Apr 2020 20:35:18 +0300

> Cc: address@hidden, address@hidden, address@hidden, address@hidden,
>  address@hidden
> From: Dmitry Gutov <address@hidden>
> Date: Fri, 17 Apr 2020 20:04:04 +0300
> 
> 1. (setq scroll-conservatively 1)
> 
> 2. Visit xdisp.c.
> 
> 3. Lean on C-n.
> 
> 4. From time to time, you will see point jump into the middle of the 
> screen, when font-lock takes too long, apparently (or maybe it 
> corresponds to GC pauses).
> 
> This shouldn't happen because next-line only moves by one line.

And it doesn't.  What happens is that Emacs is sometimes unable to
keep up with input, so when it comes to displaying the next screenful,
point is already more than 1 line below the window's end.  So Emacs
recenters.

That's why the special value of 101 was introduced: so that this
recentering never happens.

> >> In any case, if there is a way to dynamically detect these cases and
> >> disable redisplay skipping for them, I'd like to try that out.
> > 
> > Yes, jit-lock-defer-time is that way.  But you already know that.
> 
> No, it speeds up redisplay. It doesn't make *sure* that redisplay is not 
> skipped.
> 
> To do that, need to modify the condition of skipping redisplay.

Adding such a condition would be against Emacs design, which enters
redisplay only when Emacs is idle.  As long as Emacs is not idle,
redisplay will be skipped, that's how Emacs is designed.

> > If that's not what you meant, then what exactly would you like to be
> > able to detect?  The move_it_* functions are the entry point to the
> > display simulation code, and they are used all over the place.
> 
> Perhaps detect the cases when move_it_* was used inside the command's 
> implementation?
> 
> >> Even more if there was a way to put the results of "simulated redisplay"
> >> to use in the "real" redisplay later.
> > 
> > That happens automatically, since the 'fontified' property they
> > produce is left on the buffer text.
> 
> That might be sufficient if we assume that font-lock is always the 
> slowest part of redisplay (for some commands it might not always be 
> true, but I'm guessing here).

Nothing else can be kept from the move_it_* phase, because the command
that is running might not yet have finished, and so not all of the
changes that affect display are known.

> But with that assumption, the extra condition of not skipping redisplay 
> could be simplified (?) to only checking whether the current screen has 
> been fontified already (i.e. 'fontified' is non-nil). If it's fontified, 
> we won't skip redisplay.

I don't think forcing redisplay in the way that you suggest is a good
idea, see above.



reply via email to

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