]> git.eshelyaron.com Git - sweep.git/commitdiff
ENHANCED: also complete predicate names from xref
authorEshel Yaron <me@eshelyaron.com>
Sun, 4 Sep 2022 20:11:27 +0000 (23:11 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 4 Sep 2022 20:15:17 +0000 (23:15 +0300)
sweep.el
sweep.pl

index b522dd1c1f5aebe2e7df753fcb336c502bb5eb00..d081839c389cdc3f3e1e01f651f3e37d7e8566db 100644 (file)
--- a/sweep.el
+++ b/sweep.el
               (when (eq sts 'finished)
                 (let ((opoint (point)))
                   (save-match-data
-                    (with-silent-modifications
+                    (combine-after-change-calls
                       (skip-chars-backward "1234567890")
                       (when (= ?/ (preceding-char))
                         (backward-char)
index c24bae8b60569f65e6764664e47bf53bdd715261..a856240e575187d478ef35c8738c6e8cd95bb343 100644 (file)
--- a/sweep.pl
+++ b/sweep.pl
@@ -210,8 +210,16 @@ sweep_local_predicate_completion([Mod|Sub], Preds) :-
     atom_string(M, Mod),
     findall(F/N,
             @(current_predicate(F/N), M),
-            Preds0),
-    convlist(sweep_predicate_completion_annotated(Sub, M), Preds0, Preds).
+            Preds0,
+            Tail),
+    findall(XF/XN,
+            (   xref_defined(SourceId, H, _),
+                H \= _:_,
+                pi_head(XF/XN, H)
+            ),
+            Tail),
+    list_to_set(Preds0, Preds1),
+    convlist(sweep_predicate_completion_annotated(Sub, M), Preds1, Preds).
 
 sweep_predicate_completion_annotated(Sub, M, F/N, [S|A]) :-
     format(string(S), '~W/~w', [F, [quoted(true), character_escapes(true)], N]),