119 lines
5.3 KiB
HTML
119 lines
5.3 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<!-- This manual documents Guile version 3.0.10.
|
||
|
|
||
|
Copyright (C) 1996-1997, 2000-2005, 2009-2023 Free Software Foundation,
|
||
|
Inc.
|
||
|
|
||
|
Copyright (C) 2021 Maxime Devos
|
||
|
|
||
|
Copyright (C) 2024 Tomas Volf
|
||
|
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||
|
any later version published by the Free Software Foundation; with no
|
||
|
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
||
|
copy of the license is included in the section entitled "GNU Free
|
||
|
Documentation License." -->
|
||
|
<title>Loading Readline Support (Guile Reference Manual)</title>
|
||
|
|
||
|
<meta name="description" content="Loading Readline Support (Guile Reference Manual)">
|
||
|
<meta name="keywords" content="Loading Readline Support (Guile Reference Manual)">
|
||
|
<meta name="resource-type" content="document">
|
||
|
<meta name="distribution" content="global">
|
||
|
<meta name="Generator" content=".texi2any-real">
|
||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
|
|
||
|
<link href="index.html" rel="start" title="Top">
|
||
|
<link href="Concept-Index.html" rel="index" title="Concept Index">
|
||
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||
|
<link href="Readline-Support.html" rel="up" title="Readline Support">
|
||
|
<link href="Readline-Options.html" rel="next" title="Readline Options">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
|
||
|
div.example {margin-left: 3.2em}
|
||
|
span:hover a.copiable-link {visibility: visible}
|
||
|
-->
|
||
|
</style>
|
||
|
<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css">
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body lang="en">
|
||
|
<div class="subsection-level-extent" id="Loading-Readline-Support">
|
||
|
<div class="nav-panel">
|
||
|
<p>
|
||
|
Next: <a href="Readline-Options.html" accesskey="n" rel="next">Readline Options</a>, Up: <a href="Readline-Support.html" accesskey="u" rel="up">Readline Support</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
<hr>
|
||
|
<h4 class="subsection" id="Loading-Readline-Support-1"><span>7.9.1 Loading Readline Support<a class="copiable-link" href="#Loading-Readline-Support-1"> ¶</a></span></h4>
|
||
|
|
||
|
<p>The module is not loaded by default and so has to be loaded and
|
||
|
activated explicitly. This is done with two simple lines of code:
|
||
|
</p>
|
||
|
<div class="example lisp">
|
||
|
<pre class="lisp-preformatted">(use-modules (ice-9 readline))
|
||
|
(activate-readline)
|
||
|
</pre></div>
|
||
|
|
||
|
|
||
|
<p>The first line will load the necessary code, and the second will
|
||
|
activate readline’s features for the REPL. If you plan to use this
|
||
|
module often, you should save these to lines to your <samp class="file">.guile</samp>
|
||
|
personal startup file.
|
||
|
</p>
|
||
|
<p>You will notice that the REPL’s behavior changes a bit when you have
|
||
|
loaded the readline module. For example, when you press Enter before
|
||
|
typing in the closing parentheses of a list, you will see the
|
||
|
<em class="dfn">continuation</em> prompt, three dots: <code class="code">...</code> This gives you a nice
|
||
|
visual feedback when trying to match parentheses. To make this even
|
||
|
easier, <em class="dfn">bouncing parentheses</em> are implemented. That means that
|
||
|
when you type in a closing parentheses, the cursor will jump to the
|
||
|
corresponding opening parenthesis for a short time, making it trivial to make
|
||
|
them match.
|
||
|
</p>
|
||
|
<p>Once the readline module is activated, all lines entered interactively
|
||
|
will be stored in a history and can be recalled later using the
|
||
|
cursor-up and -down keys. Readline also understands the Emacs keys for
|
||
|
navigating through the command line and history.
|
||
|
</p>
|
||
|
<a class="index-entry-id" id="index-_002eguile_005fhistory"></a>
|
||
|
<p>When you quit your Guile session by evaluating <code class="code">(quit)</code> or pressing
|
||
|
Ctrl-D, the history will be saved to the file <samp class="file">.guile_history</samp> and
|
||
|
read in when you start Guile for the next time. Thus you can start a
|
||
|
new Guile session and still have the (probably long-winded) definition
|
||
|
expressions available.
|
||
|
</p>
|
||
|
<a class="index-entry-id" id="index-GUILE_005fHISTORY"></a>
|
||
|
<a class="index-entry-id" id="index-_002einputrc"></a>
|
||
|
<p>You can specify a different history file by setting the environment
|
||
|
variable <code class="env">GUILE_HISTORY</code>. And you can make Guile specific
|
||
|
customizations to your <samp class="file">.inputrc</samp> by testing for application
|
||
|
‘<samp class="samp">Guile</samp>’ (see <a data-manual="readline" href="https://tiswww.cwru.edu/php/chet/readline/readline.html#Conditional-Init-Constructs">Conditional Init Constructs</a> in <cite class="cite">GNU
|
||
|
Readline Library</cite>). For instance to define a key inserting a matched
|
||
|
pair of parentheses,
|
||
|
</p>
|
||
|
<div class="example">
|
||
|
<pre class="example-preformatted">$if Guile
|
||
|
"\C-o": "()\C-b"
|
||
|
$endif
|
||
|
</pre></div>
|
||
|
|
||
|
</div>
|
||
|
<hr>
|
||
|
<div class="nav-panel">
|
||
|
<p>
|
||
|
Next: <a href="Readline-Options.html">Readline Options</a>, Up: <a href="Readline-Support.html">Readline Support</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|