[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 a813487: Fix undo boundary in recursive edit (Bug
From: |
Phillip Lord |
Subject: |
[Emacs-diffs] emacs-25 a813487: Fix undo boundary in recursive edit (Bug#23632) |
Date: |
Wed, 8 Jun 2016 21:54:32 +0000 (UTC) |
branch: emacs-25
commit a813487f1adf4cf59d7a471d62d22f706f9eab1d
Author: Phillip Lord <address@hidden>
Commit: Phillip Lord <address@hidden>
Fix undo boundary in recursive edit (Bug#23632)
* src/keyboard.c (recursive_edit_1): specbind
undo-auto--undoably-changed-buffers.
* lisp/simple.el (undo-auto--undoably-changed-buffers):
fix docstring.
---
lisp/simple.el | 4 +---
src/keyboard.c | 10 ++++++++++
test/automated/simple-test.el | 32 ++++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/lisp/simple.el b/lisp/simple.el
index c5aa292..e38bf70 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2910,9 +2910,7 @@ REASON describes the reason that the boundary is being
added; see
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."
diff --git a/src/keyboard.c b/src/keyboard.c
index e3858a5..2db9aaf 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -681,6 +681,14 @@ recursive_edit_1 (void)
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);
@@ -10956,6 +10964,8 @@ syms_of_keyboard (void)
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");
diff --git a/test/automated/simple-test.el b/test/automated/simple-test.el
index 12ebc75..40cd1d2 100644
--- a/test/automated/simple-test.el
+++ b/test/automated/simple-test.el
@@ -310,6 +310,38 @@
(= 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 a813487: Fix undo boundary in recursive edit (Bug#23632),
Phillip Lord <=