Subject: bug#35191: 27.0.50; Error signaled by undo--wrap-and-run-primitive-undo

From: Stefan Monnier <[email-masked]>
Date: Mon, 08 Apr 2019 08:57:56 -0400

Package: Emacs
Version: 27.0.50

Save the file below and then open it as follows:

    % emacs -Q ..../zones.el
    C-M-f C-M-b                   ;; Move before first form
    C-M-SPC M-;                   ;; Comment out first form
    C-x u                         ;; Undo last change

When I do that, I see an error message in the echo area that says:

    Changes to be undone by function different than announced

If I redo this after enabling the debugger on error, I get the following
backtrace:

Debugger entered--Lisp error: (error "Changes to be undone by function different than an...")
  signal(error ("Changes to be undone by function different than an..."))
  error("Changes to be undone by function different than an...")
  primitive-undo(1 ((apply -4 44189 44226 undo--wrap-and-run-primitive-undo 44189 44226 ((44189 . 44192) (#(" " 0 1 (fontified t)) . -44223) (#<marker (moves after insertion) in no buffer> . 1) (44222 . 44223) 44189)) nil (apply 3 44189 44223 undo--wrap-and-run-primitive-undo 44189 44223 ((#("\n" 0 1 (face font-lock-comment-face fontified t)) . 44222) (44223 . 44224) (#(";; " 0 3 (face font-lock-comment-delimiter-face fontified t)) . 44189))) nil (apply -4 44189 44226 undo--wrap-and-run-primitive-undo 44189 44226 ((44189 . 44192) (#(" " 0 1 (fontified t)) . -44223) (#<marker (moves after insertion) in no buffer> . 1) (44222 . 44223) 44189)) (t 23723 17250 171044 280000)))
  undo-more(1)
  undo(nil)
  funcall-interactively(undo nil)
  call-interactively(undo nil nil)
  command-execute(undo)