emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sweeprolog 0406742c33: ENHANCED: faster completion-at-poin


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 0406742c33: ENHANCED: faster completion-at-point for predicates
Date: Sat, 20 May 2023 12:03:35 -0400 (EDT)

branch: elpa/sweeprolog
commit 0406742c335c91cfad4d185d2d68fc981bc5e40f
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    ENHANCED: faster completion-at-point for predicates
    
    Filter predicate completion candidates according to the text near
    point before formatting and computing argument names.  This makes
    completion-at-point for predicates much faster when there are lots of
    known predicates.
    
    * sweeprolog.el (sweeprolog-predicate-completion-at-point): Pass
    (partial) functor at point to...
    * sweep.pl (sweep_predicate_completion_candidates/2): Filter
    predicates based on new Sub argument.
---
 sweep.pl      | 7 ++++---
 sweeprolog.el | 6 ++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/sweep.pl b/sweep.pl
index 71c63feefa..154b50ab1d 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -865,18 +865,19 @@ sweep_atom_collection(Sub, Col) :-
     findall(S,
             (   current_atom(A),
                 atom_string(A, S),
-                sub_string(S, _, _, _, Sub)
+                once(sub_string(S, _, _, _, Sub))
             ),
             Col).
 
-sweep_predicate_completion_candidates(D, Ps) :-
+sweep_predicate_completion_candidates([D|Sub], Ps) :-
     integer(D),
     sweep_current_module(M),
     findall(H,
             (   (   @(predicate_property(H, visible), M)
                 ;   xref_defined(_, H, _)
                 ),
-                pi_head(_/N, H),
+                pi_head(F/N, H),
+                once(sub_atom(F, _, _, _, Sub)),
                 N - D >= 0
             ),
             Hs),
diff --git a/sweeprolog.el b/sweeprolog.el
index 190024112d..e0faa1418d 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -1240,8 +1240,10 @@ resulting list even when found in the current clause."
                  (not (or (sweeprolog--char-uppercase-p first)
                           (= first ?_)))))
       (when-let
-          ((col (sweeprolog--query-once "sweep" 
"sweep_predicate_completion_candidates"
-                                        (sweeprolog-context-callable-p))))
+          ((col (sweeprolog--query-once
+                 "sweep" "sweep_predicate_completion_candidates"
+                 (cons (sweeprolog-context-callable-p)
+                       (buffer-substring-no-properties beg end)))))
         (list beg end col
               :exclusive 'no
               :annotation-function



reply via email to

[Prev in Thread] Current Thread [Next in Thread]