]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix http://debbugs.gnu.org/16334
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 5 Jan 2014 03:16:13 +0000 (07:16 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 5 Jan 2014 03:17:25 +0000 (07:17 +0400)
NEWS.md
company-capf.el

diff --git a/NEWS.md b/NEWS.md
index ff598f7b47717fd2c706f57ff66e2b2eb50e7c0e..ae1124c24b9fd896be9fc84620f66334092f1c73 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
 
 ## Next
 
+* `company-capf` supports completion tables that return non-default boundaries.
 * `company-elisp` is enabled in `inferior-emacs-lisp-mode`.
 
 ## 2013-09-28 (0.6.12)
index 2d20bee72b7f75faa7de6d68b24fdc47fcf3b99d..ee2ac1e3caf1616c99649dd84915a569baa7062d 100644 (file)
@@ -52,7 +52,14 @@ Requires Emacs 24.1 or newer."
                       (buffer-substring (nth 1 res) (nth 2 res))
                       table pred))
                 (sortfun (cdr (assq 'display-sort-function meta)))
+                (boundaries (completion-boundaries arg table pred ""))
                 (candidates (all-completions arg table pred)))
+           (unless (zerop (car boundaries))
+             (let ((before (substring arg 0 (car boundaries))))
+               (setq candidates
+                     (mapcar (lambda (candidate)
+                               (concat before candidate))
+                             candidates))))
            (if sortfun (funcall sortfun candidates) candidates)))))
     (`sorted
      (let ((res (company--capf-data)))