branch: master
commit ae9dd22452f75522bbcd778143b4baf8853875ce
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>
Make fixes after Dmitry's comments
* company-capf.el (company-capf): Capitalize and punctuate comment.
(company-capf): Only care about 'face text property.
* test/capf-tests.el: Fix copyright years. Fix top-level comment.
---
company-capf.el | 11 +++++------
test/capf-tests.el | 9 +++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/company-capf.el b/company-capf.el
index 52716a3..7e76dfc 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -88,8 +88,8 @@
(let* ((table (nth 3 res))
(pred (plist-get (nthcdr 4 res) :predicate))
(meta (completion-metadata
- (buffer-substring (nth 1 res) (nth 2 res))
- table pred))
+ (buffer-substring (nth 1 res) (nth 2 res))
+ table pred))
(sortfun (cdr (assq 'display-sort-function meta)))
(candidates (completion-all-completions arg table pred (length
arg)))
(last (last candidates))
@@ -112,8 +112,8 @@
(nth 3 res) (plist-get (nthcdr 4 res) :predicate))))
(cdr (assq 'display-sort-function meta))))))
(`match
- ;; ask the for the `:company-match' function. If that doesn't help,
- ;; fallback to sniffing for face changes to get a suitable value
+ ;; Ask the for the `:company-match' function. If that doesn't help,
+ ;; fallback to sniffing for face changes to get a suitable value.
(let ((f (plist-get (nthcdr 4 (company--capf-data)) :company-match)))
(if f (funcall f arg)
(let* ((match-start nil) (pos -1)
@@ -123,8 +123,7 @@
(while (< pos limit)
(setq pos
(if (< pos 0) 0 (next-property-change pos arg limit)))
- (setq prop-value (or (get-text-property pos 'face arg)
- (get-text-property pos 'font-lock-face arg))
+ (setq prop-value (get-text-property pos 'font-lock-face arg)
faces (if (listp prop-value) prop-value (list prop-value))
has-face-p (memq 'completions-common-part faces))
(cond ((and (not match-start) has-face-p)
diff --git a/test/capf-tests.el b/test/capf-tests.el
index 29965b2..b70131c 100644
--- a/test/capf-tests.el
+++ b/test/capf-tests.el
@@ -1,6 +1,6 @@
;;; capf-tests.el --- company tests for the company-capf backend -*-
lexical-binding: t; -*-
-;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Author: João Távora <[email protected]>
;; Keywords:
@@ -55,9 +55,10 @@
(should company-candidates)
(should (member "with-current-buffer" company-candidates))))
-;; Re. "perfect" highliting of the non-prefix in company-capf matches, it is
-;; only working in recent Emacsen containing this commit. The two following
-;; tests reflect that.
+;; Re. "perfect" highlighting of the non-prefix in company-capf matches, it is
+;; only working-out-of-the box (i.e. without the `:company-match' meta) in
+;; recent Emacsen containing the following commit. The two tests that follow
+;; reflect that.
;;
;; commit 325ef57b0e3977f9509f1049c826999e8b7c226d
;; Author: Stefan Monnier <[email protected]>