[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 43/52: company--should-idle-begin: use a more careful check
From: |
Dmitry Gutov |
Subject: |
[elpa] 43/52: company--should-idle-begin: use a more careful check |
Date: |
Tue, 01 Jul 2014 11:53:31 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 9056db1f57f931731b041b56921ecc2e3542fae7
Author: Dmitry Gutov <address@hidden>
Date: Wed Jun 25 03:23:46 2014 +0300
company--should-idle-begin: use a more careful check
* Dicussed in #143.
* company--begin-inhibit-commands: new variable.
---
company.el | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/company.el b/company.el
index 973328b..a6d6ab9 100644
--- a/company.el
+++ b/company.el
@@ -548,8 +548,8 @@ immediately when a prefix of
`company-minimum-prefix-length' is reached."
(defcustom company-begin-commands '(self-insert-command
org-self-insert-command)
"A list of commands after which idle completion is allowed.
-If this is t, it can show completions after any command except those in the
-`company-' namespace. See `company-idle-delay'.
+If this is t, it can show completions after any command except a few from a
+pre-defined list. See `company-idle-delay'.
Alternatively, any command with a non-nil `company-begin' property is
treated as if it was on this list."
@@ -1014,10 +1014,6 @@ can retrieve meta-data for them."
(not (keymapp (key-binding (this-command-keys-vector)))))
(not (and transient-mark-mode mark-active))))
-(defsubst company--this-command-p ()
- (and (symbolp this-command)
- (string-match-p "\\`company-" (symbol-name this-command))))
-
(defun company--should-continue ()
(or (eq t company-begin-commands)
(eq t company-continue-commands)
@@ -1025,7 +1021,8 @@ can retrieve meta-data for them."
(not (memq this-command (cdr company-continue-commands)))
(or (memq this-command company-begin-commands)
(memq this-command company-continue-commands)
- (company--this-command-p)))))
+ (and (symbolp this-command)
+ (string-match-p "\\`company-" (symbol-name this-command)))))))
(defun company-call-frontends (command)
(dolist (frontend company-frontends)
@@ -1514,11 +1511,18 @@ from the rest of the back-ends in the group, if any,
will be left at the end."
(company-cancel))))
(company-install-map))
+(defvar company--begin-inhibit-commands '(company-abort
+ company-complete-mouse
+ company-complete
+ company-complete-common
+ company-complete-selection
+ company-complete-number)
+ "List of commands after which idle completion is (still) disabled when
+`company-begin-commands' is t.")
+
(defun company--should-idle-begin ()
(if (eq t company-begin-commands)
- ;; Cheap check against starting after `company-abort',
- ;; `company-complete-selection', etc.
- (not (company--this-command-p))
+ (not (memq this-command company--begin-inhibit-commands))
(or
(memq this-command company-begin-commands)
(and (symbolp this-command) (get this-command 'company-begin)))))
- [elpa] 31/52: company-css-value-classes: fix border-width infloop, (continued)
- [elpa] 31/52: company-css-value-classes: fix border-width infloop, Dmitry Gutov, 2014/07/01
- [elpa] 32/52: company-css-property-values: port to lexical-binding, Dmitry Gutov, 2014/07/01
- [elpa] 33/52: company-css: add a bunch of CSS3 properties, Dmitry Gutov, 2014/07/01
- [elpa] 36/52: company-css-property-alist: remove reference to font-variant in value for font, Dmitry Gutov, 2014/07/01
- [elpa] 34/52: company-gtags: add arguments insertion, Dmitry Gutov, 2014/07/01
- [elpa] 38/52: Indicate current candidate's backend when it's in a group, Dmitry Gutov, 2014/07/01
- [elpa] 39/52: company-update-group-lighter: privatize, Dmitry Gutov, 2014/07/01
- [elpa] 41/52: Improve comment wording, Dmitry Gutov, 2014/07/01
- [elpa] 37/52: company-pseudo-tooltip-edit: update company-width, Dmitry Gutov, 2014/07/01
- [elpa] 44/52: company-keywords-alist: ass js-mode -> javascript-mode alias, Dmitry Gutov, 2014/07/01
- [elpa] 43/52: company--should-idle-begin: use a more careful check,
Dmitry Gutov <=
- [elpa] 42/52: Don't assign to company-point in company-abort and company-finish, Dmitry Gutov, 2014/07/01
- [elpa] 46/52: Never delete the "added newline" twice, Dmitry Gutov, 2014/07/01
- [elpa] 47/52: Don't call post-completion methods and hook in continue-failed case, Dmitry Gutov, 2014/07/01
- [elpa] 45/52: Bring back this-command check when company-idle-delay is t, Dmitry Gutov, 2014/07/01
- [elpa] 40/52: Define company-sort-by-backend-importance, Dmitry Gutov, 2014/07/01
- [elpa] 49/52: company-backends: add better introduction, Dmitry Gutov, 2014/07/01
- [elpa] 48/52: Avoid requiring match is certain circumstances, Dmitry Gutov, 2014/07/01
- [elpa] 35/52: company-css: Add HTML5 tags and more CSS3 properties, Dmitry Gutov, 2014/07/01
- [elpa] 51/52: Release 0.8.1, Dmitry Gutov, 2014/07/01
- [elpa] 52/52: Merge commit '7c14dedc79bf0c6eaad5bf50b80ea80dd721afdc' from company, Dmitry Gutov, 2014/07/01