On 2 Nov 2015 10:09 pm, "Alan Mackenzie" wrote: > Of course, nothing is ever that simple. ;-). I've got a working > version which doesn't use "(sit-for 0)", thus allowing point to move > properly over Follow Mode windows. > > However, this meant the "old" highlighting not being erased until the > 0.25 seconds had passed. So I tried testing the conditions for a new > lazy-highlight loop (apart from window-start/end changing) in the > command loop bit. > It struck me that instead of all this rigmarole, and instead of the > "(sit-for 0)", we could test whether or not a scroll is about to take > place. Or we can cleanup the lazy highlighting _when_ scrolling takes place. > What we could do with is an interface which will tell us whether or not > redisplay would scroll if invoked immediately, with the current value of > point, window-start, etc. I don't think that's necessary. What if isearch just added (lazy-highlight-cleanup t) to window-scroll-functions? I want to be very cautious about not increasing the complexity of isearch code here, but so far these sound like good refactorings to me.