From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.bugs Subject: bug#24804: 25.1; posn-at-point erroneously signals an error Date: Wed, 26 Oct 2016 21:43:27 +0200 Message-ID: <87k2cudhgg.fsf@hochschule-trier.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1477511141 24443 195.159.176.226 (26 Oct 2016 19:45:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Oct 2016 19:45:41 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: 24804@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 26 21:45:35 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 1bzU8L-0002I1-9q for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Oct 2016 21:45:09 +0200 Original-Received: from localhost ([::1]:37145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzU8N-0000HN-PR for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Oct 2016 15:45:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzU8H-0000Fh-E8 for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 15:45:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzU8E-0007vJ-Dv for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 15:45:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42502) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bzU8E-0007vD-Ap for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 15:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bzU8E-0006db-1u for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 15:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andreas Politz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Oct 2016 19:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24804 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.147751104225420 (code B ref -1); Wed, 26 Oct 2016 19:45:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Oct 2016 19:44:02 +0000 Original-Received: from localhost ([127.0.0.1]:57901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzU7F-0006bm-Ix for submit@debbugs.gnu.org; Wed, 26 Oct 2016 15:44:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50274) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzU7C-0006bM-UQ for submit@debbugs.gnu.org; Wed, 26 Oct 2016 15:43:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzU74-0007Kk-J6 for submit@debbugs.gnu.org; Wed, 26 Oct 2016 15:43:53 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:60464) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzU74-0007KT-GB for submit@debbugs.gnu.org; Wed, 26 Oct 2016 15:43:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzU6z-00007j-VF for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 15:43:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzU6v-0007D8-S0 for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 15:43:46 -0400 Original-Received: from gateway-a.fh-trier.de ([143.93.54.181]:41521) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzU6v-0007BP-IU for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 15:43:41 -0400 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier (RZ/HT)] Original-Received: from localhost (ip5f5bdf6a.dynamic.kabel-deutschland.de [95.91.223.106]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id 857FE17992B9 for ; Wed, 26 Oct 2016 21:43:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1477511007; bh=xjfq3bp9gsHDqzcwR+0novXBkj0=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=qR7/3YSMsPtT6QAvtBJjq6uaNz+99X2LkY6N9Uj77Lsvz+hijpw0UvCkLW/4cNxqq qb1DkhGd1QLbEVgt7n5zNn5WtzT+Pjyc/HnTyaoPRigv9qri0gYlgHcxIAIgHX7K3U UOZCYQ7R1lhB++JpFvDkJBauyUc7Ncn2YwBfdEL0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:125046 Archived-At: --=-=-= Content-Type: text/plain 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). --=-=-= Content-Type: text/x-diff Content-Disposition: inline Content-Description: posn_at_point.diff diff --git a/src/keyboard.c b/src/keyboard.c index bb411e7..215fcb9 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10791,9 +10791,10 @@ The `posn-' functions access elements of such lists. */) Lisp_Object x = XCAR (tem); Lisp_Object y = XCAR (XCDR (tem)); - /* Point invisible due to hscrolling? X can be -1 when a - newline in a R2L line overflows into the left fringe. */ - if (XINT (x) < -1) + /* Point invisible due to hscrolling or vscrolling? X can be -1 + when a newline in a R2L line overflows into the left + fringe. */ + if (XINT (x) < -1 || XINT (y) < 0) return Qnil; tem = Fposn_at_x_y (x, y, window, Qnil); } --=-=-= Content-Type: text/plain -- Reproducing this state may be a little bit tricky, anyway evaluate the following lines, starting with `emacs -Q'. (defvar img "foo.png");; The image should be taller then the window ;; it's displayed in. (setq debug-on-error t) (find-file img) (redisplay t) ;; If in batch mode. (image-scroll-up 999) ;; The image should be scrolled to the bottom now, while point equals 1. (posn-at-point (point-max) (selected-window)) -- Note, that this bug may make switching buffers difficult in certain situations, as was reported here: https://github.com/politza/pdf-tools/issues/200 -ap --=-=-=--