]> git.eshelyaron.com Git - dict.git/commitdiff
* (sweeprolog-identifier-at-point): reliably qualify local heads
authorEshel Yaron <me@eshelyaron.com>
Wed, 30 Nov 2022 18:45:45 +0000 (20:45 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 2 Dec 2022 09:53:19 +0000 (11:53 +0200)
sweep.pl
sweeprolog.el

index 1aaa7558e7413d605701a9ac61a2c5539a6e0983..360d9333af79a0bf974a91a1896ead8c064427e3 100644 (file)
--- 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,
index cccd6a3ca9dde074641579a588ad72d172091050..2f9d9298d7f30a171ccdcd326b2c1979f05e28b6 100644 (file)
@@ -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