Subject: Re: bug#12600: 24.2.50; linum-mode: line numbers in fringe do not refresh when resizing frame

From: martin rudalics <[email-masked]>
Date: Sun, 14 Oct 2012 20:33:39 +0200

> How do you know whether the window's buffer was modified, under your
 > suggestion?  Won't we need some record of "the last buffer state when
 > this window was displayed"?  E.g., how do we know that point moved
 > since last full redisplay of the window?

If we do not know whether point moved in a buffer since its last
redisplay, we probably can't optimize anything at all.  But we already
got MODIFF, CHARS_MODIFF, and OVERLAY_MODIFF.  What are these good for
if we always have to redisplay a window showing a buffer whose point
could have moved since the last redisplay?  But apparently
try_cursor_movement handles this if I understand your text below
correctly.  So why are you asking this?

 >> (2) Redraw if the window itself has been modified.
 >
 > You mean, its dimensions or start-point?  Or something else?

That it shows another buffer.  The window code is not able to
discriminate anything else but these three.

 >> (3) Don't redraw the window otherwise.  This would cover the case where
 >>      `point' was moved in a buffer not shown in this window or another
 >>      window was scrolled.
 >>
 >> This would replace checking of windows_or_buffers_changed with a
 >> finer-grained has "this window or its buffer changed".  But after a
 >> cursory look at redisplay_window I doubt that such a change would be
 >> feasible.  And I have no idea to which extent (3) is already covered by
 >> try_window_id.
 >
 > The normal "do-nothing" route is to call try_cursor_movement,

So try_cursor_movement cares about the no buffer change, no overlay
change, no window change, no font change, ... only point movement case.

 > then
 > "goto done".  try_window_id is called only if there's some change that
 > requires redisplaying some of the text, not just moving the cursor.

That's what I meant earlier where you replied by asking "how do we know
that point moved".  The various MODIFFs should tell me whether the
buffer changed.  Some other settings tell me whether some font or the
cursor type changed.  And window_modified tells me whether something in
the window changed that requires to execute try_window_id.  If none of
these changed, the window can stay alone.  All this would work only if
point movement has been handled already.

This would mean that try_cursor_movement had instead of

       && !windows_or_buffers_changed

check

       && !w->window_modified

and the respective MODIFF conjuncts for w's buffer.

BTW, couldn't we instead of

       && !(!NILP (Vtransient_mark_mode)
	   && !NILP (BVAR (current_buffer, mark_active)))

use the more human

       && (NILP (Vtransient_mark_mode)
	   || NILP (BVAR (current_buffer, mark_active)))

here?

martin