~eshel/sweep

dca64656566cdefbe2084c0a1f1e9cd8866e1e57 — Eshel Yaron 7 months ago bf64c84
Provide documentation for predicate at point in top-levels
2 files changed, 12 insertions(+), 3 deletions(-)

M sweep.pl
M sweeprolog.el
M sweep.pl => sweep.pl +9 -3
@@ 236,9 236,12 @@ sweep_handle_fragment_(Offset, Col, Beg, Len) :-
    user:sweep_funcall("sweeprolog-analyze-fragment", [Start,Len|Nom], _).

sweep_short_documentation([ClauseString,Point,FileName0], [PIString,Doc,ArgSpan]) :-
    atom_string(FileName, FileName0),
    xref_source(FileName),
    sweep_module_path_(Mod, FileName),
    (   FileName0 == []
    ->  Mod = user
    ;   atom_string(FileName, FileName0),
        xref_source(FileName),
        sweep_module_path_(Mod, FileName)
    ),
    term_string(Clause, ClauseString, [subterm_positions(Pos), module(Mod), syntax_errors(quiet)]),
    callable(Clause),
    sweep_short_documentation_clause(Pos, Clause, Point, FileName, Mod, PIString, Doc, ArgSpan).


@@ 276,6 279,9 @@ sweep_short_documentation_clause_((Head --> Body), _Pos, [HeadPos, BodyPos], Poi
sweep_short_documentation_clause_((:- Directive), _Pos, [Pos], Point, FileName, Mod, PIString, Doc, ArgSpan) :-
    !,
    sweep_short_documentation_body(Pos, Directive, 0, Point, FileName, Mod, PIString, Doc, ArgSpan).
sweep_short_documentation_clause_((?- Directive), _Pos, [Pos], Point, FileName, Mod, PIString, Doc, ArgSpan) :-
    !,
    sweep_short_documentation_body(Pos, Directive, 0, Point, FileName, Mod, PIString, Doc, ArgSpan).
sweep_short_documentation_clause_(Head, Pos, _, Point, FileName, Mod, PIString, Doc, ArgSpan) :-
    sweep_short_documentation_head(Pos, Head, 0, Point, FileName, Mod, PIString, Doc, ArgSpan).


M sweeprolog.el => sweeprolog.el +3 -0
@@ 3661,6 3661,9 @@ GOAL.  Otherwise, GOAL is set to a default value specified by
  (add-hook 'after-change-functions #'sweeprolog-colourise-query nil t)
  (add-hook 'xref-backend-functions #'sweeprolog--xref-backend nil t)
  (add-hook 'comint-input-filter-functions #'sweeprolog--fill-query-holes nil t)
  (when (fboundp 'eldoc-documentation-default)
    (setq-local eldoc-documentation-strategy #'eldoc-documentation-default))
  (add-hook 'eldoc-documentation-functions #'sweeprolog-predicate-modes-doc nil t)
  (unless (member 'sweeprolog-hole yank-excluded-properties)
    (setq-local yank-excluded-properties
                (cons 'sweeprolog-hole yank-excluded-properties)))