]> code.delx.au - gnu-emacs-elpa/commitdiff
company-capf: Perform sorting before prefix adjustment
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 6 Jan 2014 03:53:07 +0000 (07:53 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 6 Jan 2014 03:53:07 +0000 (07:53 +0400)
company-capf.el

index ee2ac1e3caf1616c99649dd84915a569baa7062d..6dcd87b95dacf70f23465ff0e75cb756f223bb18 100644 (file)
@@ -54,13 +54,14 @@ Requires Emacs 24.1 or newer."
                 (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)))))
+           (when sortfun
+             (setq candidates (funcall sortfun candidates)))
+           (if (not (zerop (car boundaries)))
+               (let ((before (substring arg 0 (car boundaries))))
+                 (mapcar (lambda (candidate)
+                           (concat before candidate))
+                         candidates))
+             candidates)))))
     (`sorted
      (let ((res (company--capf-data)))
        (when res