Permalink
Browse files

Treat buffer-undo-list=t case in ac-expand-string

fixes #165
  • Loading branch information...
tkf committed Sep 22, 2012
1 parent b95ad86 commit e74dde687afeb8e1b80f468cbcf4e5f4a603a676
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 e74dde6

Please sign in to comment.