From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Llu=C3=ADs?= Vilanova Newsgroups: gmane.emacs.bugs 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 Message-ID: <87oa6uk7et.fsf@fimbulvetr.bsc.es> References: <87k2hjn7pg.fsf@fimbulvetr.bsc.es> <83shw77h79.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1466517557 29342 80.91.229.3 (21 Jun 2016 13:59:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2016 13:59:17 +0000 (UTC) Cc: 23809@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 21 15:59:04 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bFMCm-0008W6-Cy for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Jun 2016 15:59:04 +0200 Original-Received: from localhost ([::1]:52034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFMCg-00041f-L4 for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Jun 2016 09:58:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLZC-0006gH-Ev for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 09:18:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFLZ5-0002He-JF for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 09:18:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLZ5-0002HY-G3 for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 09:18:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bFLZ5-0003KS-9C for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 09:18:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Llu=C3=ADs?= Vilanova Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Jun 2016 13:18:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23809 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23809-submit@debbugs.gnu.org id=B23809.146651508212791 (code B ref 23809); Tue, 21 Jun 2016 13:18:03 +0000 Original-Received: (at 23809) by debbugs.gnu.org; 21 Jun 2016 13:18:02 +0000 Original-Received: from localhost ([127.0.0.1]:48785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFLZ0-0003Js-LD for submit@debbugs.gnu.org; Tue, 21 Jun 2016 09:18:02 -0400 Original-Received: from roura.ac.upc.edu ([147.83.33.10]:43284 helo=roura.ac.upc.es) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFLYv-0003Ja-Al for 23809@debbugs.gnu.org; Tue, 21 Jun 2016 09:17:57 -0400 Original-Received: from gw-2.ac.upc.es (gw-2.ac.upc.es [147.83.30.8]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u5LDHkNR018836; Tue, 21 Jun 2016 15:17:46 +0200 Original-Received: from localhost (unknown [84.88.51.85]) by gw-2.ac.upc.es (Postfix) with ESMTPSA id 20549758; Tue, 21 Jun 2016 15:17:46 +0200 (CEST) In-Reply-To: <83shw77h79.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Jun 2016 23:12:26 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119881 Archived-At: Eli Zaretskii writes: >> From: Llu=C3=ADs Vilanova >> Date: Mon, 20 Jun 2016 18:30:51 +0200 >>=20 >> To reproduce: >>=20 >> * 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: >>=20 >> 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 act= ually >> positive (619194), but the error raised by Emacs complains about the num= ber >> 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 informat= ion I could gather: Fposn_at_point(...) Fvisible_in_window_p(...) -> (824 . -98) pos_visible_p(...) -> line 1713 : *x =3D it2.current_x; value 824 line 1714 : *y =3D 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 sc= roll 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 ea= sy to reproduce. But remember I have zero knowledge on emacs' sources, some I'm p= retty blind here. [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21732#8 Thanks, Lluis