Subject: bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 Jun 2016 23:12:26 +0300

> From: Lluís Vilanova <[email-masked]>
> Date: Mon, 20 Jun 2016 18:30:51 +0200
> 
> To reproduce:
> 
> * Open a PDF on a separate window on the same frame using pdf-tools.
> * Select that window.
> * Scroll a bit down the first page of the PDF.
> * Use windmove to move from the pdf-view-mode buffer to the first one.

Sounds like a duplicate of bug #21732.

> With these steps, I get this backtrace:
> 
>   Debugger entered--Lisp error: (wrong-type-argument wholenump -14)
>     posn-at-point(619194 #)

What does pos-visible-in-window-p return for that buffer position?

> Note how the argument to posn-at-point (returned by window-point) is actually
> positive (619194), but the error raised by Emacs complains about the number
> being negative (-14).

That's not relevant: 619194 is a buffer position, whereas -14 is the
y-coordinate (in pixels) passed by posn-at-point to posn-at-x-y.  The
latter cannot cope with negative y coordinates, for reasons that
should be obvious.

The question is how that -14 coordinate came into existence.  If you
can step with a debugger into Fpos_visible_in_window_p, and see what's
going on there, that would be helpful.  (I cannot try that myself, as
my systems don't support pdf-view-mode.)

Thanks.