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

From: Daniel McClanahan <[email-masked]>
Date: Thu, 22 Oct 2015 02:12:05 -0500

I've been experiencing this issue at least for months, I don't think I
remember a time when it wasn't happening (I've only used emacs for a
year or so). Occasionally, when viewing a file in doc-view-mode, I've
noticed that using windmove (which I use for all my window movements)
left, right, up, or down occasionally fails, throwing the error "Wrong
type argument: wholenump, -<num>", for some number num.

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) in doc-view
buffers, I haven't been able to see where the cursor position is
updated, and I've spent a few hours checking it out but am finding it
difficult to follow a lot of the xdisp.c code.

Is this something that has been seen before? I encounter it relatively
often when working with a text buffer open in one window and a pdf
open in doc-view-mode in an adjacent window.

Steps to reproduce: kind of hard, since it's very intermittent.
Basically, just switch window focus between a pdf and another buffer a
few times over a period of editing time, and it should show up
(typically within 30 minutes for me).

I've also noticed that when this "wholenump" error occurs, the line
number in the mode line is set to (1- the number of lines in the
document), when the line number in the mode line for doc-view-mode is
usually set to 1. I don't recall when this is changed. Also, after
this situation occurs (the wholenump error appears), I cannot zoom in
or out or change pages.

Sorry for the poor report, I wish I had more information but wanted to
know if this was a known problem already.