Linedit management

### 7.29 Linedit management

- `get_linedit_prompt/1`
- `set_linedit_prompt/1`
- `add_linedit_completion/1`
- `find_linedit_completion/2`

The following predicates are only available if the `linedit` part of GNU Prolog has been installed.

#### 7.29.1 `get_linedit_prompt/1`

Templates

  `get_linedit_prompt(?atom)`

Description

`get_linedit_prompt(Prompt)` succeeds if `Prompt` is the current `linedit` prompt, e.g. the top-level prompt is `’| ?-’`. By default all other reads have an empty prompt.

Errors

`Prompt` is neither a variable nor an atom |  | `type_error(atom, Pred)`

Portability

GNU Prolog predicate.

#### 7.29.2 `set_linedit_prompt/1`

Templates

  `set_linedit_prompt(+atom)`

Description

`set_linedit_prompt(Prompt)` sets the current `linedit` prompt to `Prompt`. This prompt will be displayed for reads from a terminal (except for top-level reads).

Errors

`Prompt` is a variable |  | `instantiation_error`
`Prompt` is neither a variable nor an atom |  | `type_error(atom, Pred)`

Portability

GNU Prolog predicate.

#### 7.29.3 `add_linedit_completion/1`

Templates

  `add_linedit_completion(+atom)`

Description

`add_linedit_completion(Word)` adds `Word` in the list of completion words maintained by `linedit` (section 3.2.5). Only words containing letters, digits and the underscore character are added (if `Word` does not respect this restriction the predicate fails).

Errors

`Word` is a variable |  | `instantiation_error`
`Word` is neither a variable nor an atom |  | `type_error(atom, Word)`

Portability

GNU Prolog predicate.

#### 7.29.4 `find_linedit_completion/2`

Templates

  `find_linedit_completion(+atom, ?atom)`

Description

`find_linedit_completion(Prefix, Word)` succeeds if `Word` is a word beginning by `Prefix` and belongs to the list of completion words maintained by `linedit` (section 3.2.5). This predicate is re-executable on backtracking.

Errors

`Prefix` is a variable |  | `instantiation_error`
`Prefix` is neither a variable nor an atom |  | `type_error(atom, Prefix)`
`Word` is neither a variable nor an atom |  | `type_error(atom, Word)`

Portability

GNU Prolog predicate.

Copyright (C) 1999-2009 Daniel Diaz Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. More about the copyright