manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.8.3.1 Readline Port

Function: readline-port

Return a buffered input port (see section Buffered Input) which calls the readline function above to get input. This port can be used with all the usual reading functions (read, read-char, etc), and the user gets the interactive editing features of readline.

There’s only a single readline port created. readline-port creates it when first called, and on subsequent calls just returns what it previously made.

Function: activate-readline

If the current-input-port is a terminal (see section isatty?) then enable readline for all reading from current-input-port (see section Default Ports for Input, Output and Errors) and enable readline features in the interactive REPL (see section Using the Guile REPL).

(activate-readline)
(read-char)

activate-readline enables readline on current-input-port simply by a set-current-input-port to the readline-port above. An application can do that directly if the extra REPL features that activate-readline adds are not wanted.

Function: set-readline-prompt! prompt1 [prompt2]

Set the prompt string to print when reading input. This is used when reading through readline-port, and is also the default prompt for the readline function above.

prompt1 is the initial prompt shown. If a user might enter an expression across multiple lines, then prompt2 is a different prompt to show further input required. In the Guile REPL for instance this is an ellipsis (‘...’).

See set-buffered-input-continuation?! (see section Buffered Input) for an application to indicate the boundaries of logical expressions (assuming of course an application has such a notion).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.