[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 23c6f85 109/173: Merge pull request #450 from fbergroth/ca
From: |
Dmitry Gutov |
Subject: |
[elpa] master 23c6f85 109/173: Merge pull request #450 from fbergroth/capf-prefix-function |
Date: |
Thu, 23 Jun 2016 00:28:43 +0000 (UTC) |
branch: master
commit 23c6f853538c25d2781dcdd651fc2b79f9270e7e
Merge: e477eaf 0a6bfa9
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Merge pull request #450 from fbergroth/capf-prefix-function
company-capf: Allow custom prefix function
---
NEWS.md | 1 +
company-capf.el | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index af75ccb..fab296c 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
## Next
+* `company-capf` accepts `:company-prefix-length` property function.
* New face `company-tooltip-annotation-selection`, used for the annotation in
the selected tooltip line.
* `company-clang-objc-templatify` has been renamed to
diff --git a/company-capf.el b/company-capf.el
index 8e28689..6554782 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -72,9 +72,15 @@
(`prefix
(let ((res (company--capf-data)))
(when res
- (if (> (nth 2 res) (point))
- 'stop
- (buffer-substring-no-properties (nth 1 res) (point))))))
+ (let* ((f (plist-get (nthcdr 4 res) :company-prefix-length))
+ (beg (nth 1 res))
+ (end (nth 2 res))
+ (length (and f (funcall f beg (point))))
+ (prefix (buffer-substring-no-properties beg (point))))
+ (cond
+ ((> end (point)) 'stop)
+ (length (cons prefix length))
+ (t prefix))))))
(`candidates
(let ((res (company--capf-data)))
(when res
- [elpa] master d587bd0 156/173: Fix an old typo, (continued)
- [elpa] master d587bd0 156/173: Fix an old typo, Dmitry Gutov, 2016/06/22
- [elpa] master 2d9bf1e 160/173: company--preprocess-candidates: Check that all CANDIDATES are strings, Dmitry Gutov, 2016/06/22
- [elpa] master 395f846 159/173: Revert "Remove completions without annotations when considering duplicates", Dmitry Gutov, 2016/06/22
- [elpa] master 69228c7 168/173: Tag company-dabbrev-ignore-buffers with package-version, Dmitry Gutov, 2016/06/22
- [elpa] master be2f586 100/173: Add workaround for bug#18067, Dmitry Gutov, 2016/06/22
- [elpa] master df14727 110/173: Fix bbdb completion for multi-recipient messages, Dmitry Gutov, 2016/06/22
- [elpa] master 18a77b9 121/173: Improve the example in the Commentary, Dmitry Gutov, 2016/06/22
- [elpa] master c97828c 142/173: Clarify where callback must be called from, Dmitry Gutov, 2016/06/22
- [elpa] master 4cd4c3a 123/173: Turn :company-prefix-length property into a value, Dmitry Gutov, 2016/06/22
- [elpa] master 18b0414 103/173: Declare python-shell-get-process, Dmitry Gutov, 2016/06/22
- [elpa] master 23c6f85 109/173: Merge pull request #450 from fbergroth/capf-prefix-function,
Dmitry Gutov <=
- [elpa] master 5bfbb05 098/173: Add the pre-render backend command, Dmitry Gutov, 2016/06/22
- [elpa] master 3ec9d5d 145/173: Add Julia keywords, Dmitry Gutov, 2016/06/22
- [elpa] master 900ae0d 096/173: Add support for company-face, Dmitry Gutov, 2016/06/22
- [elpa] master 1221739 122/173: Improve the description of cons prefix, Dmitry Gutov, 2016/06/22
- [elpa] master ac7f816 134/173: Merge pull request #466 from tarsius/patch-1, Dmitry Gutov, 2016/06/22
- [elpa] master 9e844d1 124/173: Merge pull request #459 from fbergroth/prefix-length-var, Dmitry Gutov, 2016/06/22
- [elpa] master 31780fb 114/173: Revert "company-cancel: Call frontends' 'hide before 'post-completion", Dmitry Gutov, 2016/06/22
- [elpa] master a7e4408 152/173: Merge pull request #491 from akirakyle/patch-1, Dmitry Gutov, 2016/06/22
- [elpa] master 2dd1f6a 112/173: company-cancel: Call frontends' 'hide before 'post-completion, Dmitry Gutov, 2016/06/22
- [elpa] master dc4927b 158/173: Allow company-dabbrev-ignore-buffers to be a function, Dmitry Gutov, 2016/06/22