From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24804: 25.1; posn-at-point erroneously signals an error Date: Fri, 28 Oct 2016 11:12:19 +0300 Message-ID: <83h97wsxi4.fsf@gnu.org> References: <87k2cudhgg.fsf@hochschule-trier.de> <58123AFB.201@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1477642410 5879 195.159.176.226 (28 Oct 2016 08:13:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 28 Oct 2016 08:13:30 +0000 (UTC) Cc: 24804@debbugs.gnu.org, politza@hochschule-trier.de To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 28 10:13:26 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c02Hk-0007DJ-Gq for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Oct 2016 10:13:08 +0200 Original-Received: from localhost ([::1]:47367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c02Hn-0007w4-2L for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Oct 2016 04:13:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c02Hh-0007vz-JM for bug-gnu-emacs@gnu.org; Fri, 28 Oct 2016 04:13:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c02He-0004gw-B7 for bug-gnu-emacs@gnu.org; Fri, 28 Oct 2016 04:13:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45982) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c02He-0004gq-7a for bug-gnu-emacs@gnu.org; Fri, 28 Oct 2016 04:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c02Hd-00005c-W5 for bug-gnu-emacs@gnu.org; Fri, 28 Oct 2016 04:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Oct 2016 08:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24804 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24804-submit@debbugs.gnu.org id=B24804.147764234532766 (code B ref 24804); Fri, 28 Oct 2016 08:13:01 +0000 Original-Received: (at 24804) by debbugs.gnu.org; 28 Oct 2016 08:12:25 +0000 Original-Received: from localhost ([127.0.0.1]:33148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c02H2-0008WQ-PU for submit@debbugs.gnu.org; Fri, 28 Oct 2016 04:12:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38699) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c02H1-0008WB-AS for 24804@debbugs.gnu.org; Fri, 28 Oct 2016 04:12:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c02Gs-0004Rf-Kq for 24804@debbugs.gnu.org; Fri, 28 Oct 2016 04:12:17 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c02Gs-0004Ra-HQ; Fri, 28 Oct 2016 04:12:14 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3729 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c02Gr-0005tr-Or; Fri, 28 Oct 2016 04:12:14 -0400 In-reply-to: <58123AFB.201@gmx.at> (message from martin rudalics on Thu, 27 Oct 2016 19:35:55 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:125089 Archived-At: > Date: Thu, 27 Oct 2016 19:35:55 +0200 > From: martin rudalics > > > The documentation of the function posn-at-point states > > > > "Return nil if position is not visible in window.", > > > > but it may also signal an error in this case. This happens, if > > Fpos_visible_in_window_p returns a list of (X Y RTOP RBOT ROWH VPOS) > > and at least Y is negative (which indicates, that pos is not visible > > IIUC). The error is then signaled by Fposn_at_x_y, which only accpets > > non-negative numbers (neglecting the exceptional case of -1 for X). > > > > I think this function should include a similar test for y, as is already > > in place for x, returning nil if it is negative (see below). > > Thanks. But according to Eli the problem is in Fpos_visible_in_window_p > which should never return a negative y in the first place. Maybe it could, when an image is vscrolled? In any case, the proposed patch is IMO incorrect: when point is at a large image (or even a character glyph that's very tall relative to its window's height), this patch will pretend that point is invisible, whereas in fact it's partially visible (as is clear from the use case discussed here). The key to understanding why the patch is wrong is to remember that the Y coordinate of a glyph on display is the coordinate of the top of the glyph. For a large glyph, its top can be off-screen, but most of it could still be visible. This is evident in the value returned by pos-visible-in-window-p in this case: (747 -36 36 6 925 0). It exactly means that the image starts 36 pixels above the window top (and ends 6 pixels below its bottom). Perhaps if RTOP is non-nil, we should pass Y + RTOP to posn-at-x-y.