From 8ac0e7afb90c6f50b6849c0d92ff394c42b94c90 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 4 Sep 2022 23:11:27 +0300 Subject: [PATCH] ENHANCED: also complete predicate names from xref --- sweep.el | 2 +- sweep.pl | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sweep.el b/sweep.el index b522dd1..d081839 100644 --- a/sweep.el +++ b/sweep.el @@ -199,7 +199,7 @@ (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) diff --git a/sweep.pl b/sweep.pl index c24bae8..a856240 100644 --- 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]), -- 2.39.2