GNU bug report logs - #20734
25.0.50; "Args out of range" with help-window-select t

Previous Next

Package: emacs;

Reported by: Nicolas Richard <youngfrog <at> members.fsf.org>

Date: Thu, 4 Jun 2015 19:48:02 UTC

Severity: normal

Found in version 25.0.50

Done: Nicolas Richard <youngfrog <at> members.fsf.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 20734 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <youngfrog <at> members.fsf.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20734 <at> debbugs.gnu.org
Subject: Re: bug#20734: 25.0.50; "Args out of range" with help-window-select t
Date: Fri, 05 Jun 2015 11:25:35 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:
>> 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?

Yes, that's what I was guessing anyway.

>          If so, please show the evidence: what is in current_buffer
> and what is recorded as the selected window's buffer at that point.

Let me try that. What I did :
1. run under gdb
2. follow the recipe up to the point where I type "C-h f if", but don't
   hit RET
3. then go to gdb window
4. hit C-z to put a breakpoint in adjust_point_for_property
5. continue
6. go back to emacs and hit RET

Now back to gdb :
(gdb) p XBUFFER(XWINDOW(selected_window)->contents)->name_
$1 = 143880388
(gdb) xpr
Lisp_String
$2 = (struct Lisp_String *) 0x89370c0
"*Help*"
(gdb) p current_buffer->name_
$3 = 139646148
(gdb) xpr
Lisp_String
$4 = (struct Lisp_String *) 0x852d4c0
"*Messages*"
(gdb) p PT
$5 = 10067
(gdb) p Fwindow_point (selected_window)
$6 = 6

> 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.

In command_loop_1 ?

I can more or less follow the code step by step, but I don't really
understand it. The only thing I'm now almost 100% confident is that in
this call (found in adjust_point_for_property) :
  get_char_property_and_overlay
      (make_number (PT), Qdisplay, selected_window,
       &overlay))
PT refers to current_buffer, which is different from the buffer in
selected_window in the situation I encountered.

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

Thanks. This works for me, but is it TRT ?

Commit 53fb39a08a6d18b67ea6073966874fa700d9f97f
References: yf-master
Author:     Nicolas Richard <youngfrog <at> members.fsf.org>
AuthorDate: Fri Jun 5 11:18:19 2015 +0200
Commit:     Nicolas Richard <youngfrog <at> members.fsf.org>
CommitDate: Fri Jun 5 11:20:08 2015 +0200

    * src/keyboard.c (adjust_point_for_property): Use selected window (Bug#20590)

1 parent commit, 6 merged branches, 1 containing branch
 Parent     | f10a924 (todo-show): Throw an error if buffer is empty but was modified.
 Merged     | emacs-24 master run-2015-05-29_19-09 running yf-fix-query-replace-with-NULs yf-master
 Containing | yf-master
 Follows    | emacs-24.5-rc3-fixed (4919)

1 file changed, 4 insertions(+), 2 deletions(-)
 src/keyboard.c | 6 ++++--

modified   src/keyboard.c
@@ -1702,8 +1702,10 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
       if (check_display
 	  && PT > BEGV && PT < ZV
 	  && !NILP (val = get_char_property_and_overlay
-		              (make_number (PT), Qdisplay, selected_window,
-			       &overlay))
+		              (make_number
+                               (marker_position
+                                (XWINDOW (selected_window)->pointm)),
+                               Qdisplay, selected_window, &overlay))
 	  && display_prop_intangible_p (val, overlay, PT, PT_BYTE)
 	  && (!OVERLAYP (overlay)
 	      ? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil)

-- 
Nico.




This bug report was last modified 10 years and 49 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.