Subject: bug#20734: 25.0.50; "Args out of range" with help-window-select t

From: Eli Zaretskii <[email-masked]>
Date: Fri, 05 Jun 2015 09:41:31 +0300

> From: Nicolas Richard <[email-masked]>
> Date: Thu, 04 Jun 2015 21:47:08 +0200
> 
>     Fix display of overlapping window-specific overlays
>     
>     * src/keyboard.c (adjust_point_for_property): When adjusting point
>     due to display strings, ignore overlays that are specific to
>     windows other than the currently selected one.
>     
>     * src/xdisp.c (handle_single_display_spec): If the display
>     property comes from an overlay, arrange for buffer iteration to
>     resume only after the end of that overlay.  (Bug#20607)
> 
> I understand that
>   get_char_property_and_overlay
>       (make_number (PT), Qdisplay, selected_window,
>        &overlay))
> should not refer to PT but to "PT in selected_window", but I don't know
> how to do that.

Are you saying that adjust_point_for_property is called with the
current buffer different from what's recorded in selected_window's
buffer?  If so, please show the evidence: what is in current_buffer
and what is recorded as the selected window's buffer at that point.

And please note that the conditions in the 'if' clause that determine
whether adjust_point_for_property is called freely manipulate values
of current_buffer and PT, so perhaps the solution is add there a
condition that selected_window's buffer and current_buffer are equal,
such that in the case in point adjust_point_for_property is not called
at all.

To answer your question directly, it should be possible to compute the
(Lisp integer) value of point in the selected window as either

    make_number (marker_position (XWINDOW (selected_window)->pointm))
or
    Fwindow_point (selected_window)
or
    make_number (XBUFFER (XWINDOW (selected_window)->contents)->pt)