aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhillip Lord2015-11-19 15:57:55 +0000
committerPhillip Lord2015-11-26 17:57:11 +0000
commit7592cb9d2a5d68dcb556c87226e38588ce555bd9 (patch)
treed845f1a53b432956e3c1711b586d938aac50996a /test
parent02cd9cb8afd9510e3bdb20ce7148d1b9a6aa9d12 (diff)
downloademacs-7592cb9d2a5d68dcb556c87226e38588ce555bd9.tar.gz
emacs-7592cb9d2a5d68dcb556c87226e38588ce555bd9.zip
After delete, record point location in undo.
Addresses Bug #21968. * lisp/simple.el (undo-auto--add-boundary): Clean up code to better support intercalating calls. * src/keyboard.c,src/keyboard.h (command_loop_1): Store value of point and current buffer before each command. * src/undo.c (record_point): Now only record the point. * src/undo.c (prepare_record): Functionality removed form record_point. * src/undo.c (record_delete): Check if point needs recording. * src/undo.c (undo-boundary): Record value of point before each boundary. * test/automated/simple-test.el: New tests. Conflicts: src/undo.c
Diffstat (limited to 'test')
-rw-r--r--test/automated/simple-test.el48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/automated/simple-test.el b/test/automated/simple-test.el
index a3931ef9277..c758d7cc8ef 100644
--- a/test/automated/simple-test.el
+++ b/test/automated/simple-test.el
@@ -263,5 +263,53 @@
263 '("(s1) (s4)" . " (s2) (s3) (s5)")))) 263 '("(s1) (s4)" . " (s2) (s3) (s5)"))))
264 264
265 265
266;; Test for a regression introduced by undo-auto--boundaries changes.
267;; https://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01652.html
268(defun undo-test-kill-c-a-then-undo ()
269 (with-temp-buffer
270 (switch-to-buffer (current-buffer))
271 (setq buffer-undo-list nil)
272 (insert "a\nb\n\c\n")
273 (goto-char (point-max))
274 ;; We use a keyboard macro because it adds undo events in the same
275 ;; way as if a user were involved.
276 (kmacro-call-macro nil nil nil
277 [left
278 ;; Delete "c"
279 backspace
280 left left left
281 ;; Delete "a"
282 backspace
283 ;; C-/ or undo
284 67108911
285 ])
286 (point)))
287
288(defun undo-test-point-after-forward-kill ()
289 (with-temp-buffer
290 (switch-to-buffer (current-buffer))
291 (setq buffer-undo-list nil)
292 (insert "kill word forward")
293 ;; Move to word "word".
294 (goto-char 6)
295 (kmacro-call-macro nil nil nil
296 [
297 ;; kill-word
298 C-delete
299 ;; undo
300 67108911
301 ])
302 (point)))
303
304(ert-deftest undo-point-in-wrong-place ()
305 (should
306 ;; returns 5 with the bug
307 (= 2
308 (undo-test-kill-c-a-then-undo)))
309 (should
310 (= 6
311 (undo-test-point-after-forward-kill))))
312
313
266(provide 'simple-test) 314(provide 'simple-test)
267;;; simple-test.el ends here 315;;; simple-test.el ends here