[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b94b115 025/173: company--insert-candidate: Don't insert a
From: |
Dmitry Gutov |
Subject: |
[elpa] master b94b115 025/173: company--insert-candidate: Don't insert an empty string |
Date: |
Thu, 23 Jun 2016 00:28:35 +0000 (UTC) |
branch: master
commit b94b115651dbe50a8096d0bc1ec9c7ca5e7570d0
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
company--insert-candidate: Don't insert an empty string
Fixes #330
---
company.el | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/company.el b/company.el
index 01e1d04..750850b 100644
--- a/company.el
+++ b/company.el
@@ -994,13 +994,14 @@ Controlled by `company-auto-complete'.")
(substring str (length company-prefix)))
(defun company--insert-candidate (candidate)
- (setq candidate (substring-no-properties candidate))
- ;; XXX: Return value we check here is subject to change.
- (if (eq (company-call-backend 'ignore-case) 'keep-prefix)
- (insert (company-strip-prefix candidate))
- (unless (equal company-prefix candidate)
- (delete-region (- (point) (length company-prefix)) (point))
- (insert candidate))))
+ (when (> (length candidate) 0)
+ (setq candidate (substring-no-properties candidate))
+ ;; XXX: Return value we check here is subject to change.
+ (if (eq (company-call-backend 'ignore-case) 'keep-prefix)
+ (insert (company-strip-prefix candidate))
+ (unless (equal company-prefix candidate)
+ (delete-region (- (point) (length company-prefix)) (point))
+ (insert candidate)))))
(defmacro company-with-candidate-inserted (candidate &rest body)
"Evaluate BODY with CANDIDATE temporarily inserted.
@@ -1922,8 +1923,7 @@ With ARG, move by that many elements."
(if (and (not (cdr company-candidates))
(equal company-common (car company-candidates)))
(company-complete-selection)
- (when company-common
- (company--insert-candidate company-common)))))
+ (company--insert-candidate company-common))))
(defun company-complete-common-or-cycle (&optional arg)
"Insert the common part of all candidates, or select the next one.
- [elpa] master 7941f6e 010/173: company-diag: Include Emacs and Company versions, (continued)
- [elpa] master 7941f6e 010/173: company-diag: Include Emacs and Company versions, Dmitry Gutov, 2016/06/22
- [elpa] master 5733f2b 011/173: company-diag: Fix the annotation call, Dmitry Gutov, 2016/06/22
- [elpa] master af962d4 012/173: company-diag: Call `annotation' in the right buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 5e107fd 015/173: Accept numeric argument in company-select-next and friends, Dmitry Gutov, 2016/06/22
- [elpa] master 479c676 021/173: Don't use `forward-symbol', apparently it's not in 24.3, Dmitry Gutov, 2016/06/22
- [elpa] master 41f4536 018/173: Add missing require to `company-gtags`, Dmitry Gutov, 2016/06/22
- [elpa] master b0f206a 020/173: Handle function pointers in annotation and template expansion, Dmitry Gutov, 2016/06/22
- [elpa] master d56ddaa 006/173: Allow scrolling the doc window with the mouse wheel, Dmitry Gutov, 2016/06/22
- [elpa] master a7a4ba6 014/173: Merge branch 'release', Dmitry Gutov, 2016/06/22
- [elpa] master 464a458 022/173: company-lighter: dispatch on whether company-candidates is non-nil, Dmitry Gutov, 2016/06/22
- [elpa] master b94b115 025/173: company--insert-candidate: Don't insert an empty string,
Dmitry Gutov <=
- [elpa] master decd537 030/173: Add MELPA badge, Dmitry Gutov, 2016/06/22
- [elpa] master 22ecb92 001/173: company-clang--start-process: Disable undo in the output buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 5fe84a2 028/173: Merge pull request #334 from vermiculus/patch-1, Dmitry Gutov, 2016/06/22
- [elpa] master 2de213e 032/173: company-dabbrev--search-buffer: Save match data, Dmitry Gutov, 2016/06/22
- [elpa] master a0ba593 029/173: Drop githalytics link, Dmitry Gutov, 2016/06/22
- [elpa] master 6301093 023/173: Clarify the meaning of cdr in the prefix cons, Dmitry Gutov, 2016/06/22
- [elpa] master 9f67f1e 027/173: Fix docstring, Dmitry Gutov, 2016/06/22
- [elpa] master 17e6d19 016/173: Remove company-pysmell, Dmitry Gutov, 2016/06/22
- [elpa] master 733d4a9 019/173: Merge pull request #318 from iqbalansari/master, Dmitry Gutov, 2016/06/22
- [elpa] master 7ad049d 031/173: Fix the svg url, Dmitry Gutov, 2016/06/22