3 <!-- This HTML file has been created by texi2html 1.51
4 from /usr/homes/chet/src/bash/readline-2.2/doc/rlman.texinfo on 2 April 1998 -->
6 <TITLE>GNU Readline Library</TITLE>
9 <H1>GNU Readline Library</H1>
10 <H2>Edition 2.2, for <CODE>Readline Library</CODE> Version 2.1.</H2>
11 <H2>September 1997</H2>
12 <ADDRESS>Brian Fox, Free Software Foundation</ADDRESS>
13 <ADDRESS>Chet Ramey, Case Western Reserve University</ADDRESS>
18 @dircategory Libraries
20 * Readline: (readline). The GNU readline library API
25 This document describes the GNU Readline Library, a utility which aids
26 in the consistency of user interface across discrete programs that need
27 to provide a command line interface.
31 Published by the Free Software Foundation <BR>
32 675 Massachusetts Avenue, <BR>
33 Cambridge, MA 02139 USA
37 Permission is granted to make and distribute verbatim copies of
38 this manual provided the copyright notice and this permission notice
39 are preserved on all copies.
43 Permission is granted to copy and distribute modified versions of this
44 manual under the conditions for verbatim copying, provided that the entire
45 resulting derived work is distributed under the terms of a permission
46 notice identical to this one.
50 Permission is granted to copy and distribute translations of this manual
51 into another language, under the above conditions for modified versions,
52 except that this permission notice may be stated in a translation approved
57 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
63 <H1><A NAME="SEC1" HREF="readline_toc.html#TOC1">Command Line Editing</A></H1>
66 This chapter describes the basic features of the GNU
67 command line editing interface.
73 <H2><A NAME="SEC2" HREF="readline_toc.html#TOC2">Introduction to Line Editing</A></H2>
76 The following paragraphs describe the notation used to represent
81 The text <KBD>C-k</KBD> is read as `Control-K' and describes the character
82 produced when the <KBD>k</KBD> key is pressed while the Control key
87 The text <KBD>M-k</KBD> is read as `Meta-K' and describes the character
88 produced when the meta key (if you have one) is depressed, and the <KBD>k</KBD>
89 key is pressed. If you do not have a meta key, the identical keystroke
90 can be generated by typing <KBD>ESC</KBD> <I>first</I>, and then typing <KBD>k</KBD>.
91 Either process is known as <STRONG>metafying</STRONG> the <KBD>k</KBD> key.
95 The text <KBD>M-C-k</KBD> is read as `Meta-Control-k' and describes the
96 character produced by <STRONG>metafying</STRONG> <KBD>C-k</KBD>.
100 In addition, several keys have their own names. Specifically,
101 <KBD>DEL</KBD>, <KBD>ESC</KBD>, <KBD>LFD</KBD>, <KBD>SPC</KBD>, <KBD>RET</KBD>, and <KBD>TAB</KBD> all
102 stand for themselves when seen in this text, or in an init file
103 (@xref{Readline Init File}).
108 <H2><A NAME="SEC3" HREF="readline_toc.html#TOC3">Readline Interaction</A></H2>
114 Often during an interactive session you type in a long line of text,
115 only to notice that the first word on the line is misspelled. The
116 Readline library gives you a set of commands for manipulating the text
117 as you type it in, allowing you to just fix your typo, and not forcing
118 you to retype the majority of the line. Using these editing commands,
119 you move the cursor to the place that needs correction, and delete or
120 insert the text of the corrections. Then, when you are satisfied with
121 the line, you simply press <KBD>RETURN</KBD>. You do not have to be at the
122 end of the line to press <KBD>RETURN</KBD>; the entire line is accepted
123 regardless of the location of the cursor within the line.
129 <H3><A NAME="SEC4" HREF="readline_toc.html#TOC4">Readline Init File Syntax</A></H3>
132 There are only a few basic constructs allowed in the
133 Readline init file. Blank lines are ignored.
134 Lines beginning with a <SAMP>`#'</SAMP> are comments.
135 Lines beginning with a <SAMP>`$'</SAMP> indicate conditional
136 constructs (see section <A HREF="readline.html#SEC5">Conditional Init Constructs</A>). Other lines
137 denote variable settings and key bindings.
142 <DT>Variable Settings
144 You can modify the run-time behavior of Readline by
145 altering the values of variables in Readline
146 using the <CODE>set</CODE> command within the init file. Here is how to
147 change from the default Emacs-like key binding to use
148 <CODE>vi</CODE> line editing commands:
155 A great deal of run-time behavior is changeable with the following
160 <DT><CODE>bell-style</CODE>
163 Controls what happens when Readline wants to ring the terminal bell.
164 If set to <SAMP>`none'</SAMP>, Readline never rings the bell. If set to
165 <SAMP>`visible'</SAMP>, Readline uses a visible bell if one is available.
166 If set to <SAMP>`audible'</SAMP> (the default), Readline attempts to ring
169 <DT><CODE>comment-begin</CODE>
172 The string to insert at the beginning of the line when the
173 <CODE>insert-comment</CODE> command is executed. The default value
176 <DT><CODE>completion-ignore-case</CODE>
178 If set to <SAMP>`on'</SAMP>, Readline performs filename matching and completion
179 in a case-insensitive fashion.
180 The default value is <SAMP>`off'</SAMP>.
182 <DT><CODE>completion-query-items</CODE>
185 The number of possible completions that determines when the user is
186 asked whether he wants to see the list of possibilities. If the
187 number of possible completions is greater than this value,
188 Readline will ask the user whether or not he wishes to view
189 them; otherwise, they are simply listed. The default limit is
192 <DT><CODE>convert-meta</CODE>
195 If set to <SAMP>`on'</SAMP>, Readline will convert characters with the
196 eighth bit set to an ASCII key sequence by stripping the eighth
197 bit and prepending an <KBD>ESC</KBD> character, converting them to a
198 meta-prefixed key sequence. The default value is <SAMP>`on'</SAMP>.
200 <DT><CODE>disable-completion</CODE>
203 If set to <SAMP>`On'</SAMP>, Readline will inhibit word completion.
204 Completion characters will be inserted into the line as if they had
205 been mapped to <CODE>self-insert</CODE>. The default is <SAMP>`off'</SAMP>.
207 <DT><CODE>editing-mode</CODE>
210 The <CODE>editing-mode</CODE> variable controls which default set of
211 key bindings is used. By default, Readline starts up in Emacs editing
212 mode, where the keystrokes are most similar to Emacs. This variable can be
213 set to either <SAMP>`emacs'</SAMP> or <SAMP>`vi'</SAMP>.
215 <DT><CODE>enable-keypad</CODE>
218 When set to <SAMP>`on'</SAMP>, Readline will try to enable the application
219 keypad when it is called. Some systems need this to enable the
220 arrow keys. The default is <SAMP>`off'</SAMP>.
222 <DT><CODE>expand-tilde</CODE>
225 If set to <SAMP>`on'</SAMP>, tilde expansion is performed when Readline
226 attempts word completion. The default is <SAMP>`off'</SAMP>.
228 <DT><CODE>horizontal-scroll-mode</CODE>
231 This variable can be set to either <SAMP>`on'</SAMP> or <SAMP>`off'</SAMP>. Setting it
232 to <SAMP>`on'</SAMP> means that the text of the lines being edited will scroll
233 horizontally on a single screen line when they are longer than the width
234 of the screen, instead of wrapping onto a new screen line. By default,
235 this variable is set to <SAMP>`off'</SAMP>.
237 <DT><CODE>keymap</CODE>
240 Sets Readline's idea of the current keymap for key binding commands.
241 Acceptable <CODE>keymap</CODE> names are
243 <CODE>emacs-standard</CODE>,
244 <CODE>emacs-meta</CODE>,
245 <CODE>emacs-ctlx</CODE>,
247 <CODE>vi-command</CODE>, and
248 <CODE>vi-insert</CODE>.
249 <CODE>vi</CODE> is equivalent to <CODE>vi-command</CODE>; <CODE>emacs</CODE> is
250 equivalent to <CODE>emacs-standard</CODE>. The default value is <CODE>emacs</CODE>.
251 The value of the <CODE>editing-mode</CODE> variable also affects the
254 <DT><CODE>mark-directories</CODE>
256 If set to <SAMP>`on'</SAMP>, completed directory names have a slash
257 appended. The default is <SAMP>`on'</SAMP>.
259 <DT><CODE>mark-modified-lines</CODE>
262 This variable, when set to <SAMP>`on'</SAMP>, causes Readline to display an
263 asterisk (<SAMP>`*'</SAMP>) at the start of history lines which have been modified.
264 This variable is <SAMP>`off'</SAMP> by default.
266 <DT><CODE>input-meta</CODE>
270 If set to <SAMP>`on'</SAMP>, Readline will enable eight-bit input (it
271 will not strip the eighth bit from the characters it reads),
272 regardless of what the terminal claims it can support. The
273 default value is <SAMP>`off'</SAMP>. The name <CODE>meta-flag</CODE> is a
274 synonym for this variable.
276 <DT><CODE>output-meta</CODE>
279 If set to <SAMP>`on'</SAMP>, Readline will display characters with the
280 eighth bit set directly rather than as a meta-prefixed escape
281 sequence. The default is <SAMP>`off'</SAMP>.
283 <DT><CODE>print-completions-horizontally</CODE>
285 If set to <SAMP>`on'</SAMP>, Readline will display completions with matches
286 sorted horizontally in alphabetical order, rather than down the screen.
287 The default is <SAMP>`off'</SAMP>.
289 <DT><CODE>show-all-if-ambiguous</CODE>
292 This alters the default behavior of the completion functions. If
293 set to <SAMP>`on'</SAMP>,
294 words which have more than one possible completion cause the
295 matches to be listed immediately instead of ringing the bell.
296 The default value is <SAMP>`off'</SAMP>.
298 <DT><CODE>visible-stats</CODE>
301 If set to <SAMP>`on'</SAMP>, a character denoting a file's type
302 is appended to the filename when listing possible
303 completions. The default is <SAMP>`off'</SAMP>.
309 The syntax for controlling key bindings in the init file is
310 simple. First you have to know the name of the command that you
311 want to change. The following sections contain tables of the command
312 name, the default keybinding, if any, and a short description of what
315 Once you know the name of the command, simply place the name of the key
316 you wish to bind the command to, a colon, and then the name of the
317 command on a line in the init file. The name of the key
318 can be expressed in different ways, depending on which is most
323 <DT><VAR>keyname</VAR>: <VAR>function-name</VAR> or <VAR>macro</VAR>
325 <VAR>keyname</VAR> is the name of a key spelled out in English. For example:
328 Control-u: universal-argument
329 Meta-Rubout: backward-kill-word
330 Control-o: "> output"
333 In the above example, <KBD>C-u</KBD> is bound to the function
334 <CODE>universal-argument</CODE>, and <KBD>C-o</KBD> is bound to run the macro
335 expressed on the right hand side (that is, to insert the text
336 <SAMP>`> output'</SAMP> into the line).
338 <DT>"<VAR>keyseq</VAR>": <VAR>function-name</VAR> or <VAR>macro</VAR>
340 <VAR>keyseq</VAR> differs from <VAR>keyname</VAR> above in that strings
341 denoting an entire key sequence can be specified, by placing
342 the key sequence in double quotes. Some GNU Emacs style key
343 escapes can be used, as in the following example, but the
344 special character names are not recognized.
348 "\C-u": universal-argument
349 "\C-x\C-r": re-read-init-file
350 "\e[11~": "Function Key 1"
353 In the above example, <KBD>C-u</KBD> is bound to the function
354 <CODE>universal-argument</CODE> (just as it was in the first example),
355 <SAMP>`<KBD>C-x</KBD> <KBD>C-r</KBD>'</SAMP> is bound to the function <CODE>re-read-init-file</CODE>,
356 and <SAMP>`<KBD>ESC</KBD> <KBD>[</KBD> <KBD>1</KBD> <KBD>1</KBD> <KBD>~</KBD>'</SAMP> is bound to insert
357 the text <SAMP>`Function Key 1'</SAMP>.
361 The following GNU Emacs style escape sequences are available when
362 specifying key sequences:
366 <DT><CODE><KBD>\C-</KBD></CODE>
369 <DT><CODE><KBD>\M-</KBD></CODE>
372 <DT><CODE><KBD>\e</KBD></CODE>
375 <DT><CODE><KBD>\\</KBD></CODE>
378 <DT><CODE><KBD>\"</KBD></CODE>
381 <DT><CODE><KBD>\'</KBD></CODE>
386 In addition to the GNU Emacs style escape sequences, a second
387 set of backslash escapes is available:
415 <DT><CODE>\<VAR>nnn</VAR></CODE>
417 the character whose ASCII code is the octal value <VAR>nnn</VAR>
418 (one to three digits)
419 <DT><CODE>\x<VAR>nnn</VAR></CODE>
421 the character whose ASCII code is the hexadecimal value <VAR>nnn</VAR>
422 (one to three digits)
425 When entering the text of a macro, single or double quotes must
426 be used to indicate a macro definition.
427 Unquoted text is assumed to be a function name.
428 In the macro body, the backslash escapes described above are expanded.
429 Backslash will quote any other character in the macro text,
430 including <SAMP>`"'</SAMP> and <SAMP>`''</SAMP>.
431 For example, the following binding will make <SAMP>`C-x \'</SAMP>
432 insert a single <SAMP>`\'</SAMP> into the line:
442 <H3><A NAME="SEC5" HREF="readline_toc.html#TOC5">Conditional Init Constructs</A></H3>
445 Readline implements a facility similar in spirit to the conditional
446 compilation features of the C preprocessor which allows key
447 bindings and variable settings to be performed as the result
448 of tests. There are four parser directives used.
455 The <CODE>$if</CODE> construct allows bindings to be made based on the
456 editing mode, the terminal being used, or the application using
457 Readline. The text of the test extends to the end of the line;
458 no characters are required to isolate it.
462 <DT><CODE>mode</CODE>
464 The <CODE>mode=</CODE> form of the <CODE>$if</CODE> directive is used to test
465 whether Readline is in <CODE>emacs</CODE> or <CODE>vi</CODE> mode.
466 This may be used in conjunction
467 with the <SAMP>`set keymap'</SAMP> command, for instance, to set bindings in
468 the <CODE>emacs-standard</CODE> and <CODE>emacs-ctlx</CODE> keymaps only if
469 Readline is starting out in <CODE>emacs</CODE> mode.
471 <DT><CODE>term</CODE>
473 The <CODE>term=</CODE> form may be used to include terminal-specific
474 key bindings, perhaps to bind the key sequences output by the
475 terminal's function keys. The word on the right side of the
476 <SAMP>`='</SAMP> is tested against both the full name of the terminal and
477 the portion of the terminal name before the first <SAMP>`-'</SAMP>. This
478 allows <CODE>sun</CODE> to match both <CODE>sun</CODE> and <CODE>sun-cmd</CODE>,
481 <DT><CODE>application</CODE>
483 The <VAR>application</VAR> construct is used to include
484 application-specific settings. Each program using the Readline
485 library sets the <VAR>application name</VAR>, and you can test for it.
486 This could be used to bind key sequences to functions useful for
487 a specific program. For instance, the following command adds a
488 key sequence that quotes the current or previous word in Bash:
492 # Quote the current or previous word
493 "\C-xq": "\eb\"\ef\""
499 <DT><CODE>$endif</CODE>
501 This command, as seen in the previous example, terminates an
502 <CODE>$if</CODE> command.
504 <DT><CODE>$else</CODE>
506 Commands in this branch of the <CODE>$if</CODE> directive are executed if
509 <DT><CODE>$include</CODE>
511 This directive takes a single filename as an argument and reads commands
512 and bindings from that file.
515 $include /etc/inputrc
522 <H3><A NAME="SEC6" HREF="readline_toc.html#TOC6">Sample Init File</A></H3>
525 Here is an example of an inputrc file. This illustrates key
526 binding, variable assignment, and conditional syntax.
531 # This file controls the behaviour of line input editing for
532 # programs that use the Gnu Readline library. Existing programs
533 # include FTP, Bash, and Gdb.
535 # You can re-read the inputrc file with C-x C-r.
536 # Lines beginning with '#' are comments.
538 # First, include any systemwide bindings and variable assignments from
540 $include /etc/Inputrc
543 # Set various bindings for emacs mode.
545 set editing-mode emacs
549 Meta-Control-h: backward-kill-word Text after the function name is ignored
552 # Arrow keys in keypad mode
554 #"\M-OD": backward-char
555 #"\M-OC": forward-char
556 #"\M-OA": previous-history
557 #"\M-OB": next-history
559 # Arrow keys in ANSI mode
561 "\M-[D": backward-char
562 "\M-[C": forward-char
563 "\M-[A": previous-history
564 "\M-[B": next-history
566 # Arrow keys in 8 bit keypad mode
568 #"\M-\C-OD": backward-char
569 #"\M-\C-OC": forward-char
570 #"\M-\C-OA": previous-history
571 #"\M-\C-OB": next-history
573 # Arrow keys in 8 bit ANSI mode
575 #"\M-\C-[D": backward-char
576 #"\M-\C-[C": forward-char
577 #"\M-\C-[A": previous-history
578 #"\M-\C-[B": next-history
584 # An old-style binding. This happens to be the default.
587 # Macros that are convenient for shell interaction
590 "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
591 # prepare to type a quoted word -- insert open and close double quotes
592 # and move to just after the open quote
594 # insert a backslash (testing backslash escapes in sequences and macros)
596 # Quote the current or previous word
597 "\C-xq": "\eb\"\ef\""
598 # Add a binding to refresh the line, which is unbound
599 "\C-xr": redraw-current-line
600 # Edit variable on current line.
601 "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
604 # use a visible bell if one is available
605 set bell-style visible
607 # don't strip characters to 7 bits when reading
610 # allow iso-latin1 characters to be inserted rather than converted to
611 # prefix-meta sequences
614 # display characters with the eighth bit set directly rather than
615 # as meta-prefixed characters
618 # if there are more than 150 possible completions for a word, ask the
619 # user if he wants to see all of them
620 set completion-query-items 150
626 "\M-.": yank-last-arg
632 <H2><A NAME="SEC7" HREF="readline_toc.html#TOC7">Bindable Readline Commands</A></H2>
635 This section describes Readline commands that may be bound to key
641 <H3><A NAME="SEC8" HREF="readline_toc.html#TOC8">Commands For Moving</A></H3>
644 <DT><CODE>beginning-of-line (C-a)</CODE>
647 Move to the start of the current line.
649 <DT><CODE>end-of-line (C-e)</CODE>
652 Move to the end of the line.
654 <DT><CODE>forward-char (C-f)</CODE>
657 Move forward a character.
659 <DT><CODE>backward-char (C-b)</CODE>
662 Move back a character.
664 <DT><CODE>forward-word (M-f)</CODE>
667 Move forward to the end of the next word. Words are composed of
670 <DT><CODE>backward-word (M-b)</CODE>
673 Move back to the start of this, or the previous, word. Words are
674 composed of letters and digits.
676 <DT><CODE>clear-screen (C-l)</CODE>
679 Clear the screen and redraw the current line,
680 leaving the current line at the top of the screen.
682 <DT><CODE>redraw-current-line ()</CODE>
685 Refresh the current line. By default, this is unbound.
691 <H3><A NAME="SEC9" HREF="readline_toc.html#TOC9">Commands For Manipulating The History</A></H3>
695 <DT><CODE>accept-line (Newline, Return)</CODE>
698 Accept the line regardless of where the cursor is. If this line is
699 non-empty, add it to the history list. If this line was a history
700 line, then restore the history line to its original state.
702 <DT><CODE>previous-history (C-p)</CODE>
705 Move `up' through the history list.
707 <DT><CODE>next-history (C-n)</CODE>
710 Move `down' through the history list.
712 <DT><CODE>beginning-of-history (M-<)</CODE>
715 Move to the first line in the history.
717 <DT><CODE>end-of-history (M->)</CODE>
720 Move to the end of the input history, i.e., the line currently
723 <DT><CODE>reverse-search-history (C-r)</CODE>
726 Search backward starting at the current line and moving `up' through
727 the history as necessary. This is an incremental search.
729 <DT><CODE>forward-search-history (C-s)</CODE>
732 Search forward starting at the current line and moving `down' through
733 the the history as necessary. This is an incremental search.
735 <DT><CODE>non-incremental-reverse-search-history (M-p)</CODE>
738 Search backward starting at the current line and moving `up'
739 through the history as necessary using a non-incremental search
740 for a string supplied by the user.
742 <DT><CODE>non-incremental-forward-search-history (M-n)</CODE>
745 Search forward starting at the current line and moving `down'
746 through the the history as necessary using a non-incremental search
747 for a string supplied by the user.
749 <DT><CODE>history-search-forward ()</CODE>
752 Search forward through the history for the string of characters
753 between the start of the current line and the current cursor
754 position (the <VAR>point</VAR>). This is a non-incremental search. By
755 default, this command is unbound.
757 <DT><CODE>history-search-backward ()</CODE>
760 Search backward through the history for the string of characters
761 between the start of the current line and the point. This
762 is a non-incremental search. By default, this command is unbound.
764 <DT><CODE>yank-nth-arg (M-C-y)</CODE>
767 Insert the first argument to the previous command (usually
768 the second word on the previous line). With an argument <VAR>n</VAR>,
769 insert the <VAR>n</VAR>th word from the previous command (the words
770 in the previous command begin with word 0). A negative argument
771 inserts the <VAR>n</VAR>th word from the end of the previous command.
773 <DT><CODE>yank-last-arg (M-., M-_)</CODE>
776 Insert last argument to the previous command (the last word of the
777 previous history entry). With an
778 argument, behave exactly like <CODE>yank-nth-arg</CODE>.
779 Successive calls to <CODE>yank-last-arg</CODE> move back through the history
780 list, inserting the last argument of each line in turn.
786 <H3><A NAME="SEC10" HREF="readline_toc.html#TOC10">Commands For Changing Text</A></H3>
790 <DT><CODE>delete-char (C-d)</CODE>
793 Delete the character under the cursor. If the cursor is at the
794 beginning of the line, there are no characters in the line, and
795 the last character typed was not bound to <CODE>delete-char</CODE>, then
796 return <CODE>EOF</CODE>.
798 <DT><CODE>backward-delete-char (Rubout)</CODE>
801 Delete the character behind the cursor. A numeric argument means
802 to kill the characters instead of deleting them.
804 <DT><CODE>quoted-insert (C-q, C-v)</CODE>
807 Add the next character typed to the line verbatim. This is
808 how to insert key sequences like <KBD>C-q</KBD>, for example.
810 <DT><CODE>tab-insert (M-TAB)</CODE>
813 Insert a tab character.
815 <DT><CODE>self-insert (a, b, A, 1, !, ...)</CODE>
820 <DT><CODE>transpose-chars (C-t)</CODE>
823 Drag the character before the cursor forward over
824 the character at the cursor, moving the
825 cursor forward as well. If the insertion point
826 is at the end of the line, then this
827 transposes the last two characters of the line.
828 Negative arguments don't work.
830 <DT><CODE>transpose-words (M-t)</CODE>
833 Drag the word behind the cursor past the word in front of the cursor
834 moving the cursor over that word as well.
836 <DT><CODE>upcase-word (M-u)</CODE>
839 Uppercase the current (or following) word. With a negative argument,
840 uppercase the previous word, but do not move the cursor.
842 <DT><CODE>downcase-word (M-l)</CODE>
845 Lowercase the current (or following) word. With a negative argument,
846 lowercase the previous word, but do not move the cursor.
848 <DT><CODE>capitalize-word (M-c)</CODE>
851 Capitalize the current (or following) word. With a negative argument,
852 capitalize the previous word, but do not move the cursor.
858 <H3><A NAME="SEC11" HREF="readline_toc.html#TOC11">Killing And Yanking</A></H3>
862 <DT><CODE>kill-line (C-k)</CODE>
865 Kill the text from the current cursor position to the end of the line.
867 <DT><CODE>backward-kill-line (C-x Rubout)</CODE>
870 Kill backward to the beginning of the line.
872 <DT><CODE>unix-line-discard (C-u)</CODE>
875 Kill backward from the cursor to the beginning of the current line.
876 The killed text is saved on the kill-ring.
878 <DT><CODE>kill-whole-line ()</CODE>
881 Kill all characters on the current line, no matter where the
882 cursor is. By default, this is unbound.
884 <DT><CODE>kill-word (M-d)</CODE>
887 Kill from the cursor to the end of the current word, or if between
888 words, to the end of the next word. Word boundaries are the same
889 as <CODE>forward-word</CODE>.
891 <DT><CODE>backward-kill-word (M-DEL)</CODE>
894 Kill the word behind the cursor. Word boundaries are the same
895 as <CODE>backward-word</CODE>.
897 <DT><CODE>unix-word-rubout (C-w)</CODE>
900 Kill the word behind the cursor, using white space as a word
901 boundary. The killed text is saved on the kill-ring.
903 <DT><CODE>delete-horizontal-space ()</CODE>
906 Delete all spaces and tabs around point. By default, this is unbound.
908 <DT><CODE>kill-region ()</CODE>
911 Kill the text between the point and the <EM>mark</EM> (saved
912 cursor position). This text is referred to as the <VAR>region</VAR>.
913 By default, this command is unbound.
915 <DT><CODE>copy-region-as-kill ()</CODE>
918 Copy the text in the region to the kill buffer, so it can be yanked
919 right away. By default, this command is unbound.
921 <DT><CODE>copy-backward-word ()</CODE>
924 Copy the word before point to the kill buffer.
925 The word boundaries are the same as <CODE>backward-word</CODE>.
926 By default, this command is unbound.
928 <DT><CODE>copy-forward-word ()</CODE>
931 Copy the word following point to the kill buffer.
932 The word boundaries are the same as <CODE>forward-word</CODE>.
933 By default, this command is unbound.
935 <DT><CODE>yank (C-y)</CODE>
938 Yank the top of the kill ring into the buffer at the current
941 <DT><CODE>yank-pop (M-y)</CODE>
944 Rotate the kill-ring, and yank the new top. You can only do this if
945 the prior command is yank or yank-pop.
950 <H3><A NAME="SEC12" HREF="readline_toc.html#TOC12">Specifying Numeric Arguments</A></H3>
953 <DT><CODE>digit-argument (M-0, M-1, ... M--)</CODE>
956 Add this digit to the argument already accumulating, or start a new
957 argument. <KBD>M--</KBD> starts a negative argument.
959 <DT><CODE>universal-argument ()</CODE>
962 This is another way to specify an argument.
963 If this command is followed by one or more digits, optionally with a
964 leading minus sign, those digits define the argument.
965 If the command is followed by digits, executing <CODE>universal-argument</CODE>
966 again ends the numeric argument, but is otherwise ignored.
967 As a special case, if this command is immediately followed by a
968 character that is neither a digit or minus sign, the argument count
969 for the next command is multiplied by four.
970 The argument count is initially one, so executing this function the
971 first time makes the argument count four, a second time makes the
972 argument count sixteen, and so on.
973 By default, this is not bound to a key.
978 <H3><A NAME="SEC13" HREF="readline_toc.html#TOC13">Letting Readline Type For You</A></H3>
982 <DT><CODE>complete (TAB)</CODE>
985 Attempt to do completion on the text before the cursor. This is
986 application-specific. Generally, if you are typing a filename
987 argument, you can do filename completion; if you are typing a command,
988 you can do command completion; if you are typing in a symbol to GDB, you
989 can do symbol name completion; if you are typing in a variable to Bash,
990 you can do variable name completion, and so on.
992 <DT><CODE>possible-completions (M-?)</CODE>
995 List the possible completions of the text before the cursor.
997 <DT><CODE>insert-completions (M-*)</CODE>
1000 Insert all completions of the text before point that would have
1001 been generated by <CODE>possible-completions</CODE>.
1003 <DT><CODE>menu-complete ()</CODE>
1005 <A NAME="IDX68"></A>
1006 Similar to <CODE>complete</CODE>, but replaces the word to be completed
1007 with a single match from the list of possible completions.
1008 Repeated execution of <CODE>menu-complete</CODE> steps through the list
1009 of possible completions, inserting each match in turn.
1010 At the end of the list of completions, the bell is rung and the
1011 original text is restored.
1012 An argument of <VAR>n</VAR> moves <VAR>n</VAR> positions forward in the list
1013 of matches; a negative argument may be used to move backward
1015 This command is intended to be bound to <CODE>TAB</CODE>, but is unbound
1022 <H3><A NAME="SEC14" HREF="readline_toc.html#TOC14">Keyboard Macros</A></H3>
1025 <DT><CODE>start-kbd-macro (C-x ()</CODE>
1027 <A NAME="IDX69"></A>
1028 Begin saving the characters typed into the current keyboard macro.
1030 <DT><CODE>end-kbd-macro (C-x ))</CODE>
1032 <A NAME="IDX70"></A>
1033 Stop saving the characters typed into the current keyboard macro
1034 and save the definition.
1036 <DT><CODE>call-last-kbd-macro (C-x e)</CODE>
1038 <A NAME="IDX71"></A>
1039 Re-execute the last keyboard macro defined, by making the characters
1040 in the macro appear as if typed at the keyboard.
1046 <H3><A NAME="SEC15" HREF="readline_toc.html#TOC15">Some Miscellaneous Commands</A></H3>
1049 <DT><CODE>re-read-init-file (C-x C-r)</CODE>
1051 <A NAME="IDX72"></A>
1052 Read in the contents of the inputrc file, and incorporate
1053 any bindings or variable assignments found there.
1055 <DT><CODE>abort (C-g)</CODE>
1057 <A NAME="IDX73"></A>
1058 Abort the current editing command and
1059 ring the terminal's bell (subject to the setting of
1060 <CODE>bell-style</CODE>).
1062 <DT><CODE>do-uppercase-version (M-a, M-b, M-<VAR>x</VAR>, ...)</CODE>
1064 <A NAME="IDX74"></A>
1065 If the metafied character <VAR>x</VAR> is lowercase, run the command
1066 that is bound to the corresponding uppercase character.
1068 <DT><CODE>prefix-meta (ESC)</CODE>
1070 <A NAME="IDX75"></A>
1071 Make the next character typed be metafied. This is for keyboards
1072 without a meta key. Typing <SAMP>`ESC f'</SAMP> is equivalent to typing
1075 <DT><CODE>undo (C-_, C-x C-u)</CODE>
1077 <A NAME="IDX76"></A>
1078 Incremental undo, separately remembered for each line.
1080 <DT><CODE>revert-line (M-r)</CODE>
1082 <A NAME="IDX77"></A>
1083 Undo all changes made to this line. This is like executing the <CODE>undo</CODE>
1084 command enough times to get back to the beginning.
1086 <DT><CODE>tilde-expand (M-~)</CODE>
1088 <A NAME="IDX78"></A>
1089 Perform tilde expansion on the current word.
1091 <DT><CODE>set-mark (C-@)</CODE>
1093 <A NAME="IDX79"></A>
1094 Set the mark to the current point. If a
1095 numeric argument is supplied, the mark is set to that position.
1097 <DT><CODE>exchange-point-and-mark (C-x C-x)</CODE>
1099 <A NAME="IDX80"></A>
1100 Swap the point with the mark. The current cursor position is set to
1101 the saved position, and the old cursor position is saved as the mark.
1103 <DT><CODE>character-search (C-])</CODE>
1105 <A NAME="IDX81"></A>
1106 A character is read and point is moved to the next occurrence of that
1107 character. A negative count searches for previous occurrences.
1109 <DT><CODE>character-search-backward (M-C-])</CODE>
1111 <A NAME="IDX82"></A>
1112 A character is read and point is moved to the previous occurrence
1113 of that character. A negative count searches for subsequent
1116 <DT><CODE>insert-comment (M-#)</CODE>
1118 <A NAME="IDX83"></A>
1119 The value of the <CODE>comment-begin</CODE>
1120 variable is inserted at the beginning of the current line,
1121 and the line is accepted as if a newline had been typed.
1123 <DT><CODE>dump-functions ()</CODE>
1125 <A NAME="IDX84"></A>
1126 Print all of the functions and their key bindings to the
1127 Readline output stream. If a numeric argument is supplied,
1128 the output is formatted in such a way that it can be made part
1129 of an <VAR>inputrc</VAR> file. This command is unbound by default.
1131 <DT><CODE>dump-variables ()</CODE>
1133 <A NAME="IDX85"></A>
1134 Print all of the settable variables and their values to the
1135 Readline output stream. If a numeric argument is supplied,
1136 the output is formatted in such a way that it can be made part
1137 of an <VAR>inputrc</VAR> file. This command is unbound by default.
1139 <DT><CODE>dump-macros ()</CODE>
1141 <A NAME="IDX86"></A>
1142 Print all of the Readline key sequences bound to macros and the
1143 strings they ouput. If a numeric argument is supplied,
1144 the output is formatted in such a way that it can be made part
1145 of an <VAR>inputrc</VAR> file. This command is unbound by default.
1151 <H2><A NAME="SEC16" HREF="readline_toc.html#TOC16">Readline vi Mode</A></H2>
1154 While the Readline library does not have a full set of <CODE>vi</CODE>
1155 editing functions, it does contain enough to allow simple editing
1156 of the line. The Readline <CODE>vi</CODE> mode behaves as specified in
1157 the POSIX 1003.2 standard.
1161 In order to switch interactively between <CODE>emacs</CODE> and <CODE>vi</CODE>
1162 editing modes, use the command M-C-j (toggle-editing-mode).
1163 The Readline default is <CODE>emacs</CODE> mode.
1167 When you enter a line in <CODE>vi</CODE> mode, you are already placed in
1168 `insertion' mode, as if you had typed an <SAMP>`i'</SAMP>. Pressing <KBD>ESC</KBD>
1169 switches you into `command' mode, where you can edit the text of the
1170 line with the standard <CODE>vi</CODE> movement keys, move to previous
1171 history lines with <SAMP>`k'</SAMP> and subsequent lines with <SAMP>`j'</SAMP>, and
1178 <H1><A NAME="SEC17" HREF="readline_toc.html#TOC17">Programming with GNU Readline</A></H1>
1181 This chapter describes the interface between the GNU Readline Library and
1182 other programs. If you are a programmer, and you wish to include the
1183 features found in GNU Readline
1184 such as completion, line editing, and interactive history manipulation
1185 in your own programs, this section is for you.
1191 <H2><A NAME="SEC18" HREF="readline_toc.html#TOC18">Basic Behavior</A></H2>
1194 Many programs provide a command line interface, such as <CODE>mail</CODE>,
1195 <CODE>ftp</CODE>, and <CODE>sh</CODE>. For such programs, the default behaviour of
1196 Readline is sufficient. This section describes how to use Readline in
1197 the simplest way possible, perhaps to replace calls in your code to
1198 <CODE>gets()</CODE> or <CODE>fgets ()</CODE>.
1202 <A NAME="IDX87"></A>
1203 <A NAME="IDX88"></A>
1204 The function <CODE>readline ()</CODE> prints a prompt and then reads and returns
1205 a single line of text from the user. The line <CODE>readline</CODE>
1206 returns is allocated with <CODE>malloc ()</CODE>; you should <CODE>free ()</CODE>
1207 the line when you are done with it. The declaration for <CODE>readline</CODE>
1213 <CODE>char *readline (char *<VAR>prompt</VAR>);</CODE>
1220 <CODE>char *line = readline ("Enter a line: ");</CODE>
1224 in order to read a line of text from the user.
1225 The line returned has the final newline removed, so only the
1230 If <CODE>readline</CODE> encounters an <CODE>EOF</CODE> while reading the line, and the
1231 line is empty at that point, then <CODE>(char *)NULL</CODE> is returned.
1232 Otherwise, the line is ended just as if a newline had been typed.
1236 If you want the user to be able to get at the line later, (with
1237 <KBD>C-p</KBD> for example), you must call <CODE>add_history ()</CODE> to save the
1238 line away in a <STRONG>history</STRONG> list of such lines.
1243 <CODE>add_history (line)</CODE>;
1247 For full details on the GNU History Library, see the associated manual.
1251 It is preferable to avoid saving empty lines on the history list, since
1252 users rarely have a burning need to reuse a blank line. Here is
1253 a function which usefully replaces the standard <CODE>gets ()</CODE> library
1254 function, and has the advantage of no static buffer to overflow:
1259 /* A static variable for holding the line. */
1260 static char *line_read = (char *)NULL;
1262 /* Read a string, and return a pointer to it. Returns NULL on EOF. */
1266 /* If the buffer has already been allocated, return the memory
1267 to the free pool. */
1271 line_read = (char *)NULL;
1274 /* Get a line from the user. */
1275 line_read = readline ("");
1277 /* If the line has any text in it, save it on the history. */
1278 if (line_read && *line_read)
1279 add_history (line_read);
1286 This function gives the user the default behaviour of <KBD>TAB</KBD>
1287 completion: completion on file names. If you do not want Readline to
1288 complete on filenames, you can change the binding of the <KBD>TAB</KBD> key
1289 with <CODE>rl_bind_key ()</CODE>.
1294 <CODE>int rl_bind_key (int <VAR>key</VAR>, int (*<VAR>function</VAR>)());</CODE>
1298 <CODE>rl_bind_key ()</CODE> takes two arguments: <VAR>key</VAR> is the character that
1299 you want to bind, and <VAR>function</VAR> is the address of the function to
1300 call when <VAR>key</VAR> is pressed. Binding <KBD>TAB</KBD> to <CODE>rl_insert ()</CODE>
1301 makes <KBD>TAB</KBD> insert itself.
1302 <CODE>rl_bind_key ()</CODE> returns non-zero if <VAR>key</VAR> is not a valid
1303 ASCII character code (between 0 and 255).
1307 Thus, to disable the default <KBD>TAB</KBD> behavior, the following suffices:
1310 <CODE>rl_bind_key ('\t', rl_insert);</CODE>
1314 This code should be executed once at the start of your program; you
1315 might write a function called <CODE>initialize_readline ()</CODE> which
1316 performs this and other desired initializations, such as installing
1317 custom completers (see section <A HREF="readline.html#SEC34">Custom Completers</A>).
1322 <H2><A NAME="SEC19" HREF="readline_toc.html#TOC19">Custom Functions</A></H2>
1325 Readline provides many functions for manipulating the text of
1326 the line, but it isn't possible to anticipate the needs of all
1327 programs. This section describes the various functions and variables
1328 defined within the Readline library which allow a user program to add
1329 customized functionality to Readline.
1335 <H3><A NAME="SEC20" HREF="readline_toc.html#TOC20">The Function Type</A></H3>
1338 For readabilty, we declare a new type of object, called
1339 <STRONG>Function</STRONG>. A <CODE>Function</CODE> is a C function which
1340 returns an <CODE>int</CODE>. The type declaration for <CODE>Function</CODE> is:
1344 <CODE>typedef int Function ();</CODE>
1348 The reason for declaring this new type is to make it easier to write
1349 code describing pointers to C functions. Let us say we had a variable
1350 called <VAR>func</VAR> which was a pointer to a function. Instead of the
1351 classic C declaration
1355 <CODE>int (*)()func;</CODE>
1363 <CODE>Function *func;</CODE>
1367 Similarly, there are
1372 typedef void VFunction ();
1373 typedef char *CPFunction (); and
1374 typedef char **CPPFunction ();
1378 for functions returning no value, <CODE>pointer to char</CODE>, and
1379 <CODE>pointer to pointer to char</CODE>, respectively.
1384 <H3><A NAME="SEC21" HREF="readline_toc.html#TOC21">Writing a New Function</A></H3>
1387 In order to write new functions for Readline, you need to know the
1388 calling conventions for keyboard-invoked functions, and the names of the
1389 variables that describe the current state of the line read so far.
1393 The calling sequence for a command <CODE>foo</CODE> looks like
1398 <CODE>foo (int count, int key)</CODE>
1402 where <VAR>count</VAR> is the numeric argument (or 1 if defaulted) and
1403 <VAR>key</VAR> is the key that invoked this function.
1407 It is completely up to the function as to what should be done with the
1408 numeric argument. Some functions use it as a repeat count, some
1409 as a flag, and others to choose alternate behavior (refreshing the current
1410 line as opposed to refreshing the screen, for example). Some choose to
1411 ignore it. In general, if a
1412 function uses the numeric argument as a repeat count, it should be able
1413 to do something useful with both negative and positive arguments.
1414 At the very least, it should be aware that it can be passed a
1420 <H2><A NAME="SEC22" HREF="readline_toc.html#TOC22">Readline Variables</A></H2>
1423 These variables are available to function writers.
1428 <DT><U>Variable:</U> char * <B>rl_line_buffer</B>
1429 <DD><A NAME="IDX89"></A>
1430 This is the line gathered so far. You are welcome to modify the
1431 contents of the line, but see section <A HREF="readline.html#SEC28">Allowing Undoing</A>.
1437 <DT><U>Variable:</U> int <B>rl_point</B>
1438 <DD><A NAME="IDX90"></A>
1439 The offset of the current cursor position in <CODE>rl_line_buffer</CODE>
1440 (the <EM>point</EM>).
1446 <DT><U>Variable:</U> int <B>rl_end</B>
1447 <DD><A NAME="IDX91"></A>
1448 The number of characters present in <CODE>rl_line_buffer</CODE>. When
1449 <CODE>rl_point</CODE> is at the end of the line, <CODE>rl_point</CODE> and
1450 <CODE>rl_end</CODE> are equal.
1456 <DT><U>Variable:</U> int <B>rl_mark</B>
1457 <DD><A NAME="IDX92"></A>
1458 The mark (saved position) in the current line. If set, the mark
1459 and point define a <EM>region</EM>.
1465 <DT><U>Variable:</U> int <B>rl_done</B>
1466 <DD><A NAME="IDX93"></A>
1467 Setting this to a non-zero value causes Readline to return the current
1474 <DT><U>Variable:</U> int <B>rl_pending_input</B>
1475 <DD><A NAME="IDX94"></A>
1476 Setting this to a value makes it the next keystroke read. This is a
1477 way to stuff a single character into the input stream.
1483 <DT><U>Variable:</U> char * <B>rl_prompt</B>
1484 <DD><A NAME="IDX95"></A>
1485 The prompt Readline uses. This is set from the argument to
1486 <CODE>readline ()</CODE>, and should not be assigned to directly.
1492 <DT><U>Variable:</U> char * <B>rl_library_version</B>
1493 <DD><A NAME="IDX96"></A>
1494 The version number of this revision of the library.
1500 <DT><U>Variable:</U> char * <B>rl_terminal_name</B>
1501 <DD><A NAME="IDX97"></A>
1502 The terminal type, used for initialization.
1508 <DT><U>Variable:</U> char * <B>rl_readline_name</B>
1509 <DD><A NAME="IDX98"></A>
1510 This variable is set to a unique name by each application using Readline.
1511 The value allows conditional parsing of the inputrc file
1512 (see section <A HREF="readline.html#SEC5">Conditional Init Constructs</A>).
1518 <DT><U>Variable:</U> FILE * <B>rl_instream</B>
1519 <DD><A NAME="IDX99"></A>
1520 The stdio stream from which Readline reads input.
1526 <DT><U>Variable:</U> FILE * <B>rl_outstream</B>
1527 <DD><A NAME="IDX100"></A>
1528 The stdio stream to which Readline performs output.
1534 <DT><U>Variable:</U> Function * <B>rl_startup_hook</B>
1535 <DD><A NAME="IDX101"></A>
1536 If non-zero, this is the address of a function to call just
1537 before <CODE>readline</CODE> prints the first prompt.
1543 <DT><U>Variable:</U> Function * <B>rl_event_hook</B>
1544 <DD><A NAME="IDX102"></A>
1545 If non-zero, this is the address of a function to call periodically
1546 when readline is waiting for terminal input.
1552 <DT><U>Variable:</U> Function * <B>rl_getc_function</B>
1553 <DD><A NAME="IDX103"></A>
1554 If non-zero, <CODE>readline</CODE> will call indirectly through this pointer
1555 to get a character from the input stream. By default, it is set to
1556 <CODE>rl_getc</CODE>, the default <CODE>readline</CODE> character input function
1557 (see section <A HREF="readline.html#SEC31">Utility Functions</A>).
1563 <DT><U>Variable:</U> VFunction * <B>rl_redisplay_function</B>
1564 <DD><A NAME="IDX104"></A>
1565 If non-zero, <CODE>readline</CODE> will call indirectly through this pointer
1566 to update the display with the current contents of the editing buffer.
1567 By default, it is set to <CODE>rl_redisplay</CODE>, the default <CODE>readline</CODE>
1568 redisplay function (see section <A HREF="readline.html#SEC29">Redisplay</A>).
1574 <DT><U>Variable:</U> Keymap <B>rl_executing_keymap</B>
1575 <DD><A NAME="IDX105"></A>
1576 This variable is set to the keymap (see section <A HREF="readline.html#SEC25">Selecting a Keymap</A>) in which the
1577 currently executing readline function was found.
1583 <DT><U>Variable:</U> Keymap <B>rl_binding_keymap</B>
1584 <DD><A NAME="IDX106"></A>
1585 This variable is set to the keymap (see section <A HREF="readline.html#SEC25">Selecting a Keymap</A>) in which the
1586 last key binding occurred.
1592 <H2><A NAME="SEC23" HREF="readline_toc.html#TOC23">Readline Convenience Functions</A></H2>
1596 <H3><A NAME="SEC24" HREF="readline_toc.html#TOC24">Naming a Function</A></H3>
1599 The user can dynamically change the bindings of keys while using
1600 Readline. This is done by representing the function with a descriptive
1601 name. The user is able to type the descriptive name when referring to
1602 the function. Thus, in an init file, one might find
1607 Meta-Rubout: backward-kill-word
1611 This binds the keystroke <KBD>Meta-Rubout</KBD> to the function
1612 <EM>descriptively</EM> named <CODE>backward-kill-word</CODE>. You, as the
1613 programmer, should bind the functions you write to descriptive names as
1614 well. Readline provides a function for doing that:
1619 <DT><U>Function:</U> int <B>rl_add_defun</B> <I>(char *name, Function *function, int key)</I>
1620 <DD><A NAME="IDX107"></A>
1621 Add <VAR>name</VAR> to the list of named functions. Make <VAR>function</VAR> be
1622 the function that gets called. If <VAR>key</VAR> is not -1, then bind it to
1623 <VAR>function</VAR> using <CODE>rl_bind_key ()</CODE>.
1628 Using this function alone is sufficient for most applications. It is
1629 the recommended way to add a few functions to the default functions that
1630 Readline has built in. If you need to do something other
1631 than adding a function to Readline, you may need to use the
1632 underlying functions described below.
1637 <H3><A NAME="SEC25" HREF="readline_toc.html#TOC25">Selecting a Keymap</A></H3>
1640 Key bindings take place on a <STRONG>keymap</STRONG>. The keymap is the
1641 association between the keys that the user types and the functions that
1642 get run. You can make your own keymaps, copy existing keymaps, and tell
1643 Readline which keymap to use.
1648 <DT><U>Function:</U> Keymap <B>rl_make_bare_keymap</B> <I>()</I>
1649 <DD><A NAME="IDX108"></A>
1650 Returns a new, empty keymap. The space for the keymap is allocated with
1651 <CODE>malloc ()</CODE>; you should <CODE>free ()</CODE> it when you are done.
1657 <DT><U>Function:</U> Keymap <B>rl_copy_keymap</B> <I>(Keymap map)</I>
1658 <DD><A NAME="IDX109"></A>
1659 Return a new keymap which is a copy of <VAR>map</VAR>.
1665 <DT><U>Function:</U> Keymap <B>rl_make_keymap</B> <I>()</I>
1666 <DD><A NAME="IDX110"></A>
1667 Return a new keymap with the printing characters bound to rl_insert,
1668 the lowercase Meta characters bound to run their equivalents, and
1669 the Meta digits bound to produce numeric arguments.
1675 <DT><U>Function:</U> void <B>rl_discard_keymap</B> <I>(Keymap keymap)</I>
1676 <DD><A NAME="IDX111"></A>
1677 Free the storage associated with <VAR>keymap</VAR>.
1682 Readline has several internal keymaps. These functions allow you to
1683 change which keymap is active.
1688 <DT><U>Function:</U> Keymap <B>rl_get_keymap</B> <I>()</I>
1689 <DD><A NAME="IDX112"></A>
1690 Returns the currently active keymap.
1696 <DT><U>Function:</U> void <B>rl_set_keymap</B> <I>(Keymap keymap)</I>
1697 <DD><A NAME="IDX113"></A>
1698 Makes <VAR>keymap</VAR> the currently active keymap.
1704 <DT><U>Function:</U> Keymap <B>rl_get_keymap_by_name</B> <I>(char *name)</I>
1705 <DD><A NAME="IDX114"></A>
1706 Return the keymap matching <VAR>name</VAR>. <VAR>name</VAR> is one which would
1707 be supplied in a <CODE>set keymap</CODE> inputrc line (@xref{Readline Init File}).
1713 <DT><U>Function:</U> char * <B>rl_get_keymap_name</B> <I>(Keymap keymap)</I>
1714 <DD><A NAME="IDX115"></A>
1715 Return the name matching <VAR>keymap</VAR>. <VAR>name</VAR> is one which would
1716 be supplied in a <CODE>set keymap</CODE> inputrc line (@xref{Readline Init File}).
1722 <H3><A NAME="SEC26" HREF="readline_toc.html#TOC26">Binding Keys</A></H3>
1725 You associate keys with functions through the keymap. Readline has
1726 several internal keymaps: <CODE>emacs_standard_keymap</CODE>,
1727 <CODE>emacs_meta_keymap</CODE>, <CODE>emacs_ctlx_keymap</CODE>,
1728 <CODE>vi_movement_keymap</CODE>, and <CODE>vi_insertion_keymap</CODE>.
1729 <CODE>emacs_standard_keymap</CODE> is the default, and the examples in
1730 this manual assume that.
1734 These functions manage key bindings.
1739 <DT><U>Function:</U> int <B>rl_bind_key</B> <I>(int key, Function *function)</I>
1740 <DD><A NAME="IDX116"></A>
1741 Binds <VAR>key</VAR> to <VAR>function</VAR> in the currently active keymap.
1742 Returns non-zero in the case of an invalid <VAR>key</VAR>.
1748 <DT><U>Function:</U> int <B>rl_bind_key_in_map</B> <I>(int key, Function *function, Keymap map)</I>
1749 <DD><A NAME="IDX117"></A>
1750 Bind <VAR>key</VAR> to <VAR>function</VAR> in <VAR>map</VAR>. Returns non-zero in the case
1751 of an invalid <VAR>key</VAR>.
1757 <DT><U>Function:</U> int <B>rl_unbind_key</B> <I>(int key)</I>
1758 <DD><A NAME="IDX118"></A>
1759 Bind <VAR>key</VAR> to the null function in the currently active keymap.
1760 Returns non-zero in case of error.
1766 <DT><U>Function:</U> int <B>rl_unbind_key_in_map</B> <I>(int key, Keymap map)</I>
1767 <DD><A NAME="IDX119"></A>
1768 Bind <VAR>key</VAR> to the null function in <VAR>map</VAR>.
1769 Returns non-zero in case of error.
1775 <DT><U>Function:</U> int <B>rl_unbind_function_in_map</B> <I>(Function *function, Keymap map)</I>
1776 <DD><A NAME="IDX120"></A>
1777 Unbind all keys that execute <VAR>function</VAR> in <VAR>map</VAR>.
1783 <DT><U>Function:</U> int <B>rl_unbind_command_in_map</B> <I>(char *command, Keymap map)</I>
1784 <DD><A NAME="IDX121"></A>
1785 Unbind all keys that are bound to <VAR>command</VAR> in <VAR>map</VAR>.
1791 <DT><U>Function:</U> int <B>rl_generic_bind</B> <I>(int type, char *keyseq, char *data, Keymap map)</I>
1792 <DD><A NAME="IDX122"></A>
1793 Bind the key sequence represented by the string <VAR>keyseq</VAR> to the arbitrary
1794 pointer <VAR>data</VAR>. <VAR>type</VAR> says what kind of data is pointed to by
1795 <VAR>data</VAR>; this can be a function (<CODE>ISFUNC</CODE>), a macro
1796 (<CODE>ISMACR</CODE>), or a keymap (<CODE>ISKMAP</CODE>). This makes new keymaps as
1797 necessary. The initial keymap in which to do bindings is <VAR>map</VAR>.
1803 <DT><U>Function:</U> int <B>rl_parse_and_bind</B> <I>(char *line)</I>
1804 <DD><A NAME="IDX123"></A>
1805 Parse <VAR>line</VAR> as if it had been read from the <CODE>inputrc</CODE> file and
1806 perform any key bindings and variable assignments found
1807 (@xref{Readline Init File}).
1813 <DT><U>Function:</U> int <B>rl_read_init_file</B> <I>(char *filename)</I>
1814 <DD><A NAME="IDX124"></A>
1815 Read keybindings and variable assignments from <VAR>filename</VAR>
1816 (@xref{Readline Init File}).
1822 <H3><A NAME="SEC27" HREF="readline_toc.html#TOC27">Associating Function Names and Bindings</A></H3>
1825 These functions allow you to find out what keys invoke named functions
1826 and the functions invoked by a particular key sequence.
1831 <DT><U>Function:</U> Function * <B>rl_named_function</B> <I>(char *name)</I>
1832 <DD><A NAME="IDX125"></A>
1833 Return the function with name <VAR>name</VAR>.
1839 <DT><U>Function:</U> Function * <B>rl_function_of_keyseq</B> <I>(char *keyseq, Keymap map, int *type)</I>
1840 <DD><A NAME="IDX126"></A>
1841 Return the function invoked by <VAR>keyseq</VAR> in keymap <VAR>map</VAR>.
1842 If <VAR>map</VAR> is NULL, the current keymap is used. If <VAR>type</VAR> is
1843 not NULL, the type of the object is returned in it (one of <CODE>ISFUNC</CODE>,
1844 <CODE>ISKMAP</CODE>, or <CODE>ISMACR</CODE>).
1850 <DT><U>Function:</U> char ** <B>rl_invoking_keyseqs</B> <I>(Function *function)</I>
1851 <DD><A NAME="IDX127"></A>
1852 Return an array of strings representing the key sequences used to
1853 invoke <VAR>function</VAR> in the current keymap.
1859 <DT><U>Function:</U> char ** <B>rl_invoking_keyseqs_in_map</B> <I>(Function *function, Keymap map)</I>
1860 <DD><A NAME="IDX128"></A>
1861 Return an array of strings representing the key sequences used to
1862 invoke <VAR>function</VAR> in the keymap <VAR>map</VAR>.
1868 <DT><U>Function:</U> void <B>rl_function_dumper</B> <I>(int readable)</I>
1869 <DD><A NAME="IDX129"></A>
1870 Print the readline function names and the key sequences currently
1871 bound to them to <CODE>rl_outstream</CODE>. If <VAR>readable</VAR> is non-zero,
1872 the list is formatted in such a way that it can be made part of an
1873 <CODE>inputrc</CODE> file and re-read.
1879 <DT><U>Function:</U> void <B>rl_list_funmap_names</B> <I>()</I>
1880 <DD><A NAME="IDX130"></A>
1881 Print the names of all bindable Readline functions to <CODE>rl_outstream</CODE>.
1887 <H3><A NAME="SEC28" HREF="readline_toc.html#TOC28">Allowing Undoing</A></H3>
1890 Supporting the undo command is a painless thing, and makes your
1891 functions much more useful. It is certainly easy to try
1892 something if you know you can undo it. I could use an undo function for
1897 If your function simply inserts text once, or deletes text once, and
1898 uses <CODE>rl_insert_text ()</CODE> or <CODE>rl_delete_text ()</CODE> to do it, then
1899 undoing is already done for you automatically.
1903 If you do multiple insertions or multiple deletions, or any combination
1904 of these operations, you should group them together into one operation.
1905 This is done with <CODE>rl_begin_undo_group ()</CODE> and
1906 <CODE>rl_end_undo_group ()</CODE>.
1910 The types of events that can be undone are:
1915 enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
1919 Notice that <CODE>UNDO_DELETE</CODE> means to insert some text, and
1920 <CODE>UNDO_INSERT</CODE> means to delete some text. That is, the undo code
1921 tells undo what to undo, not how to undo it. <CODE>UNDO_BEGIN</CODE> and
1922 <CODE>UNDO_END</CODE> are tags added by <CODE>rl_begin_undo_group ()</CODE> and
1923 <CODE>rl_end_undo_group ()</CODE>.
1928 <DT><U>Function:</U> int <B>rl_begin_undo_group</B> <I>()</I>
1929 <DD><A NAME="IDX131"></A>
1930 Begins saving undo information in a group construct. The undo
1931 information usually comes from calls to <CODE>rl_insert_text ()</CODE> and
1932 <CODE>rl_delete_text ()</CODE>, but could be the result of calls to
1933 <CODE>rl_add_undo ()</CODE>.
1939 <DT><U>Function:</U> int <B>rl_end_undo_group</B> <I>()</I>
1940 <DD><A NAME="IDX132"></A>
1941 Closes the current undo group started with <CODE>rl_begin_undo_group
1942 ()</CODE>. There should be one call to <CODE>rl_end_undo_group ()</CODE>
1943 for each call to <CODE>rl_begin_undo_group ()</CODE>.
1949 <DT><U>Function:</U> void <B>rl_add_undo</B> <I>(enum undo_code what, int start, int end, char *text)</I>
1950 <DD><A NAME="IDX133"></A>
1951 Remember how to undo an event (according to <VAR>what</VAR>). The affected
1952 text runs from <VAR>start</VAR> to <VAR>end</VAR>, and encompasses <VAR>text</VAR>.
1958 <DT><U>Function:</U> void <B>free_undo_list</B> <I>()</I>
1959 <DD><A NAME="IDX134"></A>
1960 Free the existing undo list.
1966 <DT><U>Function:</U> int <B>rl_do_undo</B> <I>()</I>
1967 <DD><A NAME="IDX135"></A>
1968 Undo the first thing on the undo list. Returns <CODE>0</CODE> if there was
1969 nothing to undo, non-zero if something was undone.
1974 Finally, if you neither insert nor delete text, but directly modify the
1975 existing text (e.g., change its case), call <CODE>rl_modifying ()</CODE>
1976 once, just before you modify the text. You must supply the indices of
1977 the text range that you are going to modify.
1982 <DT><U>Function:</U> int <B>rl_modifying</B> <I>(int start, int end)</I>
1983 <DD><A NAME="IDX136"></A>
1984 Tell Readline to save the text between <VAR>start</VAR> and <VAR>end</VAR> as a
1985 single undo unit. It is assumed that you will subsequently modify
1992 <H3><A NAME="SEC29" HREF="readline_toc.html#TOC29">Redisplay</A></H3>
1996 <DT><U>Function:</U> void <B>rl_redisplay</B> <I>()</I>
1997 <DD><A NAME="IDX137"></A>
1998 Change what's displayed on the screen to reflect the current contents
1999 of <CODE>rl_line_buffer</CODE>.
2005 <DT><U>Function:</U> int <B>rl_forced_update_display</B> <I>()</I>
2006 <DD><A NAME="IDX138"></A>
2007 Force the line to be updated and redisplayed, whether or not
2008 Readline thinks the screen display is correct.
2014 <DT><U>Function:</U> int <B>rl_on_new_line</B> <I>()</I>
2015 <DD><A NAME="IDX139"></A>
2016 Tell the update routines that we have moved onto a new (empty) line,
2017 usually after ouputting a newline.
2023 <DT><U>Function:</U> int <B>rl_reset_line_state</B> <I>()</I>
2024 <DD><A NAME="IDX140"></A>
2025 Reset the display state to a clean state and redisplay the current line
2026 starting on a new line.
2032 <DT><U>Function:</U> int <B>rl_message</B> <I>(va_alist)</I>
2033 <DD><A NAME="IDX141"></A>
2034 The arguments are a string as would be supplied to <CODE>printf</CODE>. The
2035 resulting string is displayed in the <STRONG>echo area</STRONG>. The echo area
2036 is also used to display numeric arguments and search strings.
2042 <DT><U>Function:</U> int <B>rl_clear_message</B> <I>()</I>
2043 <DD><A NAME="IDX142"></A>
2044 Clear the message in the echo area.
2050 <H3><A NAME="SEC30" HREF="readline_toc.html#TOC30">Modifying Text</A></H3>
2054 <DT><U>Function:</U> int <B>rl_insert_text</B> <I>(char *text)</I>
2055 <DD><A NAME="IDX143"></A>
2056 Insert <VAR>text</VAR> into the line at the current cursor position.
2062 <DT><U>Function:</U> int <B>rl_delete_text</B> <I>(int start, int end)</I>
2063 <DD><A NAME="IDX144"></A>
2064 Delete the text between <VAR>start</VAR> and <VAR>end</VAR> in the current line.
2070 <DT><U>Function:</U> char * <B>rl_copy_text</B> <I>(int start, int end)</I>
2071 <DD><A NAME="IDX145"></A>
2072 Return a copy of the text between <VAR>start</VAR> and <VAR>end</VAR> in
2079 <DT><U>Function:</U> int <B>rl_kill_text</B> <I>(int start, int end)</I>
2080 <DD><A NAME="IDX146"></A>
2081 Copy the text between <VAR>start</VAR> and <VAR>end</VAR> in the current line
2082 to the kill ring, appending or prepending to the last kill if the
2083 last command was a kill command. The text is deleted.
2084 If <VAR>start</VAR> is less than <VAR>end</VAR>,
2085 the text is appended, otherwise prepended. If the last command was
2086 not a kill, a new kill ring slot is used.
2092 <H3><A NAME="SEC31" HREF="readline_toc.html#TOC31">Utility Functions</A></H3>
2096 <DT><U>Function:</U> int <B>rl_read_key</B> <I>()</I>
2097 <DD><A NAME="IDX147"></A>
2098 Return the next character available. This handles input inserted into
2099 the input stream via <VAR>pending input</VAR> (see section <A HREF="readline.html#SEC22">Readline Variables</A>)
2100 and <CODE>rl_stuff_char ()</CODE>, macros, and characters read from the keyboard.
2106 <DT><U>Function:</U> int <B>rl_getc</B> <I>(FILE *)</I>
2107 <DD><A NAME="IDX148"></A>
2108 Return the next character available from the keyboard.
2114 <DT><U>Function:</U> int <B>rl_stuff_char</B> <I>(int c)</I>
2115 <DD><A NAME="IDX149"></A>
2116 Insert <VAR>c</VAR> into the Readline input stream. It will be "read"
2117 before Readline attempts to read characters from the terminal with
2118 <CODE>rl_read_key ()</CODE>.
2124 <DT><U>Function:</U> rl_extend_line_buffer <B>(int</B> <I>len)</I>
2125 <DD><A NAME="IDX150"></A>
2126 Ensure that <CODE>rl_line_buffer</CODE> has enough space to hold <VAR>len</VAR>
2127 characters, possibly reallocating it if necessary.
2133 <DT><U>Function:</U> int <B>rl_initialize</B> <I>()</I>
2134 <DD><A NAME="IDX151"></A>
2135 Initialize or re-initialize Readline's internal state.
2141 <DT><U>Function:</U> int <B>rl_reset_terminal</B> <I>(char *terminal_name)</I>
2142 <DD><A NAME="IDX152"></A>
2143 Reinitialize Readline's idea of the terminal settings using
2144 <VAR>terminal_name</VAR> as the terminal type (e.g., <CODE>vt100</CODE>).
2150 <DT><U>Function:</U> int <B>alphabetic</B> <I>(int c)</I>
2151 <DD><A NAME="IDX153"></A>
2152 Return 1 if <VAR>c</VAR> is an alphabetic character.
2158 <DT><U>Function:</U> int <B>numeric</B> <I>(int c)</I>
2159 <DD><A NAME="IDX154"></A>
2160 Return 1 if <VAR>c</VAR> is a numeric character.
2166 <DT><U>Function:</U> int <B>ding</B> <I>()</I>
2167 <DD><A NAME="IDX155"></A>
2168 Ring the terminal bell, obeying the setting of <CODE>bell-style</CODE>.
2173 The following are implemented as macros, defined in <CODE>chartypes.h</CODE>.
2178 <DT><U>Function:</U> int <B>uppercase_p</B> <I>(int c)</I>
2179 <DD><A NAME="IDX156"></A>
2180 Return 1 if <VAR>c</VAR> is an uppercase alphabetic character.
2186 <DT><U>Function:</U> int <B>lowercase_p</B> <I>(int c)</I>
2187 <DD><A NAME="IDX157"></A>
2188 Return 1 if <VAR>c</VAR> is a lowercase alphabetic character.
2194 <DT><U>Function:</U> int <B>digit_p</B> <I>(int c)</I>
2195 <DD><A NAME="IDX158"></A>
2196 Return 1 if <VAR>c</VAR> is a numeric character.
2202 <DT><U>Function:</U> int <B>to_upper</B> <I>(int c)</I>
2203 <DD><A NAME="IDX159"></A>
2204 If <VAR>c</VAR> is a lowercase alphabetic character, return the corresponding
2205 uppercase character.
2211 <DT><U>Function:</U> int <B>to_lower</B> <I>(int c)</I>
2212 <DD><A NAME="IDX160"></A>
2213 If <VAR>c</VAR> is an uppercase alphabetic character, return the corresponding
2214 lowercase character.
2220 <DT><U>Function:</U> int <B>digit_value</B> <I>(int c)</I>
2221 <DD><A NAME="IDX161"></A>
2222 If <VAR>c</VAR> is a number, return the value it represents.
2228 <H3><A NAME="SEC32" HREF="readline_toc.html#TOC32">Alternate Interface</A></H3>
2231 An alternate interface is available to plain <CODE>readline()</CODE>. Some
2232 applications need to interleave keyboard I/O with file, device, or
2233 window system I/O, typically by using a main loop to <CODE>select()</CODE>
2234 on various file descriptors. To accomodate this need, readline can
2235 also be invoked as a `callback' function from an event loop. There
2236 are functions available to make this easy.
2241 <DT><U>Function:</U> void <B>rl_callback_handler_install</B> <I>(char *prompt, Vfunction *lhandler)</I>
2242 <DD><A NAME="IDX162"></A>
2243 Set up the terminal for readline I/O and display the initial
2244 expanded value of <VAR>prompt</VAR>. Save the value of <VAR>lhandler</VAR> to
2245 use as a callback when a complete line of input has been entered.
2251 <DT><U>Function:</U> void <B>rl_callback_read_char</B> <I>()</I>
2252 <DD><A NAME="IDX163"></A>
2253 Whenever an application determines that keyboard input is available, it
2254 should call <CODE>rl_callback_read_char()</CODE>, which will read the next
2255 character from the current input source. If that character completes the
2256 line, <CODE>rl_callback_read_char</CODE> will invoke the <VAR>lhandler</VAR>
2257 function saved by <CODE>rl_callback_handler_install</CODE> to process the
2258 line. <CODE>EOF</CODE> is indicated by calling <VAR>lhandler</VAR> with a
2259 <CODE>NULL</CODE> line.
2265 <DT><U>Function:</U> void <B>rl_callback_handler_remove</B> <I>()</I>
2266 <DD><A NAME="IDX164"></A>
2267 Restore the terminal to its initial state and remove the line handler.
2268 This may be called from within a callback as well as independently.
2274 <H3><A NAME="SEC33" HREF="readline_toc.html#TOC33">An Example</A></H3>
2277 Here is a function which changes lowercase characters to their uppercase
2278 equivalents, and uppercase characters to lowercase. If
2279 this function was bound to <SAMP>`M-c'</SAMP>, then typing <SAMP>`M-c'</SAMP> would
2280 change the case of the character under point. Typing <SAMP>`M-1 0 M-c'</SAMP>
2281 would change the case of the following 10 characters, leaving the cursor on
2282 the last character changed.
2287 /* Invert the case of the COUNT following characters. */
2289 invert_case_line (count, key)
2292 register int start, end, i;
2296 if (rl_point >= rl_end)
2307 /* Find the end of the range to modify. */
2308 end = start + (count * direction);
2310 /* Force it to be within range. */
2311 if (end > rl_end)
2313 else if (end < 0)
2319 if (start > end)
2326 /* Tell readline that we are modifying the line, so it will save
2327 the undo information. */
2328 rl_modifying (start, end);
2330 for (i = start; i != end; i++)
2332 if (uppercase_p (rl_line_buffer[i]))
2333 rl_line_buffer[i] = to_lower (rl_line_buffer[i]);
2334 else if (lowercase_p (rl_line_buffer[i]))
2335 rl_line_buffer[i] = to_upper (rl_line_buffer[i]);
2337 /* Move point to on top of the last character changed. */
2338 rl_point = (direction == 1) ? end - 1 : start;
2345 <H2><A NAME="SEC34" HREF="readline_toc.html#TOC34">Custom Completers</A></H2>
2348 Typically, a program that reads commands from the user has a way of
2349 disambiguating commands and data. If your program is one of these, then
2350 it can provide completion for commands, data, or both.
2351 The following sections describe how your program and Readline
2352 cooperate to provide this service.
2358 <H3><A NAME="SEC35" HREF="readline_toc.html#TOC35">How Completing Works</A></H3>
2361 In order to complete some text, the full list of possible completions
2362 must be available. That is, it is not possible to accurately
2363 expand a partial word without knowing all of the possible words
2364 which make sense in that context. The Readline library provides
2365 the user interface to completion, and two of the most common
2366 completion functions: filename and username. For completing other types
2367 of text, you must write your own completion function. This section
2368 describes exactly what such functions must do, and provides an example.
2372 There are three major functions used to perform completion:
2379 The user-interface function <CODE>rl_complete ()</CODE>. This function is
2380 called with the same arguments as other Readline
2381 functions intended for interactive use: <VAR>count</VAR> and
2382 <VAR>invoking_key</VAR>. It isolates the word to be completed and calls
2383 <CODE>completion_matches ()</CODE> to generate a list of possible completions.
2384 It then either lists the possible completions, inserts the possible
2385 completions, or actually performs the
2386 completion, depending on which behavior is desired.
2390 The internal function <CODE>completion_matches ()</CODE> uses your
2391 <STRONG>generator</STRONG> function to generate the list of possible matches, and
2392 then returns the array of these matches. You should place the address
2393 of your generator function in <CODE>rl_completion_entry_function</CODE>.
2397 The generator function is called repeatedly from
2398 <CODE>completion_matches ()</CODE>, returning a string each time. The
2399 arguments to the generator function are <VAR>text</VAR> and <VAR>state</VAR>.
2400 <VAR>text</VAR> is the partial word to be completed. <VAR>state</VAR> is zero the
2401 first time the function is called, allowing the generator to perform
2402 any necessary initialization, and a positive non-zero integer for
2403 each subsequent call. When the generator function returns
2404 <CODE>(char *)NULL</CODE> this signals <CODE>completion_matches ()</CODE> that there are
2405 no more possibilities left. Usually the generator function computes the
2406 list of possible completions when <VAR>state</VAR> is zero, and returns them
2407 one at a time on subsequent calls. Each string the generator function
2408 returns as a match must be allocated with <CODE>malloc()</CODE>; Readline
2409 frees the strings when it has finished with them.
2415 <DT><U>Function:</U> int <B>rl_complete</B> <I>(int ignore, int invoking_key)</I>
2416 <DD><A NAME="IDX165"></A>
2417 Complete the word at or before point. You have supplied the function
2418 that does the initial simple matching selection algorithm (see
2419 <CODE>completion_matches ()</CODE>). The default is to do filename completion.
2425 <DT><U>Variable:</U> Function * <B>rl_completion_entry_function</B>
2426 <DD><A NAME="IDX166"></A>
2427 This is a pointer to the generator function for <CODE>completion_matches
2428 ()</CODE>. If the value of <CODE>rl_completion_entry_function</CODE> is
2429 <CODE>(Function *)NULL</CODE> then the default filename generator function,
2430 <CODE>filename_completion_function ()</CODE>, is used.
2436 <H3><A NAME="SEC36" HREF="readline_toc.html#TOC36">Completion Functions</A></H3>
2439 Here is the complete list of callable completion functions present in
2445 <DT><U>Function:</U> int <B>rl_complete_internal</B> <I>(int what_to_do)</I>
2446 <DD><A NAME="IDX167"></A>
2447 Complete the word at or before point. <VAR>what_to_do</VAR> says what to do
2448 with the completion. A value of <SAMP>`?'</SAMP> means list the possible
2449 completions. <SAMP>`TAB'</SAMP> means do standard completion. <SAMP>`*'</SAMP> means
2450 insert all of the possible completions. <SAMP>`!'</SAMP> means to display
2451 all of the possible completions, if there is more than one, as well as
2452 performing partial completion.
2458 <DT><U>Function:</U> int <B>rl_complete</B> <I>(int ignore, int invoking_key)</I>
2459 <DD><A NAME="IDX168"></A>
2460 Complete the word at or before point. You have supplied the function
2461 that does the initial simple matching selection algorithm (see
2462 <CODE>completion_matches ()</CODE> and <CODE>rl_completion_entry_function</CODE>).
2463 The default is to do filename
2464 completion. This calls <CODE>rl_complete_internal ()</CODE> with an
2465 argument depending on <VAR>invoking_key</VAR>.
2471 <DT><U>Function:</U> int <B>rl_possible_completions</B> <I>(int count, int invoking_key))</I>
2472 <DD><A NAME="IDX169"></A>
2473 List the possible completions. See description of <CODE>rl_complete
2474 ()</CODE>. This calls <CODE>rl_complete_internal ()</CODE> with an argument of
2481 <DT><U>Function:</U> int <B>rl_insert_completions</B> <I>(int count, int invoking_key))</I>
2482 <DD><A NAME="IDX170"></A>
2483 Insert the list of possible completions into the line, deleting the
2484 partially-completed word. See description of <CODE>rl_complete ()</CODE>.
2485 This calls <CODE>rl_complete_internal ()</CODE> with an argument of <SAMP>`*'</SAMP>.
2491 <DT><U>Function:</U> char ** <B>completion_matches</B> <I>(char *text, CPFunction *entry_func)</I>
2492 <DD><A NAME="IDX171"></A>
2493 Returns an array of <CODE>(char *)</CODE> which is a list of completions for
2494 <VAR>text</VAR>. If there are no completions, returns <CODE>(char **)NULL</CODE>.
2495 The first entry in the returned array is the substitution for <VAR>text</VAR>.
2496 The remaining entries are the possible completions. The array is
2497 terminated with a <CODE>NULL</CODE> pointer.
2501 <VAR>entry_func</VAR> is a function of two args, and returns a
2502 <CODE>(char *)</CODE>. The first argument is <VAR>text</VAR>. The second is a
2503 state argument; it is zero on the first call, and non-zero on subsequent
2504 calls. <VAR>entry_func</VAR> returns a <CODE>NULL</CODE> pointer to the caller
2505 when there are no more matches.
2511 <DT><U>Function:</U> char * <B>filename_completion_function</B> <I>(char *text, int state)</I>
2512 <DD><A NAME="IDX172"></A>
2513 A generator function for filename completion in the general case. Note
2514 that completion in Bash is a little different because of all
2515 the pathnames that must be followed when looking up completions for a
2516 command. The Bash source is a useful reference for writing custom
2517 completion functions.
2523 <DT><U>Function:</U> char * <B>username_completion_function</B> <I>(char *text, int state)</I>
2524 <DD><A NAME="IDX173"></A>
2525 A completion generator for usernames. <VAR>text</VAR> contains a partial
2526 username preceded by a random character (usually <SAMP>`~'</SAMP>). As with all
2527 completion generators, <VAR>state</VAR> is zero on the first call and non-zero
2528 for subsequent calls.
2534 <H3><A NAME="SEC37" HREF="readline_toc.html#TOC37">Completion Variables</A></H3>
2538 <DT><U>Variable:</U> Function * <B>rl_completion_entry_function</B>
2539 <DD><A NAME="IDX174"></A>
2540 A pointer to the generator function for <CODE>completion_matches ()</CODE>.
2541 <CODE>NULL</CODE> means to use <CODE>filename_entry_function ()</CODE>, the default
2548 <DT><U>Variable:</U> CPPFunction * <B>rl_attempted_completion_function</B>
2549 <DD><A NAME="IDX175"></A>
2550 A pointer to an alternative function to create matches.
2551 The function is called with <VAR>text</VAR>, <VAR>start</VAR>, and <VAR>end</VAR>.
2552 <VAR>start</VAR> and <VAR>end</VAR> are indices in <CODE>rl_line_buffer</CODE> saying
2553 what the boundaries of <VAR>text</VAR> are. If this function exists and
2554 returns <CODE>NULL</CODE>, or if this variable is set to <CODE>NULL</CODE>, then
2555 <CODE>rl_complete ()</CODE> will call the value of
2556 <CODE>rl_completion_entry_function</CODE> to generate matches, otherwise the
2557 array of strings returned will be used.
2563 <DT><U>Variable:</U> CPFunction * <B>rl_filename_quoting_function</B>
2564 <DD><A NAME="IDX176"></A>
2565 A pointer to a function that will quote a filename in an application-
2566 specific fashion. This is called if filename completion is being
2567 attempted and one of the characters in <CODE>rl_filename_quote_characters</CODE>
2568 appears in a completed filename. The function is called with
2569 <VAR>text</VAR>, <VAR>match_type</VAR>, and <VAR>quote_pointer</VAR>. The <VAR>text</VAR>
2570 is the filename to be quoted. The <VAR>match_type</VAR> is either
2571 <CODE>SINGLE_MATCH</CODE>, if there is only one completion match, or
2572 <CODE>MULT_MATCH</CODE>. Some functions use this to decide whether or not to
2573 insert a closing quote character. The <VAR>quote_pointer</VAR> is a pointer
2574 to any opening quote character the user typed. Some functions choose
2575 to reset this character.
2581 <DT><U>Variable:</U> CPFunction * <B>rl_filename_dequoting_function</B>
2582 <DD><A NAME="IDX177"></A>
2583 A pointer to a function that will remove application-specific quoting
2584 characters from a filename before completion is attempted, so those
2585 characters do not interfere with matching the text against names in
2586 the filesystem. It is called with <VAR>text</VAR>, the text of the word
2587 to be dequoted, and <VAR>quote_char</VAR>, which is the quoting character
2588 that delimits the filename (usually <SAMP>`''</SAMP> or <SAMP>`"'</SAMP>). If
2589 <VAR>quote_char</VAR> is zero, the filename was not in an embedded string.
2595 <DT><U>Variable:</U> Function * <B>rl_char_is_quoted_p</B>
2596 <DD><A NAME="IDX178"></A>
2597 A pointer to a function to call that determines whether or not a specific
2598 character in the line buffer is quoted, according to whatever quoting
2599 mechanism the program calling readline uses. The function is called with
2600 two arguments: <VAR>text</VAR>, the text of the line, and <VAR>index</VAR>, the
2601 index of the character in the line. It is used to decide whether a
2602 character found in <CODE>rl_completer_word_break_characters</CODE> should be
2603 used to break words for the completer.
2609 <DT><U>Variable:</U> int <B>rl_completion_query_items</B>
2610 <DD><A NAME="IDX179"></A>
2611 Up to this many items will be displayed in response to a
2612 possible-completions call. After that, we ask the user if she is sure
2613 she wants to see them all. The default value is 100.
2619 <DT><U>Variable:</U> char * <B>rl_basic_word_break_characters</B>
2620 <DD><A NAME="IDX180"></A>
2621 The basic list of characters that signal a break between words for the
2622 completer routine. The default value of this variable is the characters
2623 which break words for completion in Bash, i.e.,
2624 <CODE>" \t\n\"\\'`@$><=;|&{("</CODE>.
2630 <DT><U>Variable:</U> char * <B>rl_basic_quote_characters</B>
2631 <DD><A NAME="IDX181"></A>
2632 List of quote characters which can cause a word break.
2638 <DT><U>Variable:</U> char * <B>rl_completer_word_break_characters</B>
2639 <DD><A NAME="IDX182"></A>
2640 The list of characters that signal a break between words for
2641 <CODE>rl_complete_internal ()</CODE>. The default list is the value of
2642 <CODE>rl_basic_word_break_characters</CODE>.
2648 <DT><U>Variable:</U> char * <B>rl_completer_quote_characters</B>
2649 <DD><A NAME="IDX183"></A>
2650 List of characters which can be used to quote a substring of the line.
2651 Completion occurs on the entire substring, and within the substring
2652 <CODE>rl_completer_word_break_characters</CODE> are treated as any other character,
2653 unless they also appear within this list.
2659 <DT><U>Variable:</U> char * <B>rl_filename_quote_characters</B>
2660 <DD><A NAME="IDX184"></A>
2661 A list of characters that cause a filename to be quoted by the completer
2662 when they appear in a completed filename. The default is the null string.
2668 <DT><U>Variable:</U> char * <B>rl_special_prefixes</B>
2669 <DD><A NAME="IDX185"></A>
2670 The list of characters that are word break characters, but should be
2671 left in <VAR>text</VAR> when it is passed to the completion function.
2672 Programs can use this to help determine what kind of completing to do.
2673 For instance, Bash sets this variable to "$@" so that it can complete
2674 shell variables and hostnames.
2680 <DT><U>Variable:</U> int <B>rl_completion_append_character</B>
2681 <DD><A NAME="IDX186"></A>
2682 When a single completion alternative matches at the end of the command
2683 line, this character is appended to the inserted completion text. The
2684 default is a space character (<SAMP>` '</SAMP>). Setting this to the null
2685 character (<SAMP>`\0'</SAMP>) prevents anything being appended automatically.
2686 This can be changed in custom completion functions to
2687 provide the "most sensible word separator character" according to
2688 an application-specific command line syntax specification.
2694 <DT><U>Variable:</U> int <B>rl_ignore_completion_duplicates</B>
2695 <DD><A NAME="IDX187"></A>
2696 If non-zero, then disallow duplicates in the matches. Default is 1.
2702 <DT><U>Variable:</U> int <B>rl_filename_completion_desired</B>
2703 <DD><A NAME="IDX188"></A>
2704 Non-zero means that the results of the matches are to be treated as
2705 filenames. This is <EM>always</EM> zero on entry, and can only be changed
2706 within a completion entry generator function. If it is set to a non-zero
2707 value, directory names have a slash appended and Readline attempts to
2708 quote completed filenames if they contain any embedded word break
2715 <DT><U>Variable:</U> int <B>rl_filename_quoting_desired</B>
2716 <DD><A NAME="IDX189"></A>
2717 Non-zero means that the results of the matches are to be quoted using
2718 double quotes (or an application-specific quoting mechanism) if the
2719 completed filename contains any characters in
2720 <CODE>rl_filename_quote_chars</CODE>. This is <EM>always</EM> non-zero
2721 on entry, and can only be changed within a completion entry generator
2722 function. The quoting is effected via a call to the function pointed to
2723 by <CODE>rl_filename_quoting_function</CODE>.
2729 <DT><U>Variable:</U> int <B>rl_inhibit_completion</B>
2730 <DD><A NAME="IDX190"></A>
2731 If this variable is non-zero, completion is inhibit<ed. The completion
2732 character will be inserted as any other bound to <CODE>self-insert</CODE>.
2738 <DT><U>Variable:</U> Function * <B>rl_ignore_some_completions_function</B>
2739 <DD><A NAME="IDX191"></A>
2740 This function, if defined, is called by the completer when real filename
2741 completion is done, after all the matching names have been generated.
2742 It is passed a <CODE>NULL</CODE> terminated array of matches.
2743 The first element (<CODE>matches[0]</CODE>) is the
2744 maximal substring common to all matches. This function can
2745 re-arrange the list of matches as required, but each element deleted
2746 from the array must be freed.
2752 <DT><U>Variable:</U> Function * <B>rl_directory_completion_hook</B>
2753 <DD><A NAME="IDX192"></A>
2754 This function, if defined, is allowed to modify the directory portion
2755 of filenames Readline completes. It is called with the address of a
2756 string (the current directory name) as an argument. It could be used
2757 to expand symbolic links or shell variables in pathnames.
2763 <H3><A NAME="SEC38" HREF="readline_toc.html#TOC38">A Short Completion Example</A></H3>
2766 Here is a small application demonstrating the use of the GNU Readline
2767 library. It is called <CODE>fileman</CODE>, and the source code resides in
2768 <TT>`examples/fileman.c'</TT>. This sample application provides
2769 completion of command names, line editing features, and access to the
2775 /* fileman.c -- A tiny application which demonstrates how to use the
2776 GNU Readline library. This application interactively allows users
2777 to manipulate files and their modes. */
2779 #include <stdio.h>
2780 #include <sys/types.h>
2781 #include <sys/file.h>
2782 #include <sys/stat.h>
2783 #include <sys/errno.h>
2785 #include <readline/readline.h>
2786 #include <readline/history.h>
2788 extern char *getwd ();
2789 extern char *xmalloc ();
2791 /* The names of functions that actually do the manipulation. */
2792 int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
2793 int com_delete (), com_help (), com_cd (), com_quit ();
2795 /* A structure which contains information on the commands this program
2799 char *name; /* User printable name of the function. */
2800 Function *func; /* Function to call to do the job. */
2801 char *doc; /* Documentation for this function. */
2804 COMMAND commands[] = {
2805 { "cd", com_cd, "Change to directory DIR" },
2806 { "delete", com_delete, "Delete FILE" },
2807 { "help", com_help, "Display this text" },
2808 { "?", com_help, "Synonym for `help'" },
2809 { "list", com_list, "List files in DIR" },
2810 { "ls", com_list, "Synonym for `list'" },
2811 { "pwd", com_pwd, "Print the current working directory" },
2812 { "quit", com_quit, "Quit using Fileman" },
2813 { "rename", com_rename, "Rename FILE to NEWNAME" },
2814 { "stat", com_stat, "Print out statistics on FILE" },
2815 { "view", com_view, "View the contents of FILE" },
2816 { (char *)NULL, (Function *)NULL, (char *)NULL }
2819 /* Forward declarations. */
2820 char *stripwhite ();
2821 COMMAND *find_command ();
2823 /* The name of this program, as taken from argv[0]. */
2826 /* When non-zero, this global means the user is done using this program. */
2835 r = xmalloc (strlen (s) + 1);
2848 initialize_readline (); /* Bind our completer. */
2850 /* Loop reading and executing lines until the user quits. */
2851 for ( ; done == 0; )
2853 line = readline ("FileMan: ");
2858 /* Remove leading and trailing whitespace from the line.
2859 Then, if there is anything left, add it to the history list
2861 s = stripwhite (line);
2874 /* Execute a command line. */
2883 /* Isolate the command word. */
2885 while (line[i] && whitespace (line[i]))
2889 while (line[i] && !whitespace (line[i]))
2895 command = find_command (word);
2899 fprintf (stderr, "%s: No such command for FileMan.\n", word);
2903 /* Get argument to command, if any. */
2904 while (whitespace (line[i]))
2909 /* Call the function. */
2910 return ((*(command->func)) (word));
2913 /* Look up NAME as the name of a command, and return a pointer to that
2914 command. Return a NULL pointer if NAME isn't a command name. */
2921 for (i = 0; commands[i].name; i++)
2922 if (strcmp (name, commands[i].name) == 0)
2923 return (&commands[i]);
2925 return ((COMMAND *)NULL);
2928 /* Strip whitespace from the start and end of STRING. Return a pointer
2934 register char *s, *t;
2936 for (s = string; whitespace (*s); s++)
2942 t = s + strlen (s) - 1;
2943 while (t > s && whitespace (*t))
2950 /* **************************************************************** */
2952 /* Interface to Readline Completion */
2954 /* **************************************************************** */
2956 char *command_generator ();
2957 char **fileman_completion ();
2959 /* Tell the GNU Readline library how to complete. We want to try to complete
2960 on command names if this is the first word in the line, or on filenames
2962 initialize_readline ()
2964 /* Allow conditional parsing of the ~/.inputrc file. */
2965 rl_readline_name = "FileMan";
2967 /* Tell the completer that we want a crack first. */
2968 rl_attempted_completion_function = (CPPFunction *)fileman_completion;
2971 /* Attempt to complete on the contents of TEXT. START and END bound the
2972 region of rl_line_buffer that contains the word to complete. TEXT is
2973 the word to complete. We can use the entire contents of rl_line_buffer
2974 in case we want to do some simple parsing. Return the array of matches,
2975 or NULL if there aren't any. */
2977 fileman_completion (text, start, end)
2983 matches = (char **)NULL;
2985 /* If this word is at the start of the line, then it is a command
2986 to complete. Otherwise it is the name of a file in the current
2989 matches = completion_matches (text, command_generator);
2994 /* Generator function for command completion. STATE lets us know whether
2995 to start from scratch; without any state (i.e. STATE == 0), then we
2996 start at the top of the list. */
2998 command_generator (text, state)
3002 static int list_index, len;
3005 /* If this is a new word to complete, initialize now. This includes
3006 saving the length of TEXT for efficiency, and initializing the index
3011 len = strlen (text);
3014 /* Return the next name which partially matches from the command list. */
3015 while (name = commands[list_index].name)
3019 if (strncmp (name, text, len) == 0)
3020 return (dupstr(name));
3023 /* If no names matched, then return NULL. */
3024 return ((char *)NULL);
3027 /* **************************************************************** */
3029 /* FileMan Commands */
3031 /* **************************************************************** */
3033 /* String to pass to system (). This is for the LIST, VIEW and RENAME
3035 static char syscom[1024];
3037 /* List the file(s) named in arg. */
3044 sprintf (syscom, "ls -FClg %s", arg);
3045 return (system (syscom));
3051 if (!valid_argument ("view", arg))
3054 sprintf (syscom, "more %s", arg);
3055 return (system (syscom));
3061 too_dangerous ("rename");
3070 if (!valid_argument ("stat", arg))
3073 if (stat (arg, &finfo) == -1)
3079 printf ("Statistics for `%s':\n", arg);
3081 printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
3083 (finfo.st_nlink == 1) ? "" : "s",
3085 (finfo.st_size == 1) ? "" : "s");
3086 printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
3087 printf (" Last access at: %s", ctime (&finfo.st_atime));
3088 printf (" Last modified at: %s", ctime (&finfo.st_mtime));
3095 too_dangerous ("delete");
3099 /* Print out help for ARG, or for all of the commands if ARG is
3107 for (i = 0; commands[i].name; i++)
3109 if (!*arg || (strcmp (arg, commands[i].name) == 0))
3111 printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
3118 printf ("No commands match `%s'. Possibilties are:\n", arg);
3120 for (i = 0; commands[i].name; i++)
3122 /* Print in six columns. */
3129 printf ("%s\t", commands[i].name);
3139 /* Change to the directory ARG. */
3143 if (chdir (arg) == -1)
3153 /* Print out the current working directory. */
3162 printf ("Error getting pwd: %s\n", dir);
3166 printf ("Current directory is %s\n", dir);
3170 /* The user wishes to quit using this program. Just set DONE non-zero. */
3178 /* Function which tells you that you can't do this. */
3179 too_dangerous (caller)
3183 "%s: Too dangerous for me to distribute. Write it yourself.\n",
3187 /* Return non-zero if ARG is a valid argument for CALLER, else print
3188 an error message and return zero. */
3190 valid_argument (caller, arg)
3195 fprintf (stderr, "%s: Argument required.\n", caller);
3205 <H1><A NAME="SEC39" HREF="readline_toc.html#TOC39">Concept Index</A></H1>
3209 <LI><A HREF="readline.html#IDX1">interaction, readline</A>
3213 <LI><A HREF="readline.html#IDX88">readline, function</A>
3219 <H1><A NAME="SEC40" HREF="readline_toc.html#TOC40">Function and Variable Index</A></H1>
3223 <LI><A HREF="readline.html#IDX150">(int</A>
3227 <LI><A HREF="readline.html#IDX73">abort (C-g)</A>
3228 <LI><A HREF="readline.html#IDX26">accept-line (Newline, Return)</A>
3229 <LI><A HREF="readline.html#IDX153">alphabetic</A>
3233 <LI><A HREF="readline.html#IDX21">backward-char (C-b)</A>
3234 <LI><A HREF="readline.html#IDX40">backward-delete-char (Rubout)</A>
3235 <LI><A HREF="readline.html#IDX50">backward-kill-line (C-x Rubout)</A>
3236 <LI><A HREF="readline.html#IDX54">backward-kill-word (M-DEL)</A>
3237 <LI><A HREF="readline.html#IDX23">backward-word (M-b)</A>
3238 <LI><A HREF="readline.html#IDX29">beginning-of-history (M-&#60;)</A>
3239 <LI><A HREF="readline.html#IDX18">beginning-of-line (C-a)</A>
3240 <LI><A HREF="readline.html#IDX2">bell-style</A>
3244 <LI><A HREF="readline.html#IDX71">call-last-kbd-macro (C-x e)</A>
3245 <LI><A HREF="readline.html#IDX48">capitalize-word (M-c)</A>
3246 <LI><A HREF="readline.html#IDX81">character-search (C-])</A>
3247 <LI><A HREF="readline.html#IDX82">character-search-backward (M-C-])</A>
3248 <LI><A HREF="readline.html#IDX24">clear-screen (C-l)</A>
3249 <LI><A HREF="readline.html#IDX3">comment-begin</A>
3250 <LI><A HREF="readline.html#IDX65">complete (TAB)</A>
3251 <LI><A HREF="readline.html#IDX4">completion-query-items</A>
3252 <LI><A HREF="readline.html#IDX171">completion_matches</A>
3253 <LI><A HREF="readline.html#IDX5">convert-meta</A>
3254 <LI><A HREF="readline.html#IDX59">copy-backward-word ()</A>
3255 <LI><A HREF="readline.html#IDX60">copy-forward-word ()</A>
3256 <LI><A HREF="readline.html#IDX58">copy-region-as-kill ()</A>
3260 <LI><A HREF="readline.html#IDX39">delete-char (C-d)</A>
3261 <LI><A HREF="readline.html#IDX56">delete-horizontal-space ()</A>
3262 <LI><A HREF="readline.html#IDX63">digit-argument (M-0, M-1, ... M--)</A>
3263 <LI><A HREF="readline.html#IDX158">digit_p</A>
3264 <LI><A HREF="readline.html#IDX161">digit_value</A>
3265 <LI><A HREF="readline.html#IDX155">ding</A>
3266 <LI><A HREF="readline.html#IDX6">disable-completion</A>
3267 <LI><A HREF="readline.html#IDX74">do-uppercase-version (M-a, M-b, M-<VAR>x</VAR>, ...)</A>
3268 <LI><A HREF="readline.html#IDX47">downcase-word (M-l)</A>
3269 <LI><A HREF="readline.html#IDX84">dump-functions ()</A>
3270 <LI><A HREF="readline.html#IDX86">dump-macros ()</A>
3271 <LI><A HREF="readline.html#IDX85">dump-variables ()</A>
3275 <LI><A HREF="readline.html#IDX7">editing-mode</A>
3276 <LI><A HREF="readline.html#IDX8">enable-keypad</A>
3277 <LI><A HREF="readline.html#IDX70">end-kbd-macro (C-x ))</A>
3278 <LI><A HREF="readline.html#IDX30">end-of-history (M-&#62;)</A>
3279 <LI><A HREF="readline.html#IDX19">end-of-line (C-e)</A>
3280 <LI><A HREF="readline.html#IDX80">exchange-point-and-mark (C-x C-x)</A>
3281 <LI><A HREF="readline.html#IDX9">expand-tilde</A>
3285 <LI><A HREF="readline.html#IDX172">filename_completion_function</A>
3286 <LI><A HREF="readline.html#IDX20">forward-char (C-f)</A>
3287 <LI><A HREF="readline.html#IDX32">forward-search-history (C-s)</A>
3288 <LI><A HREF="readline.html#IDX22">forward-word (M-f)</A>
3289 <LI><A HREF="readline.html#IDX134">free_undo_list</A>
3293 <LI><A HREF="readline.html#IDX36">history-search-backward ()</A>
3294 <LI><A HREF="readline.html#IDX35">history-search-forward ()</A>
3295 <LI><A HREF="readline.html#IDX10">horizontal-scroll-mode</A>
3299 <LI><A HREF="readline.html#IDX13">input-meta</A>
3300 <LI><A HREF="readline.html#IDX83">insert-comment (M-#)</A>
3301 <LI><A HREF="readline.html#IDX67">insert-completions (M-*)</A>
3305 <LI><A HREF="readline.html#IDX11">keymap</A>
3306 <LI><A HREF="readline.html#IDX49">kill-line (C-k)</A>
3307 <LI><A HREF="readline.html#IDX57">kill-region ()</A>
3308 <LI><A HREF="readline.html#IDX52">kill-whole-line ()</A>
3309 <LI><A HREF="readline.html#IDX53">kill-word (M-d)</A>
3313 <LI><A HREF="readline.html#IDX157">lowercase_p</A>
3317 <LI><A HREF="readline.html#IDX12">mark-modified-lines</A>
3318 <LI><A HREF="readline.html#IDX68">menu-complete ()</A>
3319 <LI><A HREF="readline.html#IDX14">meta-flag</A>
3323 <LI><A HREF="readline.html#IDX28">next-history (C-n)</A>
3324 <LI><A HREF="readline.html#IDX34">non-incremental-forward-search-history (M-n)</A>
3325 <LI><A HREF="readline.html#IDX33">non-incremental-reverse-search-history (M-p)</A>
3326 <LI><A HREF="readline.html#IDX154">numeric</A>
3330 <LI><A HREF="readline.html#IDX15">output-meta</A>
3334 <LI><A HREF="readline.html#IDX66">possible-completions (M-?)</A>
3335 <LI><A HREF="readline.html#IDX75">prefix-meta (ESC)</A>
3336 <LI><A HREF="readline.html#IDX27">previous-history (C-p)</A>
3340 <LI><A HREF="readline.html#IDX41">quoted-insert (C-q, C-v)</A>
3344 <LI><A HREF="readline.html#IDX72">re-read-init-file (C-x C-r)</A>
3345 <LI><A HREF="readline.html#IDX87">readline</A>
3346 <LI><A HREF="readline.html#IDX25">redraw-current-line ()</A>
3347 <LI><A HREF="readline.html#IDX31">reverse-search-history (C-r)</A>
3348 <LI><A HREF="readline.html#IDX77">revert-line (M-r)</A>
3349 <LI><A HREF="readline.html#IDX107">rl_add_defun</A>
3350 <LI><A HREF="readline.html#IDX133">rl_add_undo</A>
3351 <LI><A HREF="readline.html#IDX175">rl_attempted_completion_function</A>
3352 <LI><A HREF="readline.html#IDX181">rl_basic_quote_characters</A>
3353 <LI><A HREF="readline.html#IDX180">rl_basic_word_break_characters</A>
3354 <LI><A HREF="readline.html#IDX131">rl_begin_undo_group</A>
3355 <LI><A HREF="readline.html#IDX116">rl_bind_key</A>
3356 <LI><A HREF="readline.html#IDX117">rl_bind_key_in_map</A>
3357 <LI><A HREF="readline.html#IDX106">rl_binding_keymap</A>
3358 <LI><A HREF="readline.html#IDX162">rl_callback_handler_install</A>
3359 <LI><A HREF="readline.html#IDX164">rl_callback_handler_remove</A>
3360 <LI><A HREF="readline.html#IDX163">rl_callback_read_char</A>
3361 <LI><A HREF="readline.html#IDX178">rl_char_is_quoted_p</A>
3362 <LI><A HREF="readline.html#IDX142">rl_clear_message</A>
3363 <LI><A HREF="readline.html#IDX165">rl_complete</A>, <A HREF="rlman.html#IDX168">rl_complete</A>
3364 <LI><A HREF="readline.html#IDX167">rl_complete_internal</A>
3365 <LI><A HREF="readline.html#IDX183">rl_completer_quote_characters</A>
3366 <LI><A HREF="readline.html#IDX182">rl_completer_word_break_characters</A>
3367 <LI><A HREF="readline.html#IDX186">rl_completion_append_character</A>
3368 <LI><A HREF="readline.html#IDX166">rl_completion_entry_function</A>, <A HREF="rlman.html#IDX174">rl_completion_entry_function</A>
3369 <LI><A HREF="readline.html#IDX179">rl_completion_query_items</A>
3370 <LI><A HREF="readline.html#IDX109">rl_copy_keymap</A>
3371 <LI><A HREF="readline.html#IDX145">rl_copy_text</A>
3372 <LI><A HREF="readline.html#IDX144">rl_delete_text</A>
3373 <LI><A HREF="readline.html#IDX192">rl_directory_completion_hook</A>
3374 <LI><A HREF="readline.html#IDX111">rl_discard_keymap</A>
3375 <LI><A HREF="readline.html#IDX135">rl_do_undo</A>
3376 <LI><A HREF="readline.html#IDX93">rl_done</A>
3377 <LI><A HREF="readline.html#IDX91">rl_end</A>
3378 <LI><A HREF="readline.html#IDX132">rl_end_undo_group</A>
3379 <LI><A HREF="readline.html#IDX102">rl_event_hook</A>
3380 <LI><A HREF="readline.html#IDX105">rl_executing_keymap</A>
3381 <LI><A HREF="readline.html#IDX188">rl_filename_completion_desired</A>
3382 <LI><A HREF="readline.html#IDX177">rl_filename_dequoting_function</A>
3383 <LI><A HREF="readline.html#IDX184">rl_filename_quote_characters</A>
3384 <LI><A HREF="readline.html#IDX189">rl_filename_quoting_desired</A>
3385 <LI><A HREF="readline.html#IDX176">rl_filename_quoting_function</A>
3386 <LI><A HREF="readline.html#IDX138">rl_forced_update_display</A>
3387 <LI><A HREF="readline.html#IDX129">rl_function_dumper</A>
3388 <LI><A HREF="readline.html#IDX126">rl_function_of_keyseq</A>
3389 <LI><A HREF="readline.html#IDX122">rl_generic_bind</A>
3390 <LI><A HREF="readline.html#IDX112">rl_get_keymap</A>
3391 <LI><A HREF="readline.html#IDX114">rl_get_keymap_by_name</A>
3392 <LI><A HREF="readline.html#IDX115">rl_get_keymap_name</A>
3393 <LI><A HREF="readline.html#IDX148">rl_getc</A>
3394 <LI><A HREF="readline.html#IDX103">rl_getc_function</A>
3395 <LI><A HREF="readline.html#IDX187">rl_ignore_completion_duplicates</A>
3396 <LI><A HREF="readline.html#IDX191">rl_ignore_some_completions_function</A>
3397 <LI><A HREF="readline.html#IDX190">rl_inhibit_completion</A>
3398 <LI><A HREF="readline.html#IDX151">rl_initialize</A>
3399 <LI><A HREF="readline.html#IDX170">rl_insert_completions</A>
3400 <LI><A HREF="readline.html#IDX143">rl_insert_text</A>
3401 <LI><A HREF="readline.html#IDX99">rl_instream</A>
3402 <LI><A HREF="readline.html#IDX127">rl_invoking_keyseqs</A>
3403 <LI><A HREF="readline.html#IDX128">rl_invoking_keyseqs_in_map</A>
3404 <LI><A HREF="readline.html#IDX146">rl_kill_text</A>
3405 <LI><A HREF="readline.html#IDX96">rl_library_version</A>
3406 <LI><A HREF="readline.html#IDX89">rl_line_buffer</A>
3407 <LI><A HREF="readline.html#IDX130">rl_list_funmap_names</A>
3408 <LI><A HREF="readline.html#IDX108">rl_make_bare_keymap</A>
3409 <LI><A HREF="readline.html#IDX110">rl_make_keymap</A>
3410 <LI><A HREF="readline.html#IDX92">rl_mark</A>
3411 <LI><A HREF="readline.html#IDX141">rl_message</A>
3412 <LI><A HREF="readline.html#IDX136">rl_modifying</A>
3413 <LI><A HREF="readline.html#IDX125">rl_named_function</A>
3414 <LI><A HREF="readline.html#IDX139">rl_on_new_line</A>
3415 <LI><A HREF="readline.html#IDX100">rl_outstream</A>
3416 <LI><A HREF="readline.html#IDX123">rl_parse_and_bind</A>
3417 <LI><A HREF="readline.html#IDX94">rl_pending_input</A>
3418 <LI><A HREF="readline.html#IDX90">rl_point</A>
3419 <LI><A HREF="readline.html#IDX169">rl_possible_completions</A>
3420 <LI><A HREF="readline.html#IDX95">rl_prompt</A>
3421 <LI><A HREF="readline.html#IDX124">rl_read_init_file</A>
3422 <LI><A HREF="readline.html#IDX147">rl_read_key</A>
3423 <LI><A HREF="readline.html#IDX98">rl_readline_name</A>
3424 <LI><A HREF="readline.html#IDX137">rl_redisplay</A>
3425 <LI><A HREF="readline.html#IDX104">rl_redisplay_function</A>
3426 <LI><A HREF="readline.html#IDX140">rl_reset_line_state</A>
3427 <LI><A HREF="readline.html#IDX152">rl_reset_terminal</A>
3428 <LI><A HREF="readline.html#IDX113">rl_set_keymap</A>
3429 <LI><A HREF="readline.html#IDX185">rl_special_prefixes</A>
3430 <LI><A HREF="readline.html#IDX101">rl_startup_hook</A>
3431 <LI><A HREF="readline.html#IDX149">rl_stuff_char</A>
3432 <LI><A HREF="readline.html#IDX97">rl_terminal_name</A>
3433 <LI><A HREF="readline.html#IDX121">rl_unbind_command_in_map</A>
3434 <LI><A HREF="readline.html#IDX120">rl_unbind_function_in_map</A>
3435 <LI><A HREF="readline.html#IDX118">rl_unbind_key</A>
3436 <LI><A HREF="readline.html#IDX119">rl_unbind_key_in_map</A>
3440 <LI><A HREF="readline.html#IDX43">self-insert (a, b, A, 1, !, ...)</A>
3441 <LI><A HREF="readline.html#IDX79">set-mark (C-@)</A>
3442 <LI><A HREF="readline.html#IDX16">show-all-if-ambiguous</A>
3443 <LI><A HREF="readline.html#IDX69">start-kbd-macro (C-x ()</A>
3447 <LI><A HREF="readline.html#IDX42">tab-insert (M-TAB)</A>
3448 <LI><A HREF="readline.html#IDX78">tilde-expand (M-~)</A>
3449 <LI><A HREF="readline.html#IDX160">to_lower</A>
3450 <LI><A HREF="readline.html#IDX159">to_upper</A>
3451 <LI><A HREF="readline.html#IDX44">transpose-chars (C-t)</A>
3452 <LI><A HREF="readline.html#IDX45">transpose-words (M-t)</A>
3456 <LI><A HREF="readline.html#IDX76">undo (C-_, C-x C-u)</A>
3457 <LI><A HREF="readline.html#IDX64">universal-argument ()</A>
3458 <LI><A HREF="readline.html#IDX51">unix-line-discard (C-u)</A>
3459 <LI><A HREF="readline.html#IDX55">unix-word-rubout (C-w)</A>
3460 <LI><A HREF="readline.html#IDX46">upcase-word (M-u)</A>
3461 <LI><A HREF="readline.html#IDX156">uppercase_p</A>
3462 <LI><A HREF="readline.html#IDX173">username_completion_function</A>
3466 <LI><A HREF="readline.html#IDX17">visible-stats</A>
3470 <LI><A HREF="readline.html#IDX61">yank (C-y)</A>
3471 <LI><A HREF="readline.html#IDX38">yank-last-arg (M-., M-_)</A>
3472 <LI><A HREF="readline.html#IDX37">yank-nth-arg (M-C-y)</A>
3473 <LI><A HREF="readline.html#IDX62">yank-pop (M-y)</A>
3478 This document was generated on 2 April 1998 using the
3479 <A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A>
3480 translator version 1.51.</P>