[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 02/14: Don't `company-cancel' twice
From: |
Dmitry Gutov |
Subject: |
[elpa] 02/14: Don't `company-cancel' twice |
Date: |
Tue, 18 Feb 2014 05:51:01 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 743e3faba1b01ebc011f08da7d01290954fc60fc
Author: Dmitry Gutov <address@hidden>
Date: Sat Feb 8 22:19:15 2014 +0200
Don't `company-cancel' twice
---
company.el | 67 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/company.el b/company.el
index 0b7ab89..9460e62 100644
--- a/company.el
+++ b/company.el
@@ -1087,26 +1087,25 @@ Keywords and function definition names are ignored."
company-prefix)))
(defun company--continue-failed ()
- (when (company--incremental-p)
- (let ((input (buffer-substring-no-properties (point) company-point)))
- (cond
- ((company-auto-complete-p input)
- ;; auto-complete
- (save-excursion
- (goto-char company-point)
- (let ((company--auto-completion t))
- (company-complete-selection))
- nil))
- ((company-require-match-p)
- ;; wrong incremental input, but required match
- (delete-char (- (length input)))
- (ding)
- (message "Matching input is required")
- company-candidates)
- ((equal company-prefix (car company-candidates))
- ;; last input was actually success
- (company-cancel company-prefix)
- nil)))))
+ (let ((input (buffer-substring-no-properties (point) company-point)))
+ (cond
+ ((company-auto-complete-p input)
+ ;; auto-complete
+ (save-excursion
+ (goto-char company-point)
+ (let ((company--auto-completion t))
+ (company-complete-selection))
+ nil))
+ ((company-require-match-p)
+ ;; wrong incremental input, but required match
+ (delete-char (- (length input)))
+ (ding)
+ (message "Matching input is required")
+ company-candidates)
+ ((equal company-prefix (car company-candidates))
+ ;; last input was actually success
+ (company-cancel company-prefix))
+ (t (company-cancel)))))
(defun company--good-prefix-p (prefix)
(and (or (company-explicit-action-p)
@@ -1127,18 +1126,18 @@ Keywords and function definition names are ignored."
(- company-point (length company-prefix))))
(setq new-prefix (or (car-safe new-prefix) new-prefix))
(company-calculate-candidates new-prefix))))
- (or (cond
- ((eq c t)
- ;; t means complete/unique.
- (company-cancel new-prefix)
- nil)
- ((consp c)
- ;; incremental match
- (setq company-prefix new-prefix)
- (company-update-candidates c)
- c)
- (t (company--continue-failed)))
- (company-cancel))))
+ (cond
+ ((eq c t)
+ ;; t means complete/unique.
+ (company-cancel new-prefix))
+ ((consp c)
+ ;; incremental match
+ (setq company-prefix new-prefix)
+ (company-update-candidates c)
+ c)
+ ((not (company--incremental-p))
+ (company-cancel))
+ (t (company--continue-failed)))))
(defun company--begin-new ()
(let (prefix c)
@@ -1222,7 +1221,9 @@ Keywords and function definition names are ignored."
(cancel-timer company-timer))
(company-search-mode 0)
(company-call-frontends 'hide)
- (company-enable-overriding-keymap nil))
+ (company-enable-overriding-keymap nil)
+ ;; Make return value explicit.
+ nil)
(defun company-abort ()
(interactive)
- [elpa] branch master updated (2e6b4f6 -> cae1efc), Dmitry Gutov, 2014/02/18
- [elpa] 04/14: Fix scrolling up from the last item, Dmitry Gutov, 2014/02/18
- [elpa] 06/14: Introduce company-dabbrev-downcase, Dmitry Gutov, 2014/02/18
- [elpa] 01/14: Set company-added-newline to t if the buffer was modified, Dmitry Gutov, 2014/02/18
- [elpa] 02/14: Don't `company-cancel' twice,
Dmitry Gutov <=
- [elpa] 05/14: Fix out-of-bounds error on truncated anno fontification, Dmitry Gutov, 2014/02/18
- [elpa] 07/14: company-capf: fix when company-point is nil, Dmitry Gutov, 2014/02/18
- [elpa] 03/14: New user option, company-continue-commands, Dmitry Gutov, 2014/02/18
- [elpa] 08/14: company--capf-data: Check that the cdr is cons, not data itself, Dmitry Gutov, 2014/02/18
- [elpa] 09/14: company-capf common-part: look up font-lock-face, Dmitry Gutov, 2014/02/18
- [elpa] 10/14: company-capf: cache the capf data, Dmitry Gutov, 2014/02/18
- [elpa] 14/14: Merge commit '119822078ee3024c2d27017d45ef4578fa36040f' from company, Dmitry Gutov, 2014/02/18
- [elpa] 12/14: company-continue-commands: change the default value, Dmitry Gutov, 2014/02/18
- [elpa] 13/14: Bump the version, Dmitry Gutov, 2014/02/18
- [elpa] 11/14: common-part: rename to `match' and document, Dmitry Gutov, 2014/02/18