Subject: bug#21732: 25.0.50; intermittent failure using windmove when in doc-view buffer

From: martin rudalics <[email-masked]>
Date: Thu, 22 Oct 2015 12:05:08 +0200

> I've attached gdb and found that this is because "cursor.y" of the
 > window being chosen is negative, which I found after attaching a
 > breakpoint to "posn-at-point," which was throwing the error, and
 > following it down a few calls to "pos_visible_p", and checking the
 > value of "w" in there. I don't know what "w->cursor.y" represents (I
 > know it's cursor position, but I don't know how that maps to the
 > cursor's lisp representation), and although I've delved into xdisp.c
 > to see why that would be negative (but only sometimes)

FWIW w->cursor.y can be negative when the text of w was scrolled
vertically out of view.  We could simply disallow ‘pos_visible_p’ making
a negative y value and have it return false but it might be interesting
to find out what happened.  IIUC there's only one assignment in
‘pos_visible_p’ that could be responsible:

	  *y = it2.current_y + it2.max_ascent - it2.ascent;

You could try checking that.  And surely Eli has a better idea.

martin