Did you know ... Search Documentation:
help.pl -- Text based manual
PublicShow source

This module provides help/1 and apropos/1 that give help on a topic or searches the manual for relevant topics.

By default the result of help/1 is sent through a pager such as less. This behaviour is controlled by the following:

  • The Prolog flag help_pager, which can be set to one of the following values:
    Never use a pager.
    Use default behaviour. This tries to determine whether Prolog is running interactively in an environment that allows for a pager. If so it examines the environment variable PAGER or otherwise tries to find the less program.
    A Callable term is interpreted as program_name(Arg, ...). For example, less('-r') would be the default. Note that the program name can be an absolute path if single quotes are used.
Source help is det
Source help(+What) is det
Show help for What. What is a term that describes the topics(s) to give help for. Notations for What are:
This ambiguous form is most commonly used and shows all matching documents. For example:
?- help(append).
Name / Arity
Give help on predicates with matching Name/Arity. Arity may be unbound.
Name // Arity
Give help on the matching DCG rule (non-terminal)
Give help on the matching Prolog arithmetic functions.
Give help on the matching C interface function
Show the section from the manual with matching Label.

If an exact match fails this predicates attempts fuzzy matching and, when successful, display the results headed by a warning that the matches are based on fuzzy matching.

If possible, the results are sent through a pager such as the less program. This behaviour is controlled by the Prolog flag help_pager. See section level documentation.

See also
- apropos/1 for searching the manual names and summaries.
Source show_html_hook(+HTML:string) is semidet[multifile]
Hook called to display the extracted HTML document. If this hook fails the HTML is rendered to the console as plain text using html_text/2.
Source tty_width(-Width) is det[private]
Return the believed width of the terminal. If we do not know Width is bound to 80.
Source current_predicate_help(?PI) is nondet[private]
True when we have documentation on PI. First we decide we have a definition for PI, then we check whether or not we have documentation for the module in which PI resides. If not, we switch to documentation collect mode and reload the file that defines PI.
Source with_pager(+Goal)[private]
Send the current output of Goal through a pager. If no pager can be found we simply dump the output to the current output.
Source running_under_emacs[private]
True when we believe to be running in Emacs. Unfortunately there is no easy unambiguous way to tell.
Source apropos(+Query) is det
Print objects from the manual whose name or summary match with Query. Query takes one of the following forms:
Find objects matching Text and filter the results by Type. Type matching is a case intensitive prefix match. Defined types are section, cfunction, function, iso_predicate, swi_builtin_predicate, library_predicate, dcg and aliases chapter, arithmetic, c_function, predicate, nonterminal and non_terminal. For example:
?- apropos(c:close).
?- apropos(f:min).
Text is broken into tokens. A topic matches if all tokens appear in the name or summary of the topic. Matching is case insensitive. Results are ordered depending on the quality of the match.