On 11/30/2012 01:53 PM, Eli Zaretskii wrote: > OK. So what do you suggest, in practical terms? Are you saying that > we should use BUF_MODIFF(XBUFFER (w->buffer)) instead of MODIFF and > BUF_OVERLAY_MODIFF(XBUFFER (w->buffer)) instead of OVERLAY_MODIFF > inside window_outdated? Or do you suggest something else? > > I'm okay with using BUF_* macros in window_outdated. There is one more similar thing: if we can enter redisplay_internal with different current_buffer and selected window's buffer, we can confuse reconsider_clip_changes, which comment explicitly assumes that W->buffer and B are the same buffer. What if we just delay the real redisplay action until current_buffer and selected window's buffer becomes synchronized, assuming that it happens in the very near future (when someone finally update current_buffer with selected window's buffer and then attract redisplay attention with ++windows_or_buffers_changed or similar)? > So if window_outdated is called not from redisplay_window or its > subroutines, we cannot assume that current_buffer and the selected > window's buffer are the same. Also, for minibuffer windows and > pseudo-windows, we may need more care, but I'm not sure. IIUC pseudo-windows are always non-leaf; so, selected_window can't be a pseudo-window, and pseudo-window can't be passed to redisplay_window. Attached patch illustrates all from the above. Dmitry