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

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 25 Jun 2019 02:15:51 +0200

Clément Pit--Claudel <[email-masked]> writes:

> 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"))

I can confirm that this is still the case.

This code in diff-unified->context certainly looks like a likely culprit:

		(unless (or (not reversible) (eq buffer-undo-list t))
                  ;; Drop the many undo entries and replace them with
                  ;; a single entry that uses diff-context->unified to do
                  ;; the work.
		  (setq buffer-undo-list
			(cons (list 'apply (- old-end end) start (point-max)
				    'diff-context->unified start (point-max))
			      old-undo)))))))))))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no