From fefcae59d66589e81823fe08c0b40a995d9118a4 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 5 Jan 2014 07:16:13 +0400 Subject: [PATCH] Fix http://debbugs.gnu.org/16334 --- NEWS.md | 1 + company-capf.el | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/NEWS.md b/NEWS.md index ff598f7b4..ae1124c24 100644 --- 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) diff --git a/company-capf.el b/company-capf.el index 2d20bee72..ee2ac1e3c 100644 --- a/company-capf.el +++ b/company-capf.el @@ -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))) -- 2.39.2