]> code.delx.au - gnu-emacs/blobdiff - test/automated/simple-test.el
Fix undo boundary in recursive edit (Bug#23632)
[gnu-emacs] / test / automated / simple-test.el
index 12ebc75ea9284a824274eb13010a8e103363d613..40cd1d29498f95d4fcbacd4ded021bb18c48dfb1 100644 (file)
    (= 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