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).
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).
(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)))