[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 0a6bfa9 108/173: company-capf: Add :company-prefix-length
From: |
Dmitry Gutov |
Subject: |
[elpa] master 0a6bfa9 108/173: company-capf: Add :company-prefix-length property function |
Date: |
Thu, 23 Jun 2016 00:28:43 +0000 (UTC) |
branch: master
commit 0a6bfa96e02140c76cd80219444ac1b9d42ea197
Author: Fredrik Bergroth <address@hidden>
Commit: Fredrik Bergroth <address@hidden>
company-capf: Add :company-prefix-length property 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 5565541 126/173: Option to have tempo expand tags after completion., (continued)
- [elpa] master 5565541 126/173: Option to have tempo expand tags after completion., Dmitry Gutov, 2016/06/22
- [elpa] master ec9f6c7 127/173: Moved company-tempo-insert call to post-completion, Dmitry Gutov, 2016/06/22
- [elpa] master bdf6b22 138/173: Fix #474 by filtering dabbrev completions at the end, Dmitry Gutov, 2016/06/22
- [elpa] master e65ab4c 111/173: Merge pull request #453 from jtatarik/bbdb-multiple-recipients, Dmitry Gutov, 2016/06/22
- [elpa] master 077182c 154/173: Add autoload cookies, Dmitry Gutov, 2016/06/22
- [elpa] master a619a93 132/173: Merge pull request #465 from vspinu/files-optim, Dmitry Gutov, 2016/06/22
- [elpa] master e357eb6 164/173: Remove the [return] binding (#530), Dmitry Gutov, 2016/06/22
- [elpa] master b8f8777 161/173: New transformer: company-sort-prefer-same-case-prefix, Dmitry Gutov, 2016/06/22
- [elpa] master 8cc284e 162/173: Merge pull request #531 from juergenhoetzel/master, Dmitry Gutov, 2016/06/22
- [elpa] master 387b4d1 106/173: Fix "obsolete function" warning, Dmitry Gutov, 2016/06/22
- [elpa] master 0a6bfa9 108/173: company-capf: Add :company-prefix-length property function,
Dmitry Gutov <=
- [elpa] master 1f5389b 146/173: Merge pull request #483 from stardiviner/add-julia-keywords, Dmitry Gutov, 2016/06/22
- [elpa] master 6c8763a 151/173: Fixed lighter for grouped backends, Dmitry Gutov, 2016/06/22
- [elpa] master 7d0db9e 135/173: Move company-files closer to the front of company-backends, Dmitry Gutov, 2016/06/22
- [elpa] master b001e91 099/173: Fix a test (after adding `should`), Dmitry Gutov, 2016/06/22
- [elpa] master 779de03 117/173: Merge pull request #457 from cpitclaudel/wip-simplify-electric, Dmitry Gutov, 2016/06/22
- [elpa] master faa8f84 120/173: Add company-semantic-insert-arguments, Dmitry Gutov, 2016/06/22
- [elpa] master c357d5a 144/173: company-grab-line: Make it work in ERC prompt, Dmitry Gutov, 2016/06/22
- [elpa] master a53911c 130/173: Separate sort of candidates and children in company-files, Dmitry Gutov, 2016/06/22
- [elpa] master 99ce60b 125/173: Add company-search-flex-regexp, Dmitry Gutov, 2016/06/22
- [elpa] master ada2ede 128/173: Merge pull request #461 from rlph/patch-1, Dmitry Gutov, 2016/06/22