Subject: bug#7181: 24.0.50; args-out-of-range while reverting C++ header file

From: Óscar Fuentes <[email-masked]>
Date: Sat, 09 Oct 2010 15:39:14 +0200

Eli Zaretskii <[email-masked]> writes:

>> 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)
>> 
>> 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))
>
> Can you verify that the problem happens because one or both argument
> positions of remove-text-properties don't exist due to the changes?

Essentially, the end position which is out of range corresponds to the
size of the *previous* contents of the file, not of the current
file. For instance:

While visiting file ffi.h with size 26675, replace it on disk with
another version of 36721 bytes, revert-buffer, (args-out-of-range 580
26676).

If we are visiting the long version of ffi.h (the one with 36721 bytes)
and replace it on disk with the short version, then (args-out-of-range
580 36722).

On both cases the buffer is left with 580 bytes of content, part of them
belonging to the beginning of the file and the other part to the end of
the file. The first byte missing from the buffer after revert-buffer
fails is the first character which differs from one version to another
of the file.

I'll try to reduce a test case file.