From: Eshel Yaron Date: Wed, 30 Nov 2022 18:45:45 +0000 (+0200) Subject: * (sweeprolog-identifier-at-point): reliably qualify local heads X-Git-Tag: V9.0.1~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=280976cd4b2b980d1061efd67fa50f965b6e09ba;p=sweep.git * (sweeprolog-identifier-at-point): reliably qualify local heads --- diff --git a/sweep.pl b/sweep.pl index 1aaa755..360d933 100644 --- a/sweep.pl +++ b/sweep.pl @@ -719,8 +719,9 @@ strip_det(Mode is _, Mode) :- !. strip_det(//(Mode), Mode) :- !. strip_det(Mode, Mode). -sweep_functor_arity_pi([F0,A], PI) :- - !, +sweep_functor_arity_pi([M,F0,A|_], PI) :- + !, atom_string(F, F0), term_string(M:F/A, PI). +sweep_functor_arity_pi([F0,A|Path0], PI) :- atom_string(F, F0), pi_head(F/A, Head), sweep_current_module(M0), @@ -729,11 +730,13 @@ sweep_functor_arity_pi([F0,A], PI) :- -> T = M:F/A ; xref_defined(_, Head, imported(Other)), xref_module(Other, M) -> T = M:F/A + ; string(Path0), + atom_string(Path, Path0), + xref_defined(Path, Head, _) + -> T = M0:F/A ; T = F/A ), term_string(T, PI). -sweep_functor_arity_pi([M,F0,A], PI) :- - atom_string(F, F0), term_string(M:F/A, PI). sweep_current_module(Module) :- sweep_main_thread, diff --git a/sweeprolog.el b/sweeprolog.el index cccd6a3..2f9d929 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -916,7 +916,7 @@ module name, F is a functor name and N is its arity." (when (and id-at-point (not (eq (car id-at-point) 'variable))) (sweeprolog--query-once "sweep" "sweep_functor_arity_pi" - id-at-point)))))) + (append id-at-point (buffer-file-name)))))))) ;;;; Modules