unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: 24.0.50; args-out-of-range while reverting C++ header file
       [not found] <87zkuo2djr.fsf@telefonica.net>
@ 2010-10-09 13:46 ` Alan Mackenzie
  2010-10-09 14:05   ` Miles Bader
       [not found] ` <83wrprn3ou.fsf@gnu.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2010-10-09 13:46 UTC (permalink / raw)
  To: Oscar Fuentes; +Cc: emacs-devel

Hi, Oscar

On Sat, Oct 09, 2010 at 06:30:32AM +0200, Oscar Fuentes wrote:

> emacs -Q
> C-x C-f some-moderately-big-header-file.h
> <make some big modification on disk to the file>
> M-x revert-buffer
> Lisp error: (args-out-of-range 580 36722)

I do this, but can't reproduce the error.  Can you please be precise
about which file.h triggers the problem (send me a copy of it if it's
outside of Emacs, please) and what the "big modification" is.

I built the latest Emacs-24 last night.  I tried it with loading
.../emacs/src/lisp.h, then

M-5 M->
M-<
C-w
M-x revert-buffer<CR>yes

So, what file (?ffi.h) was it, please, and what did you do to it?

This error message has been thrown before in the medium past, but I
think this is something new.

> The buffer is left semi-reverted, on an edited state. Doing a M-x
> revert-buffer again works ok.

> Setting debug-on-error to t shows this:

> Debugger entered--Lisp error: (args-out-of-range 580 36722)
>   remove-text-properties(580 36722 (category))
>   c-clear-char-property-with-value-function(1 36722 category c-cpp-delimiter)
>   c-neutralize-syntax-in-and-mark-CPP(174 174 36141)
>   c-after-change(174 174 36141)
>   insert-file-contents("/home/oscar/dev/idb/lp0/ffi.h" t nil nil t)
>   revert-buffer(t)
>   call-interactively(revert-buffer t nil)
>   execute-extended-command(nil)
>   call-interactively(execute-extended-command nil nil)

> In GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, X toolkit)
>  of 2010-09-16 on qcore

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 24.0.50; args-out-of-range while reverting C++ header file
  2010-10-09 13:46 ` 24.0.50; args-out-of-range while reverting C++ header file Alan Mackenzie
@ 2010-10-09 14:05   ` Miles Bader
  2010-10-09 14:14     ` Oscar Fuentes
  0 siblings, 1 reply; 6+ messages in thread
From: Miles Bader @ 2010-10-09 14:05 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Oscar Fuentes, emacs-devel

Alan Mackenzie <acm@muc.de> writes:
>> C-x C-f some-moderately-big-header-file.h
>> <make some big modification on disk to the file>
>> M-x revert-buffer
>> Lisp error: (args-out-of-range 580 36722)
>
> I do this, but can't reproduce the error.  Can you please be precise
> about which file.h triggers the problem (send me a copy of it if it's
> outside of Emacs, please) and what the "big modification" is.
>
> I built the latest Emacs-24 last night.  I tried it with loading
> .../emacs/src/lisp.h, then

Hmm, I'm getting similar behavior, but I'm not using "revert-buffer".

I think the basic scenario is:

  1) I have a buffer visiting config.h (autoconf-generated)

  2) I re-run make or something, which causes config.h to be regenerated
  and changed (the latter's important, as autoconf doesn't touch it if
  the contents don't actually change)

  3) I visit config.h again with find-file; since it's already in a
  buffer, but has changed, Emacs asks the usual question in this
  situation:

     File config.h changed on disk.  Reread from disk? (yes or no) 

  4) I answer "yes RET", and then I get an error:

     c-clear-char-property-with-value-function: Args out of range: 464, 3922

  [and don't end up visiting the vile]

  5) I use find-file again on config.h; this time, Emacs asks:

     File config.h changed on disk.  Discard your edits? (yes or no)

  [despite the fact that I never actually made any changes to that
  buffer; I guess the failed update changed it.]

  6) I answer "yes RET", and this time am left in the config.h buffer,
  properly updated from disk.

I think this recipe can be fairly easily followed (you can just touch
the file or something, of course, instead of getting autoconf to change
it).

Thanks,

-Miles

-- 
gravity a demanding master ... soft soft snow



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 24.0.50; args-out-of-range while reverting C++ header file
  2010-10-09 14:05   ` Miles Bader
@ 2010-10-09 14:14     ` Oscar Fuentes
  0 siblings, 0 replies; 6+ messages in thread
From: Oscar Fuentes @ 2010-10-09 14:14 UTC (permalink / raw)
  To: Miles Bader; +Cc: Alan Mackenzie, emacs-devel

Miles Bader <miles@gnu.org> writes:

[snip]

> I think this recipe can be fairly easily followed (you can just touch
> the file or something, of course, instead of getting autoconf to change
> it).

Not really. The file on disk must be different from the file on the
buffer, and the file must have certain features (as it doesn't happen
with all files.) I just posted a test case to bug#7181 with attached
files for reproducing the problem.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bug#7181: 24.0.50; args-out-of-range while reverting C++ header file
       [not found]     ` <87ocb331wo.fsf@telefonica.net>
@ 2010-10-09 21:13       ` Alan Mackenzie
  2010-10-09 22:08         ` after-change-functions hook arguments (was: bug#7181: 24.0.50; args-out-of-range while reverting C++ header file) Óscar Fuentes
  2010-10-09 23:33         ` bug#7181: 24.0.50; args-out-of-range while reverting C++ header file Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Alan Mackenzie @ 2010-10-09 21:13 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: 7181, emacs-devel

Hi, Óscar,

On Sat, Oct 09, 2010 at 03:56:39PM +0200, Óscar Fuentes wrote:
> With the attached files the problem can be reproduced predictability:
> 
> Save the attached files b.h.master and b.h.next to a directory and cd to
> it.
> 
> $ emacs -Q &
> $ cp b.h.master b.h
> C-x C-f b.h
> $ cp b.h.next b.h
> M-x revert-buffer
> 
> and the args-out-of-range error pops:
> 
> c-clear-char-property-with-value-function: Args out of range: 166, 453
> 
> I was unable to try with the latest Emacs sources because the build is
> broken. My Emacs is from the 16 September.
> 

Thanks for the recipe.  I turned on debug-on-error and got this
traceback:

Debugger entered--Lisp error: (args-out-of-range 166 453)
  remove-text-properties(166 453 (category))
  c-clear-char-property-with-value-function(1 453 category c-cpp-delimiter)
  c-neutralize-syntax-in-and-mark-CPP(94 94 286)
  c-after-change(94 94 286) <<======================================
  insert-file-contents("/home/acm/b.h" t nil nil t)
  revert-buffer(t)
  call-interactively(revert-buffer nil nil)

c-after-change is on the after-change-functions hook.  The values of BEG
END OLD-LEN it is being passed look utterly wrong.  BEG and END should
delimit the entire buffer and OLD-LEN should be the length of the
previous buffer.  Surely?

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 6+ messages in thread

* after-change-functions hook arguments (was: bug#7181: 24.0.50; args-out-of-range while reverting C++ header file)
  2010-10-09 21:13       ` bug#7181: " Alan Mackenzie
@ 2010-10-09 22:08         ` Óscar Fuentes
  2010-10-09 23:33         ` bug#7181: 24.0.50; args-out-of-range while reverting C++ header file Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Óscar Fuentes @ 2010-10-09 22:08 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 7181, emacs-devel

Alan Mackenzie <acm@muc.de> writes:

> Thanks for the recipe.  I turned on debug-on-error and got this
> traceback:
>
> Debugger entered--Lisp error: (args-out-of-range 166 453)
>   remove-text-properties(166 453 (category))
>   c-clear-char-property-with-value-function(1 453 category c-cpp-delimiter)
>   c-neutralize-syntax-in-and-mark-CPP(94 94 286)
>   c-after-change(94 94 286) <<======================================
>   insert-file-contents("/home/acm/b.h" t nil nil t)
>   revert-buffer(t)
>   call-interactively(revert-buffer nil nil)
>
> c-after-change is on the after-change-functions hook.  The values of BEG
> END OLD-LEN it is being passed look utterly wrong.  BEG and END should
> delimit the entire buffer and OLD-LEN should be the length of the
> previous buffer.  Surely?

Seems that insert-file-contents is trying to be smart and determine
which parts of the contents are shared among the old and the new
text. On this case b.h.next and b.h.master differ only on the central
region of text. The arguments passed to c-after-change indicates a
deletion from position 94 to position 94+286=380.

I don't know if that is correct, as the transformation is not a deletion
but a replacement of the middle text segment of the buffer with a text
chunk of different lenght, and the doc is not clear about that case.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bug#7181: 24.0.50; args-out-of-range while reverting C++ header file
  2010-10-09 21:13       ` bug#7181: " Alan Mackenzie
  2010-10-09 22:08         ` after-change-functions hook arguments (was: bug#7181: 24.0.50; args-out-of-range while reverting C++ header file) Óscar Fuentes
@ 2010-10-09 23:33         ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2010-10-09 23:33 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Óscar Fuentes, 7181, emacs-devel

>> With the attached files the problem can be reproduced predictability:
>> 
>> Save the attached files b.h.master and b.h.next to a directory and cd to
>> it.
>> 
>> $ emacs -Q &
>> $ cp b.h.master b.h
>> C-x C-f b.h
>> $ cp b.h.next b.h
>> M-x revert-buffer
>> 
>> and the args-out-of-range error pops:
>> 
>> c-clear-char-property-with-value-function: Args out of range: 166, 453
>> 
>> I was unable to try with the latest Emacs sources because the build is
>> broken. My Emacs is from the 16 September.
>> 

> Thanks for the recipe.  I turned on debug-on-error and got this
> traceback:

> Debugger entered--Lisp error: (args-out-of-range 166 453)
>   remove-text-properties(166 453 (category))
>   c-clear-char-property-with-value-function(1 453 category c-cpp-delimiter)
>   c-neutralize-syntax-in-and-mark-CPP(94 94 286)
>   c-after-change(94 94 286) <<======================================
>   insert-file-contents("/home/acm/b.h" t nil nil t)
>   revert-buffer(t)
>   call-interactively(revert-buffer nil nil)

> c-after-change is on the after-change-functions hook.  The values of BEG
> END OLD-LEN it is being passed look utterly wrong.  BEG and END should
> delimit the entire buffer and OLD-LEN should be the length of the
> previous buffer.  Surely?

No, here the after-change is called right after removing the chars that
are different, and just before inserting the new (different) chars.
You can reproduce the same error without reverting:

emacs -Q b.h.master
M-x c-mode
C-u 93 C-f
C-SPC
C-u 286 C-f
C-w


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-09 23:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87zkuo2djr.fsf@telefonica.net>
2010-10-09 13:46 ` 24.0.50; args-out-of-range while reverting C++ header file Alan Mackenzie
2010-10-09 14:05   ` Miles Bader
2010-10-09 14:14     ` Oscar Fuentes
     [not found] ` <83wrprn3ou.fsf@gnu.org>
     [not found]   ` <87sk0f32pp.fsf@telefonica.net>
     [not found]     ` <87ocb331wo.fsf@telefonica.net>
2010-10-09 21:13       ` bug#7181: " Alan Mackenzie
2010-10-09 22:08         ` after-change-functions hook arguments (was: bug#7181: 24.0.50; args-out-of-range while reverting C++ header file) Óscar Fuentes
2010-10-09 23:33         ` bug#7181: 24.0.50; args-out-of-range while reverting C++ header file Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).