diff --git a/lisp/subr.el b/lisp/subr.el index e7a0ffc5be..dc38ffeb7e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2596,7 +2596,8 @@ atomic-change-group user can undo the change normally." (declare (indent 0) (debug t)) (let ((handle (make-symbol "--change-group-handle--")) - (success (make-symbol "--change-group-success--"))) + (success (make-symbol "--change-group-success--")) + (result (make-symbol "--change-group-result--"))) `(let ((,handle (prepare-change-group)) ;; Don't truncate any undo data in the middle of this. (undo-outer-limit nil) @@ -2609,8 +2610,9 @@ atomic-change-group ;; it enables undo if that was disabled; we need ;; to make sure that it gets disabled again. (activate-change-group ,handle) - ,@body - (setq ,success t)) + (setq ,result (progn ,@body)) + (setq ,success t) + ,result) ;; Either of these functions will disable undo ;; if it was disabled before. (if ,success