From 94b5b9b94ea4980851807be7b92b67e2c58de8ed Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 20 Jan 2023 13:49:51 +0200 Subject: [PATCH] FIXED: stale xref data when jumping across files with M-. --- README.org | 2 +- sweep.pl | 14 ++++++++++---- sweeprolog.el | 1 - 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index 2d5ebe7..8713530 100644 --- a/README.org +++ b/README.org @@ -2108,7 +2108,7 @@ mailing list. :END: While Sweep is ready to be used for effective editing of Prolog code, -there some further improvements that we want to pursue: +some improvements remain to be pursued: ** Improvements around editing Prolog :PROPERTIES: diff --git a/sweep.pl b/sweep.pl index 4cf0d4d..79c6ffc 100644 --- a/sweep.pl +++ b/sweep.pl @@ -359,6 +359,9 @@ sweep_predicate_apropos(Query0, Matches) :- Tail). sweep_predicate_location_(H, Path, Line) :- + xref_defined(Path0, H, How0), + xref_definition_line(How0, _), + xref_source(Path0, [comments(store)]), xref_defined(Path0, H, How), xref_definition_line(How, Line), !, @@ -369,13 +372,16 @@ sweep_predicate_location_(H, Path, Line) :- atom_string(Path0, Path). sweep_predicate_location_(M, H, Path, Line) :- - ( xref_defined(Path0, M:H, How), - xref_definition_line(How, Line) + ( xref_defined(Path0, M:H, How0), + xref_definition_line(How0, _) -> true - ; xref_defined(Path0, H, How), - xref_definition_line(How, Line), + ; xref_defined(Path0, H, How0), + xref_definition_line(How0, _), xref_module(Path0, M) ), + xref_source(Path0, [comments(store)]), + xref_defined(Path0, H, How), + xref_definition_line(How, Line), !, atom_string(Path0, Path). sweep_predicate_location_(M, H, Path, Line) :- diff --git a/sweeprolog.el b/sweeprolog.el index b4d99d7..f6e8eb2 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -902,7 +902,6 @@ PROJECT (only on Emacs 28 or later)." For native built-in predicates, the behavior of this function depends on the value of the user option `sweeprolog-swipl-sources', which see." - (sweeprolog-analyze-buffer) (or (sweeprolog--query-once "sweep" "sweep_predicate_location" mfn) (sweeprolog-native-predicate-location mfn))) -- 2.39.2