emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sweeprolog d226bbb70c 063/166: ENHANCED: set per buffer mo


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog d226bbb70c 063/166: ENHANCED: set per buffer module name in sweep-mode
Date: Fri, 30 Sep 2022 04:59:26 -0400 (EDT)

branch: elpa/sweeprolog
commit d226bbb70c7260d1bb1d6f8165daa913e864cd10
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    ENHANCED: set per buffer module name in sweep-mode
---
 sweep.el | 11 ++++++++++-
 sweep.pl |  7 +++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/sweep.el b/sweep.el
index bf3aff17bb..16ce920f17 100644
--- a/sweep.el
+++ b/sweep.el
@@ -262,6 +262,14 @@ module name, F is a functor name and N is its arity."
                               pat)))))))
     (completing-read sweep-read-module-prompt col)))
 
+
+(defun sweep--set-buffer-module ()
+  (sweep-open-query "user" "sweep" "sweep_path_module" (buffer-file-name))
+  (let ((sol (sweep-next-solution)))
+    (sweep-close-query)
+    (when (sweep-true-p sol)
+      (setq sweep-buffer-module (cdr sol)))))
+
 ;;;###autoload
 (defun sweep-find-module (mod)
   "Jump to the source file of the Prolog module MOD."
@@ -970,7 +978,8 @@ Interactively, a prefix arg means to prompt for BUFFER."
                 nil
                 nil
                 (font-lock-fontify-region-function . 
sweep-colourise-some-terms)))
-  (sweep-colourise-buffer))
+  (sweep-colourise-buffer)
+  (sweep--set-buffer-module))
 
 ;;;; Testing:
 
diff --git a/sweep.pl b/sweep.pl
index 3d65efa01d..c24bae8b60 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -35,6 +35,7 @@
             sweep_colourise_some_terms/2,
             sweep_documentation/2,
             sweep_expand_file_name/2,
+            sweep_path_module/2,
             sweep_predicate_location/2,
             sweep_predicates_collection/2,
             sweep_modules_collection/2,
@@ -350,3 +351,9 @@ sweep_expand_file_name_(Dir, Spec, Exp) :-
                                    relative_to(Dir),
                                    solutions(all),
                                    extensions(['', '.pl'])]).
+
+sweep_path_module([], "user")    :- !.
+sweep_path_module(Path0, Module) :-
+    atom_string(Path, Path0),
+    xref_module(Path, Module0),
+    atom_string(Module0, Module).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]