From debb87fa0cdbfacb67d9a31bedd78a3aa79e824b Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 15 Jan 2014 03:01:06 +0200 Subject: [PATCH] company-capf: Use base-size returned by completion-all-completions Thanks to Stefan for the tip --- company-capf.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/company-capf.el b/company-capf.el index 21b921461..2fcfbfb21 100644 --- a/company-capf.el +++ b/company-capf.el @@ -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)) -- 2.39.2