1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Fix problems resulting from modification of the undo list

* doc/lispref/text.texi (Atomic Changes): Describe what not to
do inside an atomic change group.
* lisp/elec-pair.el (electric-pair-inhibit-if-helps-balance):
Don't call `delete-char'; that edits the undo list by removing
boundary markers.
* lisp/subr.el (atomic-change-group, prepare-change-group): Warn
against modifying the undo list inside.
This commit is contained in:
Po Lu 2023-06-06 21:00:44 +08:00
parent 05c2be28a3
commit bf28b019a8
3 changed files with 23 additions and 1 deletions

View file

@ -439,7 +439,9 @@ happened."
;; position some markers. The real fix would be to compute the
;; result without having to modify the buffer at all.
(atomic-change-group
(delete-char -1)
;; Don't use `delete-char'; that may modify the head of the
;; undo list.
(delete-region (point) (1- (point)))
(throw
'done
(cond ((eq ?\( syntax)