[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 66eeaaa: * lisp/subr.el (activate-change-group): Fix bug#33341
From: |
Stefan Monnier |
Subject: |
master 66eeaaa: * lisp/subr.el (activate-change-group): Fix bug#33341 |
Date: |
Fri, 27 Nov 2020 09:44:03 -0500 (EST) |
branch: master
commit 66eeaaa48858572d47ff3b0b177d5b765df93418
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* lisp/subr.el (activate-change-group): Fix bug#33341
---
lisp/subr.el | 5 ++++-
test/lisp/subr-tests.el | 12 ++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/lisp/subr.el b/lisp/subr.el
index e009dcc..1cf3a49 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3036,7 +3036,10 @@ to `accept-change-group' or `cancel-change-group'."
(dolist (elt handle)
(with-current-buffer (car elt)
(if (eq buffer-undo-list t)
- (setq buffer-undo-list nil)))))
+ (setq buffer-undo-list nil)
+ ;; Add a boundary to make sure the upcoming changes won't be
+ ;; merged with any previous changes (bug#33341).
+ (undo-boundary)))))
(defun accept-change-group (handle)
"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 67f7fc9..e3f798d 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."
(should (equal (replace-regexp-in-string "\\`\\|x" "z" "--xx--")
"z--zz--")))
+(ert-deftest subr-tests--change-group-33341 ()
+ (with-temp-buffer
+ (buffer-enable-undo)
+ (insert "0\n")
+ ;; (undo-boundary)
+ (let ((g (prepare-change-group)))
+ (activate-change-group g)
+ (insert "b\n")
+ (insert "c\n")
+ (cancel-change-group g))
+ (should (equal (buffer-string) "0\n"))))
+
(provide 'subr-tests)
;;; subr-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 66eeaaa: * lisp/subr.el (activate-change-group): Fix bug#33341,
Stefan Monnier <=