Hi! Thanks, I tried it out on the trunk, and it seems to be working correctly! I'm open to reimplementing follow-mode in another way, if you think that it's necessary. However, there are two different uses of set-window-start, and maybe we don't need to change both: * Normally, when the position of the active window change, the start of the other windows are updated. This occurs very infrequent, and it would require a redisplay anyway. * When a window shows the empty tail of a buffer, point-max is "hammered" into window-start to ensure that the display engine doesn't recenter the window. Of the two uses, I only consider the second a problem. However, it would probably be easy to handle if there would be a windows-specific option or call-back that could control if the window should be recentered or not. While I'm at it, I realized today that the responsiveness when using follow-mode was better when running the cursor up and down compared to left and right. When looking into the details I saw that the arrow keys no longer were bound to previous- and next-char, so we need to apply the patch below to follow-mode (I don't have write-access to the archives). Thanks for your help, Anders === modified file 'lisp/follow.el' --- lisp/follow.el 2014-01-01 07:43:34 +0000 +++ lisp/follow.el 2014-01-07 07:48:40 +0000 @@ -311,7 +311,7 @@ (set-default symbol value))) (defvar follow-cache-command-list - '(next-line previous-line forward-char backward-char) + '(next-line previous-line forward-char backward-char right-char left-char) "List of commands that don't require recalculation. In order to be able to use the cache, a command should not change the On Mon, Jan 6, 2014 at 5:33 PM, Eli Zaretskii wrote: > > Date: Mon, 6 Jan 2014 09:20:03 +0100 > > From: Anders Lindgren > > Cc: Stefan Monnier , 16129@debbugs.gnu.org > > > > I think the incorrect state occurs when the new early exit occurs from > > redsplay_window. When I added the condition "&& PT == w->last_point", > both > > the recentering problem and speed issues were solved. > > Indeed, this was my conclusion as well. (Except that PT is not quite > right, as the window could be displaying a buffer that is not the > current one at that early point in redisplay_window.) > > What this caused was that the window redisplay was mistakenly skipped, > but then we marked that window's display "accurate", which confused > the heck out of the display engine. > > So I installed the patch below to fix this regression, and I'm marking > this bug done. Feel free to reopen if there are any leftovers. > > Btw, I strongly recommend against messing with window-start (or > anything else that potentially requires redisplay) in a > post-command-hook: doing so disables some important redisplay > optimizations, and can easily trigger subtle misfeatures. I suggest > to look for a better method to do what follow-mode needs to do, even > if that means we'd have to implement a special hook we don't yet have. > > Thanks. > > === modified file 'src/xdisp.c' > --- src/xdisp.c 2014-01-01 17:44:48 +0000 > +++ src/xdisp.c 2014-01-06 16:21:39 +0000 > @@ -15621,7 +15621,8 @@ redisplay_window (Lisp_Object window, bo > && REDISPLAY_SOME_P () > && !w->redisplay > && !f->redisplay > - && !buffer->text->redisplay) > + && !buffer->text->redisplay > + && BUF_PT (buffer) == w->last_point) > return; > > /* Make sure that both W's markers are valid. */ > >