]> code.delx.au - gnu-emacs-elpa/commitdiff
company-manual-begin: Clear `explicit-action` when no candidates
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 1 Apr 2013 05:04:45 +0000 (09:04 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 1 Apr 2013 05:04:45 +0000 (09:04 +0400)
NEWS.md
company-tests.el
company.el

diff --git a/NEWS.md b/NEWS.md
index 4a46891c344d8402da991e3d0b97a6093b300b5c..b6000b72f787057d76fa76b12089dec7cf07f481 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,6 @@
 # History of user-visible changes
 
-## Next
+## 2013-04-01 (0.6.6)
 
 * `company-elisp` doesn't offer completions when typing the name and the
   arguments of a new function or macro definition, allowing to fall back to
index 811e4cc2e8165ad15d2d4b7f552411bc1c30f2c1..33437d8505a7209e6682da8a35924c5dac7f95c2 100644 (file)
         (company-call 'self-insert-command 1))
       (should (string= "ab " (buffer-string))))))
 
+(ert-deftest company-clears-explicit-action-when-no-matches ()
+  (with-temp-buffer
+    (company-mode)
+    (let (company-frontends
+          company-backends)
+      (company-call 'manual-begin) ;; fails
+      (should (null company-candidates))
+      (should (null (company-explicit-action-p))))))
+
 (ert-deftest company-pseudo-tooltip-does-not-get-displaced ()
   (with-temp-buffer
     (save-window-excursion
index 35b07809f64c642eb3173e7c14d78e8d6512036e..13c61eecfffc4f79667cc479fe4a0ce6845afa21 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Author: Nikolaj Schumacher
 ;; Maintainer: Dmitry Gutov <dgutov@yandex.ru>
-;; Version: 0.6.5
+;; Version: 0.6.6
 ;; Keywords: abbrev, convenience, matching
 ;; URL: http://company-mode.github.com/
 ;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x, GNU Emacs 24.x
@@ -895,7 +895,10 @@ can retrieve meta-data for them."
 (defun company-manual-begin ()
   (interactive)
   (setq company--explicit-action t)
-  (company-auto-begin))
+  (unwind-protect
+      (company-auto-begin)
+    (unless company-candidates
+      (setq company--explicit-action nil))))
 
 (defun company-other-backend (&optional backward)
   (interactive (list current-prefix-arg))