all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Unfreezing the display during auto-repeated scrolling. Simpler approach.
Date: Thu, 30 Oct 2014 22:09:19 +0000	[thread overview]
Message-ID: <20141030220919.GB2721@acm.acm> (raw)
In-Reply-To: <jwv4mum5opd.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Wed, Oct 29, 2014 at 09:49:27PM -0400, Stefan Monnier wrote:

[ ... ]

> We could indeed try to recognize auto-repeat by looking at the time
> since the last event, but it seems tricky to make it work well,
> especially it seems tricky to correctly handle the last such event.

Let's just say that what I wrote last night was utter rubbish.  We cannot
handle the last event differently, because when we start handling it, the
next event has not yet failed to arrive.  My scheme from last night can
deliver nothing more than `input-pending-p' already can.

> >> Another way to look at it: if running CMD required to run the
> >> fontification functions, then we should not skip the subsequent
> >> redisplay even if there's input pending (this is based on the assumption
> >> that running the fontification functions takes the lion's share of
> >> redisplay time and that running the fontification function during CMD
> >> means that redisplay probably won't need to run the fontification
> >> function).  Such a heuristic might make the
> >> jit-lock-defer-when-input-pending work better.
> > Running display when there's input available is a fairly drastic change
> > to the command loop.

> I don't think it's technically drastic.

Who's going to decide when a "forced" display is to take place?  We
could, I suppose, set a flag in window_scroll when there's no pending
input, and for the command loop to detect this flag and use it to give
preference to display over reading keys.

But we don't know what command is invoking window_scroll.  It might
easily be a user written command for which premature display is not
wanted. 

> > Also, something, somewhere will need to determine whether the
> > fontification called for CMD covers the same buffer region as what is
> > about to be redisplayed.

> My idea was to assume that it is.  At least, it seems unlikely that the
> two regions would be very far apart.

I think that's fair enough.

> My reasoning is that skipping redisplay should not be done for long
> periods of time.  The reason we want to skip redisplay is to let Emacs
> perform "real work" instead, but there's a tension where the user also
> wants to see the intermediate states.

So maybe a timer (?0.2s) could be inserted into the command loop, such
that if Emacs has been processing commands for that long since the last
redisplay, redisplay will be done in preference to processing the next
command.

> Also the gain from skipping redisplay depends on the ratio between "time
> to run the command" compared to "time to perform redisplay".  So if the
> command took a long time, skipping redisplay provides less gain.

That's not quite so clear when it's font-locking which is taking the
time, since it happens both in command processing and display.

> So I think we really should force redisplay despite pending input
> every once in a while.  The question is to figure out under which
> circumstances this should be done, so that those extra redisplays don't
> slow Emacs substantially overall (i.e. it stays a small fraction of the
> over processing time) yet they do let the user see intermediate states.

Coming back to scrolling through xdisp.c, merely forcing a redisplay from
time to time isn't going to help the slowness of the scrolling.  Either
eliminating most of the fontification or speeding it up radically (as Eli
would prefer) is necessary.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2014-10-30 22:09 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-19 14:17 Aborting display. Is this possible? Alan Mackenzie
2014-10-19 14:32 ` David Kastrup
2014-10-19 14:54   ` Eli Zaretskii
2014-10-19 14:50 ` Eli Zaretskii
2014-10-19 15:42   ` Alan Mackenzie
2014-10-19 18:09     ` Eli Zaretskii
2014-10-20 11:09       ` Alan Mackenzie
2014-10-20 11:30         ` David Kastrup
2014-10-20 12:00           ` Alan Mackenzie
2014-10-20 15:15             ` Eli Zaretskii
2014-10-20 15:12         ` Eli Zaretskii
2014-10-20 16:56           ` Stefan Monnier
2014-10-20 17:10             ` Eli Zaretskii
2014-10-20 17:40               ` Eli Zaretskii
2014-10-20 18:57           ` Alan Mackenzie
2014-10-20 19:24             ` Eli Zaretskii
2014-10-20 21:08               ` Alan Mackenzie
2014-10-21  8:09                 ` David Kastrup
2014-10-21 10:58                   ` Alan Mackenzie
2014-10-21 11:04                     ` David Kastrup
2014-10-21 14:25                       ` Stefan Monnier
2014-10-21 14:01                   ` Stefan Monnier
2014-10-21 15:35                     ` Eli Zaretskii
2014-10-21 16:27                       ` Stefan Monnier
2014-10-22 18:28                         ` Stephen Leake
2014-10-22 20:10                           ` Stefan Monnier
2014-10-21 17:14                       ` Alan Mackenzie
2014-10-21 18:00                         ` Eli Zaretskii
2014-10-21 18:38                           ` Alan Mackenzie
2014-10-21 18:43                             ` Eli Zaretskii
2014-10-21 19:42                               ` Eli Zaretskii
2014-10-26 12:43                             ` Unfreezing the display during auto-repeated scrolling. [ Was: Aborting display. Is this possible? ] Alan Mackenzie
2014-10-26 16:45                               ` Eli Zaretskii
2014-10-26 20:03                                 ` Alan Mackenzie
2014-10-26 20:20                                   ` Eli Zaretskii
2014-10-26 20:42                                   ` Stefan Monnier
2014-10-26 22:15                                     ` Unfreezing the display during auto-repeated scrolling Alan Mackenzie
2014-10-27  1:03                                       ` Stefan Monnier
2014-10-27 14:28                                         ` Unfreezing the display during auto-repeated scrolling. Simpler approach Alan Mackenzie
2014-10-27 16:51                                           ` Eli Zaretskii
2014-10-27 19:13                                             ` David Engster
2014-10-27 19:26                                               ` Eli Zaretskii
2014-10-27 19:36                                                 ` David Engster
2014-10-27 19:38                                             ` Alan Mackenzie
2014-10-27 21:38                                               ` Stefan Monnier
2014-10-28 18:10                                                 ` Alan Mackenzie
2014-10-29  0:57                                                   ` Stefan Monnier
2014-10-29 14:14                                                     ` Eli Zaretskii
2014-10-29 14:52                                                       ` Alan Mackenzie
2014-10-29 15:37                                                         ` Eli Zaretskii
2014-10-29 16:59                                                         ` Stefan Monnier
2014-10-29 21:25                                                           ` Alan Mackenzie
2014-10-30  1:49                                                             ` Stefan Monnier
2014-10-30 22:09                                                               ` Alan Mackenzie [this message]
2014-10-31  3:06                                                                 ` Stefan Monnier
2014-10-31  7:55                                                                   ` Eli Zaretskii
2014-10-31 14:04                                                                     ` Stefan Monnier
2014-11-21 15:44                                                                       ` Alan Mackenzie
2014-11-23  9:51                                                                         ` Tassilo Horn
2014-11-23 10:40                                                                           ` Alan Mackenzie
2014-11-23 19:44                                                                             ` Tassilo Horn
2014-11-23 22:04                                                                               ` Alan Mackenzie
2014-11-24 11:34                                                                                 ` Tassilo Horn
2014-11-24 11:53                                                                                   ` David Kastrup
2014-11-24 16:00                                                                                     ` Alan Mackenzie
2014-11-24 14:37                                                                                 ` Stefan Monnier
2014-11-24 16:08                                                                                   ` Alan Mackenzie
2014-11-24 17:44                                                                                     ` Stefan Monnier
2014-10-27  3:36                                       ` Unfreezing the display during auto-repeated scrolling Eli Zaretskii
2014-10-27 10:05                                         ` Alan Mackenzie
2014-10-27 16:48                                           ` Eli Zaretskii
2014-10-27 22:46                                             ` Alan Mackenzie
2014-10-28  0:22                                               ` Stefan Monnier
2014-10-27  3:33                                     ` Unfreezing the display during auto-repeated scrolling. [ Was: Aborting display. Is this possible? ] Eli Zaretskii
2014-10-21 18:01                         ` Aborting display. Is this possible? Stefan Monnier
2014-10-21 15:40                 ` Eli Zaretskii
2014-10-21 17:00                 ` Michael Welsh Duggan
2014-10-21 18:25                   ` Alan Mackenzie
2014-10-20  1:59     ` Stefan Monnier
2014-10-20  2:45       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141030220919.GB2721@acm.acm \
    --to=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.