Subject: bug#24556: 25.1.50; Undo partially broken in patch mode

From: Clément Pit--Claudel <[email-masked]>
Date: Wed, 28 Sep 2016 09:28:43 -0400

Recipe in emacs -Q:

* Open a patch or diff file
* Press C-c C-d [diff-unified->context]
* Press C-_ [undo]

Undo fails with the following backtrace:

Debugger entered--Lisp error: (error "Changes to be undone by function different than announced")
  signal(error ("Changes to be undone by function different than announced"))
  error("Changes to be undone by function different than announced")
  primitive-undo(1 ((apply -274 1289 9209 diff-context->unified 1289 9209) (apply -271 514 1289 diff-context->unified 514 1289) (#("---" 0 3 (fontified t face diff-header)) . 478) (481 . 484) (#("+++" 0 3 (fontified t face diff-header)) . 496) (t 22126 61486 433935 691000) (t 22126 61486 433935 691000) (499 . 502) (t 22126 61486 433935 691000)))
  undo-more(1)
  undo(nil)
  funcall-interactively(undo nil)
  call-interactively(undo nil nil)
  command-execute(undo)

Clément.

In GNU Emacs 25.1.50.7 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-07-20 built on clem-w50-mint
Repository revision: a1a0c208e3e895a6ea0942e8e5c4077faf12c7ad
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description:	Linux Mint 18 Sarah