]> code.delx.au - gnu-emacs-elpa/commitdiff
company-capf: Use base-size returned by completion-all-completions
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 15 Jan 2014 01:01:06 +0000 (03:01 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 15 Jan 2014 01:01:06 +0000 (03:01 +0200)
Thanks to Stefan for the tip

company-capf.el

index 21b9214614a55c7ca4bf2fcbff4e1813e3222805..2fcfbfb218125966611f0337194ff83a363d14a9 100644 (file)
@@ -57,15 +57,15 @@ 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 (completion-all-completions arg table pred (length arg)))
-                (last (last candidates 1)))
-           (when (numberp (cdr last))
+                (last (last candidates))
+                (base-size (and (numberp (cdr last)) (cdr last))))
+           (when base-size
              (setcdr last nil))
            (when sortfun
              (setq candidates (funcall sortfun candidates)))
-           (if (not (zerop (car boundaries)))
-               (let ((before (substring arg 0 (car boundaries))))
+           (if (not (zerop (or base-size 0)))
+               (let ((before (substring arg 0 base-size)))
                  (mapcar (lambda (candidate)
                            (concat before candidate))
                          candidates))