This list is maintained by `undo-auto--undoable-change' and
`undo-auto--boundaries' and can be affected by changes to their
-default values.
-
-See also `undo-auto--buffer-undoably-changed'.")
+default values.")
(defun undo-auto--add-boundary ()
"Add an `undo-boundary' in appropriate buffers."
specbind (Qinhibit_redisplay, Qnil);
redisplaying_p = 0;
+ /* This variable stores buffers that have changed so that an undo
+ boundary can be added. specbind this so that changes in the
+ recursive edit will not result in undo boundaries in buffers
+ changed before we entered there recursive edit.
+ See Bug #23632.
+ */
+ specbind (Qundo_auto__undoably_changed_buffers, Qnil);
+
val = command_loop ();
if (EQ (val, Qt))
Fsignal (Qquit, Qnil);
DEFSYM (Qpost_command_hook, "post-command-hook");
DEFSYM (Qundo_auto__add_boundary, "undo-auto--add-boundary");
+ DEFSYM (Qundo_auto__undoably_changed_buffers,
+ "undo-auto--undoably-changed-buffers");
DEFSYM (Qdeferred_action_function, "deferred-action-function");
DEFSYM (Qdelayed_warnings_hook, "delayed-warnings-hook");
(= 6
(undo-test-point-after-forward-kill))))
+(defmacro simple-test-undo-with-switched-buffer (buffer &rest body)
+ (let ((before-buffer (make-symbol "before-buffer")))
+ `(let ((,before-buffer (current-buffer)))
+ (unwind-protect
+ (progn
+ (switch-to-buffer ,buffer)
+ ,@body)
+ (switch-to-buffer ,before-buffer)))))
+
+;; This tests for a regression in emacs 25.0 see bug #23632
+(ert-deftest simple-test-undo-extra-boundary-in-tex ()
+ (should
+ (string=
+ ""
+ (simple-test-undo-with-switched-buffer
+ "temp.tex"
+ (latex-mode)
+ ;; This macro calls `latex-insert-block'
+ (execute-kbd-macro
+ (read-kbd-macro
+ "
+C-c C-o ;; latex-insert-block
+RET ;; newline
+C-/ ;; undo
+"
+ ))
+ (buffer-substring-no-properties
+ (point-min)
+ (point-max))))))
+
+
+
(provide 'simple-test)
;;; simple-test.el ends here