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

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

[debbugs-tracker] bug#24804: closed (25.1; posn-at-point erroneously sig


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#24804: closed (25.1; posn-at-point erroneously signals an error)
Date: Sat, 29 Oct 2016 22:04:02 +0000

Your message dated Sun, 30 Oct 2016 01:03:17 +0300
with message-id <address@hidden>
and subject line Re: bug#24804: 25.1; posn-at-point erroneously signals an error
has caused the debbugs.gnu.org bug report #24804,
regarding 25.1; posn-at-point erroneously signals an error
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
24804: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24804
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 25.1; posn-at-point erroneously signals an error Date: Wed, 26 Oct 2016 21:43:27 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
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).

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);
     }
--

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

--- End Message ---
--- Begin Message --- Subject: Re: bug#24804: 25.1; posn-at-point erroneously signals an error Date: Sun, 30 Oct 2016 01:03:17 +0300
> From: Andreas Politz <address@hidden>
> Cc: address@hidden
> Date: Sat, 29 Oct 2016 22:33:00 +0200
> 
> Eli Zaretskii <address@hidden> writes:
> 
> > Done.  Let me know if something else should be done before closing
> > this bug.
> 
> Nothing.  I'm not clear about the general semantics of this function,
> but we don't need to discuss this right now.

OK, I'm therefore closing the bug (and the two merged with it).
People who think there are still leftovers are welcome to reopen with
details.

As for your questions about the semantics, I suggest to start a
discussion on emacs-devel.

Thanks.


--- End Message ---

reply via email to

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