]> code.delx.au - gnu-emacs-elpa/commitdiff
Turn :company-prefix-length property into a value
authorFredrik Bergroth <fbergroth@gmail.com>
Wed, 20 Jan 2016 20:05:43 +0000 (21:05 +0100)
committerFredrik Bergroth <fbergroth@gmail.com>
Wed, 20 Jan 2016 20:23:18 +0000 (21:23 +0100)
NEWS.md
company-capf.el

diff --git a/NEWS.md b/NEWS.md
index 33750f119d58e4091a79d103d9af03dbb162efea..87ea896fd53c0b488a4878fd71e1854e0b7c3f4f 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,7 +5,7 @@
 * `company-semantic-insert-arguments`: New option. Like in `company-clang`.
 * `company-semantic-begin-after-member-access`: New option. Similar to the one
   in `company-clang`.
-* `company-capf` accepts `:company-prefix-length` property function.
+* `company-capf` accepts `:company-prefix-length` property value.
 * New face `company-tooltip-annotation-selection`, used for the annotation in
   the selected tooltip line.
 * `company-clang-objc-templatify` has been renamed to
index 6554782d1de48014e282d5866891b44836578938..9eeb2482a0a4d075c2175cecab7656e72b25e1d0 100644 (file)
     (`prefix
      (let ((res (company--capf-data)))
        (when res
-         (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))))
+         (let ((length (plist-get (nthcdr 4 res) :company-prefix-length))
+               (prefix (buffer-substring-no-properties (nth 1 res) (point))))
            (cond
-            ((> end (point)) 'stop)
+            ((> (nth 2 res) (point)) 'stop)
             (length (cons prefix length))
             (t prefix))))))
     (`candidates