aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2020-11-27 09:43:56 -0500
committerStefan Monnier2020-11-27 09:43:56 -0500
commit66eeaaa48858572d47ff3b0b177d5b765df93418 (patch)
treebe9923eb0bb08d4b374a0203f6793c279881740f
parent2b14b7e6dcdf54d5a85f612b7e0c0e1da9ec40a1 (diff)
downloademacs-66eeaaa48858572d47ff3b0b177d5b765df93418.tar.gz
emacs-66eeaaa48858572d47ff3b0b177d5b765df93418.zip
* lisp/subr.el (activate-change-group): Fix bug#33341
-rw-r--r--lisp/subr.el5
-rw-r--r--test/lisp/subr-tests.el12
2 files changed, 16 insertions, 1 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index e009dcc2b9a..1cf3a49fe4f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3036,7 +3036,10 @@ to `accept-change-group' or `cancel-change-group'."
3036 (dolist (elt handle) 3036 (dolist (elt handle)
3037 (with-current-buffer (car elt) 3037 (with-current-buffer (car elt)
3038 (if (eq buffer-undo-list t) 3038 (if (eq buffer-undo-list t)
3039 (setq buffer-undo-list nil))))) 3039 (setq buffer-undo-list nil)
3040 ;; Add a boundary to make sure the upcoming changes won't be
3041 ;; merged with any previous changes (bug#33341).
3042 (undo-boundary)))))
3040 3043
3041(defun accept-change-group (handle) 3044(defun accept-change-group (handle)
3042 "Finish a change group made with `prepare-change-group' (which see). 3045 "Finish a change group made with `prepare-change-group' (which see).
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 67f7fc97496..e3f798d11cf 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -551,5 +551,17 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350."
551 (should (equal (replace-regexp-in-string "\\`\\|x" "z" "--xx--") 551 (should (equal (replace-regexp-in-string "\\`\\|x" "z" "--xx--")
552 "z--zz--"))) 552 "z--zz--")))
553 553
554(ert-deftest subr-tests--change-group-33341 ()
555 (with-temp-buffer
556 (buffer-enable-undo)
557 (insert "0\n")
558 ;; (undo-boundary)
559 (let ((g (prepare-change-group)))
560 (activate-change-group g)
561 (insert "b\n")
562 (insert "c\n")
563 (cancel-change-group g))
564 (should (equal (buffer-string) "0\n"))))
565
554(provide 'subr-tests) 566(provide 'subr-tests)
555;;; subr-tests.el ends here 567;;; subr-tests.el ends here