[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company d6df27f 17/46: Rename auto-complete to auto-com
From: |
Dmitry Gutov |
Subject: |
[elpa] externals/company d6df27f 17/46: Rename auto-complete to auto-commit |
Date: |
Wed, 30 Dec 2020 18:33:05 -0500 (EST) |
branch: externals/company
commit d6df27f1652ae56178ce64b9c1022ec90c850e1a
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Rename auto-complete to auto-commit
#1005
---
NEWS.md | 2 ++
company.el | 69 ++++++++++++++++++++++++++++++------------------------
test/core-tests.el | 20 ++++++++--------
3 files changed, 50 insertions(+), 41 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index dd7276a..d93c873 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
## Next
+* `company-auto-complete` and `company-auto-complete-chars` have been renamed
to
+ `company-auto-commit` and `company-auto-commit-chars` respectively.
* `company-clang` filters out duplicates
([#841](https://github.com/company-mode/company-mode/issues/841)).
* New user option `company-tooltip-width-grow-only`.
diff --git a/company.el b/company.el
index a43eb32..401a6a2 100644
--- a/company.el
+++ b/company.el
@@ -548,34 +548,45 @@ prefix it was started from."
This can be a function do determine if a match is required.
This can be overridden by the backend, if it returns t or `never' to
-`require-match'. `company-auto-complete' also takes precedence over this."
+`require-match'. `company-auto-commit' also takes precedence over this."
:type '(choice (const :tag "Off" nil)
(function :tag "Predicate function")
(const :tag "On, if user interaction took place"
'company-explicit-action-p)
(const :tag "On" t)))
-(defcustom company-auto-complete nil
- "Determines when to auto-complete.
-If this is enabled, all characters from `company-auto-complete-chars'
+(define-obsolete-variable-alias
+ 'company-auto-complete
+ 'company-auto-commit
+ "0.9.14")
+
+(defcustom company-auto-commit nil
+ "Determines whether to auto-commit.
+If this is enabled, all characters from `company-auto-commit-chars'
trigger insertion of the selected completion candidate.
This can also be a function."
:type '(choice (const :tag "Off" nil)
(function :tag "Predicate function")
(const :tag "On, if user interaction took place"
'company-explicit-action-p)
- (const :tag "On" t)))
+ (const :tag "On" t))
+ :package-version '(company . "0.9.14"))
+
+(define-obsolete-variable-alias
+ 'company-auto-complete-chars
+ 'company-auto-commit-chars
+ "0.9.14")
-(defcustom company-auto-complete-chars '(?\ ?\) ?.)
- "Determines which characters trigger auto-completion.
-See `company-auto-complete'. If this is a string, each string character
-triggers auto-completion. If it is a list of syntax description characters
(see
-`modify-syntax-entry'), all characters with that syntax auto-complete.
+(defcustom company-auto-commit-chars '(?\ ?\) ?.)
+ "Determines which characters trigger auto-commit.
+See `company-auto-commit'. If this is a string, each character in it
+triggers auto-commit. If it is a list of syntax description characters (see
+`modify-syntax-entry'), characters with any of those syntaxes do that.
This can also be a function, which is called with the new input and should
-return non-nil if company should auto-complete.
+return non-nil if company should auto-commit.
-A character that is part of a valid candidate never triggers auto-completion."
+A character that is part of a valid completion never triggers auto-commit."
:type '(choice (string :tag "Characters")
(set :tag "Syntax"
(const :tag "Whitespace" ?\ )
@@ -592,7 +603,8 @@ A character that is part of a valid candidate never
triggers auto-completion."
(const :tag "Character-quote." ?/)
(const :tag "Generic string fence." ?|)
(const :tag "Generic comment fence." ?!))
- (function :tag "Predicate function")))
+ (function :tag "Predicate function"))
+ :package-version '(company . "0.9.14"))
(defcustom company-idle-delay .5
"The idle delay in seconds until completion starts automatically.
@@ -1105,10 +1117,6 @@ matches IDLE-BEGIN-AFTER-RE, return it wrapped in a
cons."
(defvar-local company--manual-prefix nil)
-(defvar company--auto-completion nil
- "Non-nil when current candidate is being inserted automatically.
-Controlled by `company-auto-complete'.")
-
(defvar-local company--point-max nil)
(defvar-local company-point nil)
@@ -1509,18 +1517,18 @@ prefix match (same case) will be prioritized."
(funcall company-require-match)
(eq company-require-match t))))))
-(defun company-auto-complete-p (input)
- "Return non-nil if INPUT should trigger auto-completion."
- (and (if (functionp company-auto-complete)
- (funcall company-auto-complete)
- company-auto-complete)
- (if (functionp company-auto-complete-chars)
- (funcall company-auto-complete-chars input)
- (if (consp company-auto-complete-chars)
+(defun company-auto-commit-p (input)
+ "Return non-nil if INPUT should trigger auto-commit."
+ (and (if (functionp company-auto-commit)
+ (funcall company-auto-commit)
+ company-auto-commit)
+ (if (functionp company-auto-commit-chars)
+ (funcall company-auto-commit-chars input)
+ (if (consp company-auto-commit-chars)
(memq (char-syntax (string-to-char input))
- company-auto-complete-chars)
+ company-auto-commit-chars)
(string-match (regexp-quote (substring input 0 1))
- company-auto-complete-chars)))))
+ company-auto-commit-chars)))))
(defun company--incremental-p ()
(and (> (point) company-point)
@@ -1584,12 +1592,11 @@ prefix match (same case) will be prioritized."
(company-update-candidates c)
c)
((and (characterp last-command-event)
- (company-auto-complete-p (string last-command-event)))
- ;; auto-complete
+ (company-auto-commit-p (string last-command-event)))
+ ;; auto-commit
(save-excursion
(goto-char company-point)
- (let ((company--auto-completion t))
- (company-complete-selection))
+ (company-complete-selection)
nil))
((not (company--incremental-p))
(company-cancel))
diff --git a/test/core-tests.el b/test/core-tests.el
index d7f0103..a958f5f 100644
--- a/test/core-tests.el
+++ b/test/core-tests.el
@@ -258,7 +258,7 @@
(insert "ab")
(company-mode)
(let (company-frontends
- company-auto-complete
+ company-auto-commit
(company-require-match t)
(company-backends
(list (lambda (command &optional _)
@@ -358,13 +358,13 @@
(should (string= "a" (buffer-string)))
(should (null company-candidates)))))
-(ert-deftest company-auto-complete-explicit ()
+(ert-deftest company-auto-commit-explicit ()
(with-temp-buffer
(insert "ab")
(company-mode)
(let (company-frontends
- (company-auto-complete 'company-explicit-action-p)
- (company-auto-complete-chars '(? ))
+ (company-auto-commit 'company-explicit-action-p)
+ (company-auto-commit-chars '(? ))
(company-backends
(list (lambda (command &optional _)
(cl-case command
@@ -376,14 +376,14 @@
(company-call 'self-insert-command 1))
(should (string= "abcd " (buffer-string))))))
-(ert-deftest company-auto-complete-with-electric-pair ()
+(ert-deftest company-auto-commit-with-electric-pair ()
(with-temp-buffer
(insert "foo(ab)")
(forward-char -1)
(company-mode)
(let (company-frontends
- (company-auto-complete t)
- (company-auto-complete-chars '(? ?\)))
+ (company-auto-commit t)
+ (company-auto-commit-chars '(? ?\)))
(company-backends
(list (lambda (command &optional _)
(cl-case command
@@ -401,13 +401,13 @@
(electric-pair-mode -1)))
(should (string= "foo(abcd)" (buffer-string))))))
-(ert-deftest company-no-auto-complete-when-idle ()
+(ert-deftest company-no-auto-commit-when-idle ()
(with-temp-buffer
(insert "ab")
(company-mode)
(let (company-frontends
- (company-auto-complete 'company-explicit-action-p)
- (company-auto-complete-chars '(? ))
+ (company-auto-commit 'company-explicit-action-p)
+ (company-auto-commit-chars '(? ))
(company-minimum-prefix-length 2)
(company-backends
(list (lambda (command &optional _)
- [elpa] externals/company 9e153fa 12/46: Restore Emacs < 26 compatibility, (continued)
- [elpa] externals/company 9e153fa 12/46: Restore Emacs < 26 compatibility, Dmitry Gutov, 2020/12/30
- [elpa] externals/company e393785 13/46: Add a FIXME, Dmitry Gutov, 2020/12/30
- [elpa] externals/company ca231bf 04/46: Remove company-eclim, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 10d7ee5 06/46: Remove company-xcode, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 57a6554 11/46: company-clang--parse-output: Filter out duplicates, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 520978c 02/46: Change the replacement character for non-printables, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 1b985d1 03/46: Set project-vc-merge-submodules to nil [ci skip], Dmitry Gutov, 2020/12/30
- [elpa] externals/company 664dd19 05/46: Move company-clang to after company-capf, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 54f60ef 14/46: Print the right buffer-local value, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 63b0535 15/46: Fixed badge url., Dmitry Gutov, 2020/12/30
- [elpa] externals/company d6df27f 17/46: Rename auto-complete to auto-commit,
Dmitry Gutov <=
- [elpa] externals/company 805637c 24/46: company-cmake: property completion candidates, Dmitry Gutov, 2020/12/30
- [elpa] externals/company c1e8972 18/46: company-selection: add company-selection-default to have better support for non-selection popup, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 25f6a27 26/46: company-echo-format: Handle company-common being nil, Dmitry Gutov, 2020/12/30
- [elpa] externals/company bbff400 27/46: Fix tooltip background stretching to EOL, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 8c22b58 28/46: Merge pull request #1020 from hlissner/fix-tooltip-bg, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 5f5949b 33/46: Merge pull request #1024 from hlissner/fix-face-helper, Dmitry Gutov, 2020/12/30
- [elpa] externals/company dd92593 35/46: Merge pull request #1032 from kiennq/bug/company-selection-offset, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 97cfbc3 37/46: Merge pull request #1033 from edwargix/master, Dmitry Gutov, 2020/12/30
- [elpa] externals/company e1726c4 22/46: Typo, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 4462e7d 16/46: Merge pull request #1004 from jcs-PR/fix-badge, Dmitry Gutov, 2020/12/30