Subject: bug#24094: 25.1.50; revert-buffer error in CC mode

From: Alan Mackenzie <[email-masked]>
Date: 29 Jul 2016 17:59:24 -0000

Hello, Richard.

In article <[email-masked]> you wrote:
> When editing C++ files, if I change visited files outside emacs (for
> example, by doing "svn revert -R ."), then visit one of the changed
> files and accept the offer to revert the buffer, in some cases there
> is an error (see below) and the buffer contents are corrupted (chunks
> are missing because the revert operation was interrupted).

This looks like the same bug as bug #24074, but you've managed to capture
a backtrace, for which many thanks.

Could you be a bit more descriptive about the "chunks" that are missing,
please?  Are we talking about lots of isolated 2-character chunks, or
just one or two larger chunks, or what?  Are the chunks at the end of a
buffer, or in the "middle" of it?

> I haven't been able to reduce this to a recipe and I don't know if
> the issue is present in the emacs-25 branch and/or in "emacs -Q".

Almost certainly, the bug isn't in the emacs-25 branch, because the
function c-before-after-change-digit-quote isn't in that branch.

> Here is an example backtrace (control characters replaced):

> Debugger entered--Lisp error: (error "Invalid search bound (wrong side
> of point)")
>   re-search-forward("[0-9a-fA-F]'[0-9a-fA-F]" 175 t)
>   c-before-after-change-digit-quote(65 65 1625)
>   #[(fn) "^H    \n^K#\207" [fn beg end old-len]
> 4](c-before-after-change-digit-quote)
>   mapc(#[(fn) "^H    \n^K#\207" [fn beg end old-len] 4]
> (c-depropertize-new-text c-extend-font-lock-region-for-macros
> c-before-after-change-digit-quote c-after-change-re-mark-raw-strings
> c-neutralize-syntax-in-and-mark-CPP c-restore-<>-properties
> c-change-expand-fl-region))
>   c-after-change(65 65 1625)
>   insert-file-contents("g:/projects/polymorph/working3/src/settings.cpp"
> t nil nil t)
>   revert-buffer-insert-file-contents--default-function("g:/projects/polymorph/working3/src/settings.cpp"
> nil)
>   revert-buffer--default(t t)
>   revert-buffer(t t)
>   find-file-noselect("g:/projects/polymorph/working3/src/settings.cpp")
>   compilation-find-file(#<marker at 1397 in *grep*> "settings.cpp" nil)
>   apply(compilation-find-file #<marker at 1397 in *grep*>
> "settings.cpp" nil nil)
>   compilation-next-error-function(1 nil)
>   next-error(nil)
>   funcall-interactively(next-error nil)
>   call-interactively(next-error nil nil)
>   command-execute(next-error)

> In GNU Emacs 25.1.50.1 (x86_64-w64-mingw32)
>  of 2016-07-25 built on MACHINE
> Repository revision: 6dc6b0079ed3632ed9082bc79d8cb6fc96d33f43
> Windowing system distributor 'Microsoft Corp.', version 10.0.10586
> Recent messages:
> Undo!
> Saving file g:/projects/polymorph/working3/src/model.cpp...
> Wrote g:/projects/polymorph/working3/src/model.cpp
> Reverted 'model.cpp'
> Undo!
> Saving file g:/projects/polymorph/working3/src/model.cpp...
> Wrote g:/projects/polymorph/working3/src/model.cpp
> Reverted 'model.cpp'
> Undo!
> Entering debugger...

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).