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

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

[nongnu] elpa/sweeprolog 4b4b28f15a 007/166: Add module descriptions to


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 4b4b28f15a 007/166: Add module descriptions to sweep-find-module annotation function
Date: Fri, 30 Sep 2022 04:59:21 -0400 (EDT)

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

    Add module descriptions to sweep-find-module annotation function
---
 sweep.el | 15 +++++++++++----
 sweep.pl | 13 ++++++++++---
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/sweep.el b/sweep.el
index 76916377a4..88f6c99e5a 100644
--- a/sweep.el
+++ b/sweep.el
@@ -95,14 +95,16 @@ module name, F is a functor name and N is its arity."
   (sweep-open-query "user" "sweep" "sweep_modules_collection" nil)
   (let ((sol (sweep-next-solution)))
     (sweep-close-query)
-    (when (eq '! (car sol))
+    (when (or (eq (car sol) '!)
+              (eq (car sol) t))
       (cdr sol))))
 
 (defun sweep-module-path (mod)
   (sweep-open-query "user" "sweep" "sweep_module_path" mod)
   (let ((sol (sweep-next-solution)))
     (sweep-close-query)
-    (when (eq '! (car sol))
+    (when (or (eq (car sol) '!)
+              (eq (car sol) t))
       (cdr sol))))
 
 (defun sweep-read-module-name ()
@@ -111,8 +113,13 @@ module name, F is a functor name and N is its arity."
          (completion-extra-properties
           (list :annotation-function
                 (lambda (key)
-                  (concat (make-string (- 32 (length key)) ? )
-                          (cdr (assoc-string key col)))))))
+                  (let* ((val (cdr (assoc-string key col)))
+                         (pat (car val))
+                         (des (cdr val)))
+                    (concat (make-string (- 32 (length key)) ? )
+                            (if des
+                                (concat pat (make-string (- 64 (length pat)) ? 
) des)
+                              pat)))))))
     (completing-read "Module: " col)))
 
 (defun sweep-find-module (mod)
diff --git a/sweep.pl b/sweep.pl
index 5e90a744a6..57f20cfa7d 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -170,9 +170,16 @@ sweep_module_path_(Module, Path) :-
 
 
 sweep_modules_collection([], Modules) :-
-    findall([M|P], ( module_property(M0, file(P0)), atom_string(M0, M), 
atom_string(P0, P) ), Modules0, Tail),
-    setof([M|P], M0^P0^N^('$autoload':library_index(N, M0, P0), 
string_concat(P0, ".pl", P), atom_string(M0, M) ), Tail),
-    list_to_set(Modules0, Modules).
+    findall([M|P], ( module_property(M, file(P0)), atom_string(P0, P) ), 
Modules0, Tail),
+    setof([M|P], P0^N^('$autoload':library_index(N, M, P0), string_concat(P0, 
".pl", P) ), Tail),
+    list_to_set(Modules0, Modules1),
+    maplist(sweep_module_description, Modules1, Modules).
+
+sweep_module_description([M0|P], [M|[P|D]]) :-
+   pldoc_process:doc_comment(M0:module(D0), _, _, _),
+   atom_string(M0, M),
+   atom_string(D0, D).
+sweep_module_description([M0|P], [M|[P]]) :- atom_string(M0, M).
 
 sweep_predicate_location(MFN, [Path|Line]) :-
     term_string(M:F/N, MFN),



reply via email to

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