branch: externals/cape
commit 0a490abfbf89a24ceb148bdb8afbbd8823a2a201
Author: JD Smith <93749+jdtsm...@users.noreply.github.com>
Commit: GitHub <nore...@github.com>

    Combine predicates for super-capf test/try-completion (#40)
---
 cape.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cape.el b/cape.el
index 50641d49f0..29e65f1775 100644
--- a/cape.el
+++ b/cape.el
@@ -560,8 +560,14 @@ If INTERACTIVE is nil the function acts like a Capf."
                    (copy-sequence cache-candidates))
                   (_
                    (completion--some
-                    (pcase-lambda (`(,table . ,_plist))
-                      (complete-with-action action table str pred))
+                    (pcase-lambda (`(,table . ,plist))
+                     (let* ((pr (plist-get plist :predicate))
+                            (pred (if pr
+                                      (if pred (lambda (x) ; satisfy both
+                                                 (and (funcall pred x) 
(funcall pr x)))
+                                        pr)
+                                    pred)))
+                       (complete-with-action action table str pred)))
                     tables))))
               :exclusive 'no
               :company-prefix-length prefix-len

Reply via email to