Permalink
Browse files

Merge pull request #177 from tkf/issue-165

Treat buffer-undo-list=t case in ac-expand-string (issue #165)
  • Loading branch information...
Tomohiro Matsuyama
Tomohiro Matsuyama committed Sep 25, 2012
2 parents b95ad86 + e74dde6 commit 644f017380de2b79f5d7410c2a53b856e1e5b826
Showing with 17 additions and 1 deletion.
  1. +4 −1 auto-complete.el
  2. +13 −0 tests/auto-complete-test.el
View
@@ -1148,7 +1148,10 @@ You can not use it in source definition like (prefix . `NAME')."
"Expand `STRING' into the buffer and update `ac-prefix' to `STRING'.
This function records deletion and insertion sequences by `undo-boundary'.
If `remove-undo-boundary' is non-nil, this function also removes `undo-boundary'
-that have been made before in this function."
+that have been made before in this function. When `buffer-undo-list' is
+`t', `remove-undo-boundary' has no effect."
+ (when (eq buffer-undo-list t)
+ (setq remove-undo-boundary nil))
(when (not (equal string (buffer-substring ac-point (point))))
(undo-boundary)
;; We can't use primitive-undo since it undoes by
@@ -51,3 +51,16 @@
(should (popup-live-p ac-menu))
(should (equal (popup-list ac-menu) '("FooBar")))
)))
+
+(ert-deftest ac-test-complete-common-part-when-buffer-undo-list-is-t ()
+ (ac-test-with-common-setup
+ (let ((ac-source-test
+ '((candidates list "Foo" "FooBar" "Bar" "Baz" "LongLongLine")))
+ (ac-sources '(ac-source-test)))
+ (execute-kbd-macro "Fo")
+ (let ((last-command this-command)
+ (buffer-undo-list t))
+ (auto-complete))
+ (ac-stop)
+ (should (string= (buffer-string) "Foo"))
+ )))

0 comments on commit 644f017

Please sign in to comment.