Finish MINUS_G eradication per current configuration strategy.
[deliverable/binutils-gdb.git] / readline / history.texi
1 \input texinfo.tex
2 @setfilename history.info
3
4 @ifinfo
5 @format
6 START-INFO-DIR-ENTRY
7 * History: (history). The GNU History library.
8 END-INFO-DIR-ENTRY
9 @end format
10 @end ifinfo
11
12 @ifinfo
13 This file documents the GNU History library.
14
15 Copyright (C) 1988 Free Software Foundation, Inc.
16 Authored by Brian Fox.
17
18 Permission is granted to make and distribute verbatim copies of this manual
19 provided the copyright notice and this permission notice are preserved on
20 all copies.
21
22 @ignore
23 Permission is granted to process this file through Tex and print the
24 results, provided the printed document carries copying permission notice
25 identical to this one except for the removal of this paragraph (this
26 paragraph not being relevant to the printed manual).
27 @end ignore
28
29 Permission is granted to copy and distribute modified versions of this
30 manual under the conditions for verbatim copying, provided also that the
31 GNU Copyright statement is available to the distributee, and provided that
32 the entire resulting derived work is distributed under the terms of a
33 permission notice identical to this one.
34
35 Permission is granted to copy and distribute translations of this manual
36 into another language, under the above conditions for modified versions.
37 @end ifinfo
38
39 @node Top, Introduction, , (DIR)
40
41 This document describes the GNU History library, a programming tool that
42 provides a consistent user interface for recalling lines of previously
43 typed input.
44
45 @menu
46 * Introduction:: What is the GNU History library for?
47 * Interactive Use:: What it feels like using History as a user.
48 * Programming:: How to use History in your programs.
49 @end menu
50
51 @node Introduction, Interactive Use, Top, Top
52 @unnumbered Introduction
53
54 Many programs read input from the user a line at a time. The GNU history
55 library is able to keep track of those lines, associate arbitrary data with
56 each line, and utilize information from previous lines in making up new
57 ones.
58
59 The programmer using the History library has available to him functions for
60 remembering lines on a history stack, associating arbitrary data with a
61 line, removing lines from the stack, searching through the stack for a
62 line containing an arbitrary text string, and referencing any line on the
63 stack directly. In addition, a history @dfn{expansion} function is
64 available which provides for a consistent user interface across many
65 different programs.
66
67 The end-user using programs written with the History library has the
68 benifit of a consistent user interface, with a set of well-known commands
69 for manipulating the text of previous lines and using that text in new
70 commands. The basic history manipulation commands are similar to the
71 history substitution used by Csh.
72
73 If the programmer desires, he can use the Readline library, which includes
74 history manipulation by default, and has the added advantage of Emacs style
75 command line editing.
76
77 @node Interactive Use, Programming, Introduction, Top
78 @chapter Interactive Use
79
80 @section History Expansion
81 @cindex expansion
82
83 The History library provides a history expansion feature that is similar to
84 the history expansion in Csh. The following text describes what syntax
85 features are available.
86
87 History expansion takes place in two parts. The first is to determine
88 which line from the previous history should be used during substitution.
89 The second is to select portions of that line for inclusion into the
90 current one. The line selected from the previous history is called the
91 @dfn{event}, and the portions of that line that are acted upon are called
92 @dfn{words}. The line is broken into words in the same fashion that the
93 Bash shell does, so that several English (or Unix) words surrounded by
94 quotes are considered as one word.
95
96 @menu
97 * Event Designators:: How to specify which history line to use.
98 * Word Designators:: Specifying which words are of interest.
99 * Modifiers:: Modifying the results of susbstitution.
100 @end menu
101
102 @node Event Designators, Word Designators, , Interactive Use
103 @subsection Event Designators
104 @cindex event designators
105
106 An event designator is a reference to a command line entry in the history
107 list.
108
109 @table @var
110
111 @item !
112 Start a history subsititution, except when followed by a @key{SPC},
113 @key{TAB}, @key{RET}, @key{=} or @key{(}.
114
115 @item !!
116 Refer to the previous command. This is a synonym for @code{!-1}.
117
118 @item !n
119 Refer to command line @var{n}.
120
121 @item !-n
122 Refer to the current command line minus @var{n}.
123
124 @item !string
125 Refer to the most recent command starting with @var{string}.
126
127 @item !?string[?]
128 Refer to the most recent command containing @var{string}.
129
130 @end table
131
132 @node Word Designators, Modifiers, Event Designators, Interactive Use
133 @subsection Word Designators
134
135 A @key{:} separates the event specification from the word designator. It
136 can be omitted if the word designator begins with a @key{^}, @key{$},
137 @key{*} or @key{%}. Words are numbered from the beginning of the line,
138 with the first word being denoted by a 0 (zero).
139
140 @table @asis
141
142 @item @var{0} (zero)
143 The zero'th word. For many applications, this is the command word.
144
145 @item n
146 The @var{n}'th word.
147
148 @item @var{^}
149 The first argument. that is, word 1.
150
151 @item @var{$}
152 The last argument.
153
154 @item @var{%}
155 The word matched by the most recent @code{?string?} search.
156
157 @item @var{x}-@var{y}
158 A range of words; @code{-@var{y}} is equivalent to @code{0-@var{y}}.
159
160 @item @var{*}
161 All of the words, excepting the zero'th. This is a synonym for @samp{1-$}.
162 It is not an error to use @samp{*} if there is just one word in the event.
163 The empty string is returned in that case.
164
165 @end table
166
167 @node Modifiers, , Word Designators, Interactive Use
168 @subsection Modifiers
169
170 After the optional word designator, you can add a sequence of one or more
171 of the following modifiers, each preceded by a @key{:}.
172
173 @table @code
174
175 @item #
176 The entire command line typed so far. This means the current command,
177 not the previous command, so it really isn't a word designator, and doesn't
178 belong in this section.
179
180 @item h
181 Remove a trailing pathname component, leaving only the head.
182
183 @item r
184 Remove a trailing suffix of the form ".xxx", leaving the basename (root).
185
186 @item e
187 Remove all but the suffix (end).
188
189 @item t
190 Remove all leading pathname components (before the last slash), leaving
191 the tail.
192
193 @item p
194 Print the new command but do not execute it. This takes effect
195 immediately, so it should be the last specifier on the line.
196
197 @end table
198
199 @node Programming, , Interactive Use, Top
200 @chapter Programming
201
202 @bye
This page took 0.04074 seconds and 4 git commands to generate.