bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Lluís Vilanova
Subject: bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
Date: Tue, 21 Jun 2016 15:17:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eli Zaretskii writes:

>> From: Lluís Vilanova <address@hidden>
>> 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?

If I evaluate it after the error (when in the Backtrace buffer), I get nil
(pos-visible-in-window-p (window-point window) window). Using gdb it's a
different value (see below).


>> 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.)

I have zero knowledge on Emacs' source code, but here's the little information I
could gather:

  Fposn_at_point(...)
    Fvisible_in_window_p(...) -> (824 . -98)
      pos_visible_p(...) ->
        line 1713 : *x = it2.current_x;
        value            824
        line 1714 : *y = it2.current_y + it2.max_ascent - it2.ascent;
        value            -98             533              533
    Fposn_at_x_y(824, -98, window, nil)

After reading [1], it sounds to me that pdf-tools (and doc-view) let you scroll
the buffer, but never move point. That could be a reason to get a negative
position AFAIU.

Tell me if you want something more specific, since the problem is pretty easy to
reproduce. But remember I have zero knowledge on emacs' sources, some I'm pretty
blind here.


[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21732#8

Thanks,
  Lluis





reply via email to

[Prev in Thread] Current Thread [Next in Thread]