home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / readline.zip / readline-2.1 / doc / readline.info (.txt) < prev    next >
GNU Info File  |  1997-06-03  |  107KB  |  2,287 lines

  1. This is Info file readline.info, produced by Makeinfo-1.55 from the
  2. input file /usr/homes/chet/src/bash/readline-2.1/doc/rlman.texinfo.
  3.    This document describes the GNU Readline Library, a utility which
  4. aids in the consistency of user interface across discrete programs that
  5. need to provide a command line interface.
  6.    Copyright (C) 1988, 1991 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice pare
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided that
  12. the entire resulting derived work is distributed under the terms of a
  13. permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that this permission notice may be stated in a
  17. translation approved by the Foundation.
  18. File: readline.info,  Node: Top,  Next: Command Line Editing,  Prev: (DIR),  Up: (DIR)
  19. GNU Readline Library
  20. ********************
  21.    This document describes the GNU Readline Library, a utility which
  22. aids in the consistency of user interface across discrete programs that
  23. need to provide a command line interface.
  24. * Menu:
  25. * Command Line Editing::       GNU Readline User's Manual.
  26. * Programming with GNU Readline::  GNU Readline Programmer's Manual.
  27. * Concept Index::           Index of concepts described in this manual.
  28. * Function and Variable Index::       Index of externally visible functions
  29.                    and variables.
  30. File: readline.info,  Node: Command Line Editing,  Next: Programming with GNU Readline,  Prev: Top,  Up: Top
  31. Command Line Editing
  32. ********************
  33.    This chapter describes the basic features of the GNU command line
  34. editing interface.
  35. * Menu:
  36. * Introduction and Notation::    Notation used in this text.
  37. * Readline Interaction::    The minimum set of commands for editing a line.
  38. * Readline Init File::        Customizing Readline from a user's view.
  39. * Bindable Readline Commands::    A description of most of the Readline commands
  40.                 available for binding
  41. * Readline vi Mode::        A short description of how to make Readline
  42.                 behave like the vi editor.
  43. File: readline.info,  Node: Introduction and Notation,  Next: Readline Interaction,  Up: Command Line Editing
  44. Introduction to Line Editing
  45. ============================
  46.    The following paragraphs describe the notation used to represent
  47. keystrokes.
  48.    The text C-k is read as `Control-K' and describes the character
  49. produced when the k key is pressed while the Control key is depressed.
  50.    The text M-k is read as `Meta-K' and describes the character
  51. produced when the meta key (if you have one) is depressed, and the k
  52. key is pressed.  If you do not have a meta key, the identical keystroke
  53. can be generated by typing ESC first, and then typing k.  Either
  54. process is known as "metafying" the k key.
  55.    The text M-C-k is read as `Meta-Control-k' and describes the
  56. character produced by "metafying" C-k.
  57.    In addition, several keys have their own names.  Specifically, DEL,
  58. ESC, LFD, SPC, RET, and TAB all stand for themselves when seen in this
  59. text, or in an init file (*note Readline Init File::.).
  60. File: readline.info,  Node: Readline Interaction,  Next: Readline Init File,  Prev: Introduction and Notation,  Up: Command Line Editing
  61. Readline Interaction
  62. ====================
  63.    Often during an interactive session you type in a long line of text,
  64. only to notice that the first word on the line is misspelled.  The
  65. Readline library gives you a set of commands for manipulating the text
  66. as you type it in, allowing you to just fix your typo, and not forcing
  67. you to retype the majority of the line.  Using these editing commands,
  68. you move the cursor to the place that needs correction, and delete or
  69. insert the text of the corrections.  Then, when you are satisfied with
  70. the line, you simply press RETURN.  You do not have to be at the end of
  71. the line to press RETURN; the entire line is accepted regardless of the
  72. location of the cursor within the line.
  73. * Menu:
  74. * Readline Bare Essentials::    The least you need to know about Readline.
  75. * Readline Movement Commands::    Moving about the input line.
  76. * Readline Killing Commands::    How to delete text, and how to get it back!
  77. * Readline Arguments::        Giving numeric arguments to commands.
  78. * Searching::            Searching through previous lines.
  79. File: readline.info,  Node: Readline Bare Essentials,  Next: Readline Movement Commands,  Up: Readline Interaction
  80. Readline Bare Essentials
  81. ------------------------
  82.    In order to enter characters into the line, simply type them.  The
  83. typed character appears where the cursor was, and then the cursor moves
  84. one space to the right.  If you mistype a character, you can use your
  85. erase character to back up and delete the mistyped character.
  86.    Sometimes you may miss typing a character that you wanted to type,
  87. and not notice your error until you have typed several other
  88. characters.  In that case, you can type C-b to move the cursor to the
  89. left, and then correct your mistake.  Afterwards, you can move the
  90. cursor to the right with C-f.
  91.    When you add text in the middle of a line, you will notice that
  92. characters to the right of the cursor are `pushed over' to make room
  93. for the text that you have inserted.  Likewise, when you delete text
  94. behind the cursor, characters to the right of the cursor are `pulled
  95. back' to fill in the blank space created by the removal of the text.  A
  96. list of the basic bare essentials for editing the text of an input line
  97. follows.
  98.      Move back one character.
  99.      Move forward one character.
  100.      Delete the character to the left of the cursor.
  101.      Delete the character underneath the cursor.
  102. Printing characters
  103.      Insert the character into the line at the cursor.
  104.      Undo the last thing that you did.  You can undo all the way back
  105.      to an empty line.
  106. File: readline.info,  Node: Readline Movement Commands,  Next: Readline Killing Commands,  Prev: Readline Bare Essentials,  Up: Readline Interaction
  107. Readline Movement Commands
  108. --------------------------
  109.    The above table describes the most basic possible keystrokes that
  110. you need in order to do editing of the input line.  For your
  111. convenience, many other commands have been added in addition to C-b,
  112. C-f, C-d, and DEL.  Here are some commands for moving more rapidly
  113. about the line.
  114.      Move to the start of the line.
  115.      Move to the end of the line.
  116.      Move forward a word.
  117.      Move backward a word.
  118.      Clear the screen, reprinting the current line at the top.
  119.    Notice how C-f moves forward a character, while M-f moves forward a
  120. word.  It is a loose convention that control keystrokes operate on
  121. characters while meta keystrokes operate on words.
  122. File: readline.info,  Node: Readline Killing Commands,  Next: Readline Arguments,  Prev: Readline Movement Commands,  Up: Readline Interaction
  123. Readline Killing Commands
  124. -------------------------
  125.    "Killing" text means to delete the text from the line, but to save
  126. it away for later use, usually by "yanking" (re-inserting) it back into
  127. the line.  If the description for a command says that it `kills' text,
  128. then you can be sure that you can get the text back in a different (or
  129. the same) place later.
  130.    When you use a kill command, the text is saved in a "kill-ring".
  131. Any number of consecutive kills save all of the killed text together, so
  132. that when you yank it back, you get it all.  The kill ring is not line
  133. specific; the text that you killed on a previously typed line is
  134. available to be yanked back later, when you are typing another line.
  135.    Here is the list of commands for killing text.
  136.      Kill the text from the current cursor position to the end of the
  137.      line.
  138.      Kill from the cursor to the end of the current word, or if between
  139.      words, to the end of the next word.
  140. M-DEL
  141.      Kill from the cursor the start of the previous word, or if between
  142.      words, to the start of the previous word.
  143.      Kill from the cursor to the previous whitespace.  This is
  144.      different than M-DEL because the word boundaries differ.
  145.    And, here is how to "yank" the text back into the line.  Yanking
  146. means to copy the most-recently-killed text from the kill buffer.
  147.      Yank the most recently killed text back into the buffer at the
  148.      cursor.
  149.      Rotate the kill-ring, and yank the new top.  You can only do this
  150.      if the prior command is C-y or M-y.
  151. File: readline.info,  Node: Readline Arguments,  Next: Searching,  Prev: Readline Killing Commands,  Up: Readline Interaction
  152. Readline Arguments
  153. ------------------
  154.    You can pass numeric arguments to Readline commands.  Sometimes the
  155. argument acts as a repeat count, other times it is the sign of the
  156. argument that is significant.  If you pass a negative argument to a
  157. command which normally acts in a forward direction, that command will
  158. act in a backward direction.  For example, to kill text back to the
  159. start of the line, you might type `M-- C-k'.
  160.    The general way to pass numeric arguments to a command is to type
  161. meta digits before the command.  If the first `digit' you type is a
  162. minus sign (-), then the sign of the argument will be negative.  Once
  163. you have typed one meta digit to get the argument started, you can type
  164. the remainder of the digits, and then the command.  For example, to give
  165. the C-d command an argument of 10, you could type `M-1 0 C-d'.
  166. File: readline.info,  Node: Searching,  Prev: Readline Arguments,  Up: Readline Interaction
  167. Searching for Commands in the History
  168. -------------------------------------
  169.    Readline provides commands for searching through the command history
  170. for lines containing a specified string.  There are two search modes:
  171. iNCREMENTAL and NON-INCREMENTAL.
  172.    Incremental searches begin before the user has finished typing the
  173. search string.  As each character of the search string is typed,
  174. readline displays the next entry from the history matching the string
  175. typed so far.  An incremental search requires only as many characters
  176. as needed to find the desired history entry.  The Escape character is
  177. used to terminate an incremental search.  Control-J will also terminate
  178. the search.  Control-G will abort an incremental search and restore the
  179. original line.  When the search is terminated, the history entry
  180. containing the search string becomes the current line.  To find other
  181. matching entries in the history list, type Control-S or Control-R as
  182. appropriate.  This will search backward or forward in the history for
  183. the next entry matching the search string typed so far.  Any other key
  184. sequence bound to a readline command will terminate the search and
  185. execute that command.  For instance, a `newline' will terminate the
  186. search and accept the line, thereby executing the command from the
  187. history list.
  188.    Non-incremental searches read the entire search string before
  189. starting to search for matching history lines.  The search string may be
  190. typed by the user or part of the contents of the current line.
  191. File: readline.info,  Node: Readline Init File,  Next: Bindable Readline Commands,  Prev: Readline Interaction,  Up: Command Line Editing
  192. Readline Init File
  193. ==================
  194.    Although the Readline library comes with a set of `emacs'-like
  195. keybindings installed by default, it is possible that you would like to
  196. use a different set of keybindings.  You can customize programs that
  197. use Readline by putting commands in an "inputrc" file in your home
  198. directory.  The name of this file is taken from the value of the
  199. environment variable `INPUTRC'.  If that variable is unset, the default
  200. is `~/.inputrc'.
  201.    When a program which uses the Readline library starts up, the init
  202. file is read, and the key bindings are set.
  203.    In addition, the `C-x C-r' command re-reads this init file, thus
  204. incorporating any changes that you might have made to it.
  205. * Menu:
  206. * Readline Init File Syntax::    Syntax for the commands in the inputrc file.
  207. * Conditional Init Constructs::    Conditional key bindings in the inputrc file.
  208. * Sample Init File::        An example inputrc file.
  209. File: readline.info,  Node: Readline Init File Syntax,  Next: Conditional Init Constructs,  Up: Readline Init File
  210. Readline Init File Syntax
  211. -------------------------
  212.    There are only a few basic constructs allowed in the Readline init
  213. file.  Blank lines are ignored.  Lines beginning with a `#' are
  214. comments.  Lines beginning with a `$' indicate conditional constructs
  215. (*note Conditional Init Constructs::.).  Other lines denote variable
  216. settings and key bindings.
  217. Variable Settings
  218.      You can change the state of a few variables in Readline by using
  219.      the `set' command within the init file.  Here is how you would
  220.      specify that you wish to use `vi' line editing commands:
  221.           set editing-mode vi
  222.      Right now, there are only a few variables which can be set; so
  223.      few, in fact, that we just list them here:
  224.     `bell-style'
  225.           Controls what happens when Readline wants to ring the
  226.           terminal bell.  If set to `none', Readline never rings the
  227.           bell.  If set to `visible', Readline uses a visible bell if
  228.           one is available.  If set to `audible' (the default),
  229.           Readline attempts to ring the terminal's bell.
  230.     `comment-begin'
  231.           The string to insert at the beginning of the line when the
  232.           `insert-comment' command is executed.  The default value is
  233.           `"#"'.
  234.     `completion-query-items'
  235.           The number of possible completions that determines when the
  236.           user is asked whether he wants to see the list of
  237.           possibilities.  If the number of possible completions is
  238.           greater than this value, Readline will ask the user whether
  239.           or not he wishes to view them; otherwise, they are simply
  240.           listed.  The default limit is `100'.
  241.     `convert-meta'
  242.           If set to `on', Readline will convert characters with the
  243.           eigth bit set to an ASCII key sequence by stripping the eigth
  244.           bit and prepending an ESC character, converting them to a
  245.           meta-prefixed key sequence.  The default value is `on'.
  246.     `disable-completion'
  247.           If set to `On', readline will inhibit word completion.
  248.           Completion  characters will be inserted into the line as if
  249.           they had been mapped to `self-insert'.  The default is `off'.
  250.     `editing-mode'
  251.           The `editing-mode' variable controls which editing mode you
  252.           are using.  By default, Readline starts up in Emacs editing
  253.           mode, where the keystrokes are most similar to Emacs.  This
  254.           variable can be set to either `emacs' or `vi'.
  255.     `enable-keypad'
  256.           When set to `on', readline will try to enable the application
  257.           keypad when it is called.  Some systems need this to enable
  258.           the arrow keys.  The default is `off'.
  259.     `expand-tilde'
  260.           If set to `on', tilde expansion is performed when Readline
  261.           attempts word completion.  The default is `off'.
  262.     `horizontal-scroll-mode'
  263.           This variable can be set to either `on' or `off'.  Setting it
  264.           to `on' means that the text of the lines that you edit will
  265.           scroll horizontally on a single screen line when they are
  266.           longer than the width of the screen, instead of wrapping onto
  267.           a new screen line.  By default, this variable is set to `off'.
  268.     `keymap'
  269.           Sets Readline's idea of the current keymap for key binding
  270.           commands.  Acceptable `keymap' names are `emacs',
  271.           `emacs-standard', `emacs-meta', `emacs-ctlx', `vi',
  272.           `vi-command', and `vi-insert'.  `vi' is equivalent to
  273.           `vi-command'; `emacs' is equivalent to `emacs-standard'.  The
  274.           default value is `emacs'.  The value of the `editing-mode'
  275.           variable also affects the default keymap.
  276.     `mark-directories'
  277.           If set to `on', completed directory names have a slash
  278.           appended.  The default is `on'.
  279.     `mark-modified-lines'
  280.           This variable, when set to `on', says to display an asterisk
  281.           (`*') at the start of history lines which have been modified.
  282.           This variable is `off' by default.
  283.     `input-meta'
  284.           If set to `on', Readline will enable eight-bit input (it will
  285.           not strip the eighth bit from the characters it reads),
  286.           regardless of what the terminal claims it can support.  The
  287.           default value is `off'.  The name `meta-flag' is a synonym
  288.           for this variable.
  289.     `output-meta'
  290.           If set to `on', Readline will display characters with the
  291.           eighth bit set directly rather than as a meta-prefixed escape
  292.           sequence.  The default is `off'.
  293.     `show-all-if-ambiguous'
  294.           This alters the default behavior of the completion functions.
  295.           If set to `on', words which have more than one possible
  296.           completion cause the matches to be listed immediately instead
  297.           of ringing the bell.  The default value is `off'.
  298.     `visible-stats'
  299.           If set to `on', a character denoting a file's type is
  300.           appended to the filename when listing possible completions.
  301.           The default is `off'.
  302. Key Bindings
  303.      The syntax for controlling key bindings in the init file is
  304.      simple.  First you have to know the name of the command that you
  305.      want to change.  The following pages contain tables of the command
  306.      name, the default keybinding, and a short description of what the
  307.      command does.
  308.      Once you know the name of the command, simply place the name of
  309.      the key you wish to bind the command to, a colon, and then the
  310.      name of the command on a line in the init file.  The name of the
  311.      key can be expressed in different ways, depending on which is most
  312.      comfortable for you.
  313.     KEYNAME: FUNCTION-NAME or MACRO
  314.           KEYNAME is the name of a key spelled out in English.  For
  315.           example:
  316.                Control-u: universal-argument
  317.                Meta-Rubout: backward-kill-word
  318.                Control-o: "> output"
  319.           In the above example, `C-u' is bound to the function
  320.           `universal-argument', and `C-o' is bound to run the macro
  321.           expressed on the right hand side (that is, to insert the text
  322.           `> output' into the line).
  323.     "KEYSEQ": FUNCTION-NAME or MACRO
  324.           KEYSEQ differs from KEYNAME above in that strings denoting an
  325.           entire key sequence can be specified, by placing the key
  326.           sequence in double quotes.  Some GNU Emacs style key escapes
  327.           can be used, as in the following example, but the special
  328.           character names are not recognized.
  329.                "\C-u": universal-argument
  330.                "\C-x\C-r": re-read-init-file
  331.                "\e[11~": "Function Key 1"
  332.           In the above example, `C-u' is bound to the function
  333.           `universal-argument' (just as it was in the first example),
  334.           `C-x C-r' is bound to the function `re-read-init-file', and
  335.           `ESC [ 1 1 ~' is bound to insert the text `Function Key 1'.
  336.           The following escape sequences are available when specifying
  337.           key sequences:
  338.          ``\C-''
  339.                control prefix
  340.          ``\M-''
  341.                meta prefix
  342.          ``\e''
  343.                an escape character
  344.          ``\\''
  345.                backslash
  346.          ``\"''
  347.                "
  348.          ``\'''
  349.                '
  350.           When entering the text of a macro, single or double quotes
  351.           should be used to indicate a macro definition.  Unquoted text
  352.           is assumed to be a function name.  Backslash will quote any
  353.           character in the macro text, including `"' and `''.  For
  354.           example, the following binding will make `C-x \' insert a
  355.           single `\' into the line:
  356.                "\C-x\\": "\\"
  357. File: readline.info,  Node: Conditional Init Constructs,  Next: Sample Init File,  Prev: Readline Init File Syntax,  Up: Readline Init File
  358. Conditional Init Constructs
  359. ---------------------------
  360.    Readline implements a facility similar in spirit to the conditional
  361. compilation features of the C preprocessor which allows key bindings
  362. and variable settings to be performed as the result of tests.  There
  363. are three parser directives used.
  364. `$if'
  365.      The `$if' construct allows bindings to be made based on the
  366.      editing mode, the terminal being used, or the application using
  367.      Readline.  The text of the test extends to the end of the line; no
  368.      characters are required to isolate it.
  369.     `mode'
  370.           The `mode=' form of the `$if' directive is used to test
  371.           whether Readline is in `emacs' or `vi' mode.  This may be
  372.           used in conjunction with the `set keymap' command, for
  373.           instance, to set bindings in the `emacs-standard' and
  374.           `emacs-ctlx' keymaps only if Readline is starting out in
  375.           `emacs' mode.
  376.     `term'
  377.           The `term=' form may be used to include terminal-specific key
  378.           bindings, perhaps to bind the key sequences output by the
  379.           terminal's function keys.  The word on the right side of the
  380.           `=' is tested against the full name of the terminal and the
  381.           portion of the terminal name before the first `-'.  This
  382.           allows `sun' to match both `sun' and `sun-cmd', for instance.
  383.     `application'
  384.           The APPLICATION construct is used to include
  385.           application-specific settings.  Each program using the
  386.           Readline library sets the APPLICATION NAME, and you can test
  387.           for it.  This could be used to bind key sequences to
  388.           functions useful for a specific program.  For instance, the
  389.           following command adds a key sequence that quotes the current
  390.           or previous word in Bash:
  391.                $if Bash
  392.                # Quote the current or previous word
  393.                "\C-xq": "\eb\"\ef\""
  394.                $endif
  395. `$endif'
  396.      This command, as you saw in the previous example, terminates an
  397.      `$if' command.
  398. `$else'
  399.      Commands in this branch of the `$if' directive are executed if the
  400.      test fails.
  401. File: readline.info,  Node: Sample Init File,  Prev: Conditional Init Constructs,  Up: Readline Init File
  402. Sample Init File
  403. ----------------
  404.    Here is an example of an inputrc file.  This illustrates key
  405. binding, variable assignment, and conditional syntax.
  406.      # This file controls the behaviour of line input editing for
  407.      # programs that use the Gnu Readline library.  Existing programs
  408.      # include FTP, Bash, and Gdb.
  409.      #
  410.      # You can re-read the inputrc file with C-x C-r.
  411.      # Lines beginning with '#' are comments.
  412.      #
  413.      # Set various bindings for emacs mode.
  414.      
  415.      set editing-mode emacs
  416.      
  417.      $if mode=emacs
  418.      
  419.      Meta-Control-h:    backward-kill-word    Text after the function name is ignored
  420.      
  421.      #
  422.      # Arrow keys in keypad mode
  423.      #
  424.      #"\M-OD":        backward-char
  425.      #"\M-OC":        forward-char
  426.      #"\M-OA":        previous-history
  427.      #"\M-OB":        next-history
  428.      #
  429.      # Arrow keys in ANSI mode
  430.      #
  431.      "\M-[D":        backward-char
  432.      "\M-[C":        forward-char
  433.      "\M-[A":        previous-history
  434.      "\M-[B":        next-history
  435.      #
  436.      # Arrow keys in 8 bit keypad mode
  437.      #
  438.      #"\M-\C-OD":       backward-char
  439.      #"\M-\C-OC":       forward-char
  440.      #"\M-\C-OA":       previous-history
  441.      #"\M-\C-OB":       next-history
  442.      #
  443.      # Arrow keys in 8 bit ANSI mode
  444.      #
  445.      #"\M-\C-[D":       backward-char
  446.      #"\M-\C-[C":       forward-char
  447.      #"\M-\C-[A":       previous-history
  448.      #"\M-\C-[B":       next-history
  449.      
  450.      C-q: quoted-insert
  451.      
  452.      $endif
  453.      
  454.      # An old-style binding.  This happens to be the default.
  455.      TAB: complete
  456.      
  457.      # Macros that are convenient for shell interaction
  458.      $if Bash
  459.      # edit the path
  460.      "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
  461.      # prepare to type a quoted word -- insert open and close double quotes
  462.      # and move to just after the open quote
  463.      "\C-x\"": "\"\"\C-b"
  464.      # insert a backslash (testing backslash escapes in sequences and macros)
  465.      "\C-x\\": "\\"
  466.      # Quote the current or previous word
  467.      "\C-xq": "\eb\"\ef\""
  468.      # Add a binding to refresh the line, which is unbound
  469.      "\C-xr": redraw-current-line
  470.      # Edit variable on current line.
  471.      "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
  472.      $endif
  473.      
  474.      # use a visible bell if one is available
  475.      set bell-style visible
  476.      
  477.      # don't strip characters to 7 bits when reading
  478.      set input-meta on
  479.      
  480.      # allow iso-latin1 characters to be inserted rather than converted to
  481.      # prefix-meta sequences
  482.      set convert-meta off
  483.      
  484.      # display characters with the eighth bit set directly rather than
  485.      # as meta-prefixed characters
  486.      set output-meta on
  487.      
  488.      # if there are more than 150 possible completions for a word, ask the
  489.      # user if he wants to see all of them
  490.      set completion-query-items 150
  491.      
  492.      # For FTP
  493.      $if Ftp
  494.      "\C-xg": "get \M-?"
  495.      "\C-xt": "put \M-?"
  496.      "\M-.": yank-last-arg
  497.      $endif
  498. File: readline.info,  Node: Bindable Readline Commands,  Next: Readline vi Mode,  Prev: Readline Init File,  Up: Command Line Editing
  499. Bindable Readline Commands
  500. ==========================
  501. * Menu:
  502. * Commands For Moving::        Moving about the line.
  503. * Commands For History::    Getting at previous lines.
  504. * Commands For Text::        Commands for changing text.
  505. * Commands For Killing::    Commands for killing and yanking.
  506. * Numeric Arguments::        Specifying numeric arguments, repeat counts.
  507. * Commands For Completion::    Getting Readline to do the typing for you.
  508. * Keyboard Macros::        Saving and re-executing typed characters
  509. * Miscellaneous Commands::    Other miscellaneous commands.
  510.    This section describes Readline commands that may be bound to key
  511. sequences.
  512. File: readline.info,  Node: Commands For Moving,  Next: Commands For History,  Up: Bindable Readline Commands
  513. Commands For Moving
  514. -------------------
  515. `beginning-of-line (C-a)'
  516.      Move to the start of the current line.
  517. `end-of-line (C-e)'
  518.      Move to the end of the line.
  519. `forward-char (C-f)'
  520.      Move forward a character.
  521. `backward-char (C-b)'
  522.      Move back a character.
  523. `forward-word (M-f)'
  524.      Move forward to the end of the next word.  Words are composed of
  525.      letters and digits.
  526. `backward-word (M-b)'
  527.      Move back to the start of this, or the previous, word.  Words are
  528.      composed of letters and digits.
  529. `clear-screen (C-l)'
  530.      Clear the screen and redraw the current line, leaving the current
  531.      line at the top of the screen.
  532. `redraw-current-line ()'
  533.      Refresh the current line.  By default, this is unbound.
  534. File: readline.info,  Node: Commands For History,  Next: Commands For Text,  Prev: Commands For Moving,  Up: Bindable Readline Commands
  535. Commands For Manipulating The History
  536. -------------------------------------
  537. `accept-line (Newline, Return)'
  538.      Accept the line regardless of where the cursor is.  If this line is
  539.      non-empty, add it to the history list.  If this line was a history
  540.      line, then restore the history line to its original state.
  541. `previous-history (C-p)'
  542.      Move `up' through the history list.
  543. `next-history (C-n)'
  544.      Move `down' through the history list.
  545. `beginning-of-history (M-<)'
  546.      Move to the first line in the history.
  547. `end-of-history (M->)'
  548.      Move to the end of the input history, i.e., the line you are
  549.      entering.
  550. `reverse-search-history (C-r)'
  551.      Search backward starting at the current line and moving `up'
  552.      through the history as necessary.  This is an incremental search.
  553. `forward-search-history (C-s)'
  554.      Search forward starting at the current line and moving `down'
  555.      through the the history as necessary.  This is an incremental
  556.      search.
  557. `non-incremental-reverse-search-history (M-p)'
  558.      Search backward starting at the current line and moving `up'
  559.      through the history as necessary using a non-incremental search
  560.      for a string supplied by the user.
  561. `non-incremental-forward-search-history (M-n)'
  562.      Search forward starting at the current line and moving `down'
  563.      through the the history as necessary using a non-incremental search
  564.      for a string supplied by the user.
  565. `history-search-forward ()'
  566.      Search forward through the history for the string of characters
  567.      between the start of the current line and the current cursor
  568.      position (the `point').  This is a non-incremental search.  By
  569.      default, this command is unbound.
  570. `history-search-backward ()'
  571.      Search backward through the history for the string of characters
  572.      between the start of the current line and the point.  This is a
  573.      non-incremental search.  By default, this command is unbound.
  574. `yank-nth-arg (M-C-y)'
  575.      Insert the first argument to the previous command (usually the
  576.      second word on the previous line).  With an argument N, insert the
  577.      Nth word from the previous command (the words in the previous
  578.      command begin with word 0).  A negative argument inserts the Nth
  579.      word from the end of the previous command.
  580. `yank-last-arg (M-., M-_)'
  581.      Insert last argument to the previous command (the last word of the
  582.      previous history entry).  With an argument, behave exactly like
  583.      `yank-nth-arg'.
  584. File: readline.info,  Node: Commands For Text,  Next: Commands For Killing,  Prev: Commands For History,  Up: Bindable Readline Commands
  585. Commands For Changing Text
  586. --------------------------
  587. `delete-char (C-d)'
  588.      Delete the character under the cursor.  If the cursor is at the
  589.      beginning of the line, there are no characters in the line, and
  590.      the last character typed was not `C-d', then return `EOF'.
  591. `backward-delete-char (Rubout)'
  592.      Delete the character behind the cursor.  A numeric arg says to kill
  593.      the characters instead of deleting them.
  594. `quoted-insert (C-q, C-v)'
  595.      Add the next character that you type to the line verbatim.  This is
  596.      how to insert key sequences like C-q, for example.
  597. `tab-insert (M-TAB)'
  598.      Insert a tab character.
  599. `self-insert (a, b, A, 1, !, ...)'
  600.      Insert yourself.
  601. `transpose-chars (C-t)'
  602.      Drag the character before the cursor forward over the character at
  603.      the cursor, moving the cursor forward as well.  If the insertion
  604.      point is at the end of the line, then this transposes the last two
  605.      characters of the line.  Negative argumentss don't work.
  606. `transpose-words (M-t)'
  607.      Drag the word behind the cursor past the word in front of the
  608.      cursor moving the cursor over that word as well.
  609. `upcase-word (M-u)'
  610.      Uppercase the current (or following) word.  With a negative
  611.      argument, do the previous word, but do not move the cursor.
  612. `downcase-word (M-l)'
  613.      Lowercase the current (or following) word.  With a negative
  614.      argument, do the previous word, but do not move the cursor.
  615. `capitalize-word (M-c)'
  616.      Capitalize the current (or following) word.  With a negative
  617.      argument, do the previous word, but do not move the cursor.
  618. File: readline.info,  Node: Commands For Killing,  Next: Numeric Arguments,  Prev: Commands For Text,  Up: Bindable Readline Commands
  619. Killing And Yanking
  620. -------------------
  621. `kill-line (C-k)'
  622.      Kill the text from the current cursor position to the end of the
  623.      line.
  624. `backward-kill-line (C-x Rubout)'
  625.      Kill backward to the beginning of the line.
  626. `unix-line-discard (C-u)'
  627.      Kill backward from the cursor to the beginning of the current line.
  628.      Save the killed text on the kill-ring.
  629. `kill-whole-line ()'
  630.      Kill all characters on the current line, no matter where the
  631.      cursor is.  By default, this is unbound.
  632. `kill-word (M-d)'
  633.      Kill from the cursor to the end of the current word, or if between
  634.      words, to the end of the next word.  Word boundaries are the same
  635.      as `forward-word'.
  636. `backward-kill-word (M-DEL)'
  637.      Kill the word behind the cursor.  Word boundaries are the same as
  638.      `backward-word'.
  639. `unix-word-rubout (C-w)'
  640.      Kill the word behind the cursor, using white space as a word
  641.      boundary.  The killed text is saved on the kill-ring.
  642. `delete-horizontal-space ()'
  643.      Delete all spaces and tabs around point.  By default, this is
  644.      unbound.
  645. `kill-region ()'
  646.      Kill the text between the point and the *mark* (saved cursor
  647.      position.  This text is referred to as the REGION.  By default,
  648.      this command is unbound.
  649. `copy-region-as-kill ()'
  650.      Copy the text in the region to the kill buffer, so you can yank it
  651.      right away.  By default, this command is unbound.
  652. `copy-backward-word ()'
  653.      Copy the word before point to the kill buffer.  By default, this
  654.      command is unbound.
  655. `copy-forward-word ()'
  656.      Copy the word following point to the kill buffer.  By default,
  657.      this command is unbound.
  658. `yank (C-y)'
  659.      Yank the top of the kill ring into the buffer at the current
  660.      cursor position.
  661. `yank-pop (M-y)'
  662.      Rotate the kill-ring, and yank the new top.  You can only do this
  663.      if the prior command is yank or yank-pop.
  664. File: readline.info,  Node: Numeric Arguments,  Next: Commands For Completion,  Prev: Commands For Killing,  Up: Bindable Readline Commands
  665. Specifying Numeric Arguments
  666. ----------------------------
  667. `digit-argument (M-0, M-1, ... M--)'
  668.      Add this digit to the argument already accumulating, or start a new
  669.      argument.  M- starts a negative argument.
  670. `universal-argument ()'
  671.      This is another way to specify an argument.  If this command is
  672.      followed by one or more digits, optionally with a leading minus
  673.      sign, those digits define the argument.  If the command is
  674.      followed by digits, executing `universal-argument' again ends the
  675.      numeric argument, but is otherwise ignored.  As a special case, if
  676.      this command is immediately followed by a character that is
  677.      neither a digit or minus sign, the argument count for the next
  678.      command is multiplied by four.  The argument count is initially
  679.      one, so executing this function the first time makes the argument
  680.      count four, a second time makes the argument count sixteen, and so
  681.      on.  By default, this is not bound to a key.
  682. File: readline.info,  Node: Commands For Completion,  Next: Keyboard Macros,  Prev: Numeric Arguments,  Up: Bindable Readline Commands
  683. Letting Readline Type For You
  684. -----------------------------
  685. `complete (TAB)'
  686.      Attempt to do completion on the text before the cursor.  This is
  687.      application-specific.  Generally, if you are typing a filename
  688.      argument, you can do filename completion; if you are typing a
  689.      command, you can do command completion, if you are typing in a
  690.      symbol to GDB, you can do symbol name completion, if you are
  691.      typing in a variable to Bash, you can do variable name completion,
  692.      and so on.
  693. `possible-completions (M-?)'
  694.      List the possible completions of the text before the cursor.
  695. `insert-completions (M-*)'
  696.      Insert all completions of the text before point that would have
  697.      been generated by `possible-completions'.
  698. File: readline.info,  Node: Keyboard Macros,  Next: Miscellaneous Commands,  Prev: Commands For Completion,  Up: Bindable Readline Commands
  699. Keyboard Macros
  700. ---------------
  701. `start-kbd-macro (C-x ()'
  702.      Begin saving the characters typed into the current keyboard macro.
  703. `end-kbd-macro (C-x ))'
  704.      Stop saving the characters typed into the current keyboard macro
  705.      and save the definition.
  706. `call-last-kbd-macro (C-x e)'
  707.      Re-execute the last keyboard macro defined, by making the
  708.      characters in the macro appear as if typed at the keyboard.
  709. File: readline.info,  Node: Miscellaneous Commands,  Prev: Keyboard Macros,  Up: Bindable Readline Commands
  710. Some Miscellaneous Commands
  711. ---------------------------
  712. `re-read-init-file (C-x C-r)'
  713.      Read in the contents of the inputrc file, and incorporate any
  714.      bindings or variable assignments found there.
  715. `abort (C-g)'
  716.      Abort the current editing command and ring the terminal's bell
  717.      (subject to the setting of `bell-style').
  718. `do-uppercase-version (M-a, M-b, M-X, ...)'
  719.      If the metafied character X is lowercase, run the command that is
  720.      bound to the corresponding uppercase character.
  721. `prefix-meta (ESC)'
  722.      Make the next character that you type be metafied.  This is for
  723.      people without a meta key.  Typing `ESC f' is equivalent to typing
  724.      `M-f'.
  725. `undo (C-_, C-x C-u)'
  726.      Incremental undo, separately remembered for each line.
  727. `revert-line (M-r)'
  728.      Undo all changes made to this line.  This is like typing the `undo'
  729.      command enough times to get back to the beginning.
  730. `tilde-expand (M-~)'
  731.      Perform tilde expansion on the current word.
  732. `set-mark (C-@)'
  733.      Set the mark to the current point.  If a numeric argument is
  734.      supplied, the mark is set to that position.
  735. `exchange-point-and-mark (C-x C-x)'
  736.      Swap the point with the mark.  The current cursor position is set
  737.      to the saved position, and the old cursor position is saved as the
  738.      mark.
  739. `character-search (C-])'
  740.      A character is read and point is moved to the next occurrence of
  741.      that character.  A negative count searches for previous
  742.      occurrences.
  743. `character-search-backward (M-C-])'
  744.      A character is read and point is moved to the previous occurrence
  745.      of that character.  A negative count searches for subsequent
  746.      occurrences.
  747. `insert-comment (M-#)'
  748.      The value of the `comment-begin' variable is inserted at the
  749.      beginning of the current line, and the line is accepted as if a
  750.      newline had been typed.
  751. `dump-functions ()'
  752.      Print all of the functions and their key bindings to the readline
  753.      output stream.  If a numeric argument is supplied, the output is
  754.      formatted in such a way that it can be made part of an INPUTRC
  755.      file.  This command is unbound by default.
  756. `dump-variables ()'
  757.      Print all of the settable variables and their values to the
  758.      readline output stream.  If a numeric argument is supplied, the
  759.      output is formatted in such a way that it can be made part of an
  760.      INPUTRC file.  This command is unbound by default.
  761. `dump-macros ()'
  762.      Print all of the readline key sequences bound to macros and the
  763.      strings they ouput.  If a numeric argument is supplied, the output
  764.      is formatted in such a way that it can be made part of an INPUTRC
  765.      file.  This command is unbound by default.
  766. File: readline.info,  Node: Readline vi Mode,  Prev: Bindable Readline Commands,  Up: Command Line Editing
  767. Readline vi Mode
  768. ================
  769.    While the Readline library does not have a full set of `vi' editing
  770. functions, it does contain enough to allow simple editing of the line.
  771. The Readline `vi' mode behaves as specified in the POSIX 1003.2
  772. standard.
  773.    In order to switch interactively between `emacs' and `vi' editing
  774. modes, use the command M-C-j (toggle-editing-mode).  The Readline
  775. default is `emacs' mode.
  776.    When you enter a line in `vi' mode, you are already placed in
  777. `insertion' mode, as if you had typed an `i'.  Pressing ESC switches
  778. you into `command' mode, where you can edit the text of the line with
  779. the standard `vi' movement keys, move to previous history lines with
  780. `k' and subsequent lines with `j', and so forth.
  781.    This document describes the GNU Readline Library, a utility for
  782. aiding in the consitency of user interface across discrete programs
  783. that need to provide a command line interface.
  784.    Copyright (C) 1988, 1994, 1996 Free Software Foundation, Inc.
  785.    Permission is granted to make and distribute verbatim copies of this
  786. manual provided the copyright notice and this permission notice pare
  787. preserved on all copies.
  788.    Permission is granted to copy and distribute modified versions of
  789. this manual under the conditions for verbatim copying, provided that
  790. the entire resulting derived work is distributed under the terms of a
  791. permission notice identical to this one.
  792.    Permission is granted to copy and distribute translations of this
  793. manual into another language, under the above conditions for modified
  794. versions, except that this permission notice may be stated in a
  795. translation approved by the Foundation.
  796. File: readline.info,  Node: Programming with GNU Readline,  Next: Concept Index,  Prev: Command Line Editing,  Up: Top
  797. Programming with GNU Readline
  798. *****************************
  799.    This chapter describes the interface between the GNU Readline
  800. Library and other programs.  If you are a programmer, and you wish to
  801. include the features found in GNU Readline such as completion, line
  802. editing, and interactive history manipulation in your own programs,
  803. this section is for you.
  804. * Menu:
  805. * Basic Behavior::    Using the default behavior of Readline.
  806. * Custom Functions::    Adding your own functions to Readline.
  807. * Readline Variables::            Variables accessible to custom
  808.                     functions.
  809. * Readline Convenience Functions::    Functions which Readline supplies to
  810.                     aid in writing your own
  811. * Custom Completers::    Supplanting or supplementing Readline's
  812.             completion functions.
  813. File: readline.info,  Node: Basic Behavior,  Next: Custom Functions,  Up: Programming with GNU Readline
  814. Basic Behavior
  815. ==============
  816.    Many programs provide a command line interface, such as `mail',
  817. `ftp', and `sh'.  For such programs, the default behaviour of Readline
  818. is sufficient.  This section describes how to use Readline in the
  819. simplest way possible, perhaps to replace calls in your code to
  820. `gets()' or `fgets ()'.
  821.    The function `readline ()' prints a prompt and then reads and returns
  822. a single line of text from the user.  The line `readline' returns is
  823. allocated with `malloc ()'; you should `free ()' the line when you are
  824. done with it.  The declaration for `readline' in ANSI C is
  825.      `char *readline (char *PROMPT);'
  826. So, one might say
  827.      `char *line = readline ("Enter a line: ");'
  828. in order to read a line of text from the user.  The line returned has
  829. the final newline removed, so only the text remains.
  830.    If `readline' encounters an `EOF' while reading the line, and the
  831. line is empty at that point, then `(char *)NULL' is returned.
  832. Otherwise, the line is ended just as if a newline had been typed.
  833.    If you want the user to be able to get at the line later, (with C-p
  834. for example), you must call `add_history ()' to save the line away in a
  835. "history" list of such lines.
  836.      `add_history (line)';
  837. For full details on the GNU History Library, see the associated manual.
  838.    It is preferable to avoid saving empty lines on the history list,
  839. since users rarely have a burning need to reuse a blank line.  Here is
  840. a function which usefully replaces the standard `gets ()' library
  841. function, and has the advantage of no static buffer to overflow:
  842.      /* A static variable for holding the line. */
  843.      static char *line_read = (char *)NULL;
  844.      
  845.      /* Read a string, and return a pointer to it.  Returns NULL on EOF. */
  846.      char *
  847.      rl_gets ()
  848.      {
  849.        /* If the buffer has already been allocated, return the memory
  850.           to the free pool. */
  851.        if (line_read)
  852.          {
  853.            free (line_read);
  854.            line_read = (char *)NULL;
  855.          }
  856.      
  857.        /* Get a line from the user. */
  858.        line_read = readline ("");
  859.      
  860.        /* If the line has any text in it, save it on the history. */
  861.        if (line_read && *line_read)
  862.          add_history (line_read);
  863.      
  864.        return (line_read);
  865.      }
  866.    This function gives the user the default behaviour of TAB
  867. completion: completion on file names.  If you do not want Readline to
  868. complete on filenames, you can change the binding of the TAB key with
  869. `rl_bind_key ()'.
  870.      `int rl_bind_key (int KEY, int (*FUNCTION)());'
  871.    `rl_bind_key ()' takes two arguments: KEY is the character that you
  872. want to bind, and FUNCTION is the address of the function to call when
  873. KEY is pressed.  Binding TAB to `rl_insert ()' makes TAB insert itself.
  874. `rl_bind_key ()' returns non-zero if KEY is not a valid ASCII character
  875. code (between 0 and 255).
  876.    Thus, to disable the default TAB behavior, the following suffices:
  877.      `rl_bind_key ('\t', rl_insert);'
  878.    This code should be executed once at the start of your program; you
  879. might write a function called `initialize_readline ()' which performs
  880. this and other desired initializations, such as installing custom
  881. completers (*note Custom Completers::.).
  882. File: readline.info,  Node: Custom Functions,  Next: Readline Variables,  Prev: Basic Behavior,  Up: Programming with GNU Readline
  883. Custom Functions
  884. ================
  885.    Readline provides many functions for manipulating the text of the
  886. line, but it isn't possible to anticipate the needs of all programs.
  887. This section describes the various functions and variables defined
  888. within the Readline library which allow a user program to add
  889. customized functionality to Readline.
  890. * Menu:
  891. * The Function Type::    C declarations to make code readable.
  892. * Function Writing::    Variables and calling conventions.
  893. File: readline.info,  Node: The Function Type,  Next: Function Writing,  Up: Custom Functions
  894. The Function Type
  895. -----------------
  896.    For readabilty, we declare a new type of object, called "Function".
  897. A `Function' is a C function which returns an `int'.  The type
  898. declaration for `Function' is:
  899. `typedef int Function ();'
  900.    The reason for declaring this new type is to make it easier to write
  901. code describing pointers to C functions.  Let us say we had a variable
  902. called FUNC which was a pointer to a function.  Instead of the classic
  903. C declaration
  904.    `int (*)()func;'
  905. we may write
  906.    `Function *func;'
  907. Similarly, there are
  908.      typedef void VFunction ();
  909.      typedef char *CPFunction (); and
  910.      typedef char **CPPFunction ();
  911. for functions returning no value, `pointer to char', and `pointer to
  912. pointer to char', respectively.
  913. File: readline.info,  Node: Function Writing,  Prev: The Function Type,  Up: Custom Functions
  914. Writing a New Function
  915. ----------------------
  916.    In order to write new functions for Readline, you need to know the
  917. calling conventions for keyboard-invoked functions, and the names of the
  918. variables that describe the current state of the line read so far.
  919.    The calling sequence for a command `foo' looks like
  920.      `foo (int count, int key)'
  921. where COUNT is the numeric argument (or 1 if defaulted) and KEY is the
  922. key that invoked this function.
  923.    It is completely up to the function as to what should be done with
  924. the numeric argument.  Some functions use it as a repeat count, some as
  925. a flag, and others to choose alternate behavior (refreshing the current
  926. line as opposed to refreshing the screen, for example).  Some choose to
  927. ignore it.  In general, if a function uses the numeric argument as a
  928. repeat count, it should be able to do something useful with both
  929. negative and positive arguments.  At the very least, it should be aware
  930. that it can be passed a negative argument.
  931. File: readline.info,  Node: Readline Variables,  Next: Readline Convenience Functions,  Prev: Custom Functions,  Up: Programming with GNU Readline
  932. Readline Variables
  933. ==================
  934.    These variables are available to function writers.
  935.  - Variable: char * rl_line_buffer
  936.      This is the line gathered so far.  You are welcome to modify the
  937.      contents of the line, but see *Note Allowing Undoing::.
  938.  - Variable: int rl_point
  939.      The offset of the current cursor position in `rl_line_buffer' (the
  940.      *point*).
  941.  - Variable: int rl_end
  942.      The number of characters present in `rl_line_buffer'.  When
  943.      `rl_point' is at the end of the line, `rl_point' and `rl_end' are
  944.      equal.
  945.  - Variable: int rl_mark
  946.      The mark (saved position) in the current line.  If set, the mark
  947.      and point define a *region*.
  948.  - Variable: int rl_done
  949.      Setting this to a non-zero value causes Readline to return the
  950.      current line immediately.
  951.  - Variable: int rl_pending_input
  952.      Setting this to a value makes it the next keystroke read.  This is
  953.      a way to stuff a single character into the input stream.
  954.  - Variable: char * rl_prompt
  955.      The prompt Readline uses.  This is set from the argument to
  956.      `readline ()', and should not be assigned to directly.
  957.  - Variable: char * rl_library_version
  958.      The version number of this revision of the library.
  959.  - Variable: char * rl_terminal_name
  960.      The terminal type, used for initialization.
  961.  - Variable: char * rl_readline_name
  962.      This variable is set to a unique name by each application using
  963.      Readline.  The value allows conditional parsing of the inputrc file
  964.      (*note Conditional Init Constructs::.).
  965.  - Variable: FILE * rl_instream
  966.      The stdio stream from which Readline reads input.
  967.  - Variable: FILE * rl_outstream
  968.      The stdio stream to which Readline performs output.
  969.  - Variable: Function * rl_startup_hook
  970.      If non-zero, this is the address of a function to call just before
  971.      `readline' prints the first prompt.
  972.  - Variable: Function * rl_event_hook
  973.      If non-zero, this is the address of a function to call periodically
  974.      when readline is waiting for terminal input.
  975.  - Variable: Function * rl_getc_function
  976.      If non-zero, `readline' will call indirectly through this pointer
  977.      to get a character from the input stream.  By default, it is set to
  978.      `rl_getc', the default `readline' character input function (*note
  979.      Utility Functions::.).
  980.  - Variable: VFunction * rl_redisplay_function
  981.      If non-zero, `readline' will call indirectly through this pointer
  982.      to update the display with the current contents of the editing
  983.      buffer.  By default, it is set to `rl_redisplay', the default
  984.      `readline' redisplay function (*note Redisplay::.).
  985.  - Variable: Keymap rl_executing_keymap
  986.      This variable is set to the keymap (*note Keymaps::.) in which the
  987.      currently executing readline function was found.
  988.  - Variable: Keymap rl_binding_keymap
  989.      This variable is set to the keymap (*note Keymaps::.) in which the
  990.      last key binding occurred.
  991. File: readline.info,  Node: Readline Convenience Functions,  Next: Custom Completers,  Prev: Readline Variables,  Up: Programming with GNU Readline
  992. Readline Convenience Functions
  993. ==============================
  994. * Menu:
  995. * Function Naming::    How to give a function you write a name.
  996. * Keymaps::        Making keymaps.
  997. * Binding Keys::    Changing Keymaps.
  998. * Associating Function Names and Bindings::    Translate function names to
  999.                         key sequences.
  1000. * Allowing Undoing::    How to make your functions undoable.
  1001. * Redisplay::        Functions to control line display.
  1002. * Modifying Text::    Functions to modify `rl_line_buffer'.
  1003. * Utility Functions::    Generally useful functions and hooks.
  1004. * Alternate Interface::    Using Readline in a `callback' fashion.
  1005. File: readline.info,  Node: Function Naming,  Next: Keymaps,  Up: Readline Convenience Functions
  1006. Naming a Function
  1007. -----------------
  1008.    The user can dynamically change the bindings of keys while using
  1009. Readline.  This is done by representing the function with a descriptive
  1010. name.  The user is able to type the descriptive name when referring to
  1011. the function.  Thus, in an init file, one might find
  1012.      Meta-Rubout:    backward-kill-word
  1013.    This binds the keystroke Meta-Rubout to the function *descriptively*
  1014. named `backward-kill-word'.  You, as the programmer, should bind the
  1015. functions you write to descriptive names as well.  Readline provides a
  1016. function for doing that:
  1017.  - Function: int rl_add_defun (char *name, Function *function, int key)
  1018.      Add NAME to the list of named functions.  Make FUNCTION be the
  1019.      function that gets called.  If KEY is not -1, then bind it to
  1020.      FUNCTION using `rl_bind_key ()'.
  1021.    Using this function alone is sufficient for most applications.  It is
  1022. the recommended way to add a few functions to the default functions that
  1023. Readline has built in.  If you need to do something other than adding a
  1024. function to Readline, you may need to use the underlying functions
  1025. described below.
  1026. File: readline.info,  Node: Keymaps,  Next: Binding Keys,  Prev: Function Naming,  Up: Readline Convenience Functions
  1027. Selecting a Keymap
  1028. ------------------
  1029.    Key bindings take place on a "keymap".  The keymap is the
  1030. association between the keys that the user types and the functions that
  1031. get run.  You can make your own keymaps, copy existing keymaps, and tell
  1032. Readline which keymap to use.
  1033.  - Function: Keymap rl_make_bare_keymap ()
  1034.      Returns a new, empty keymap.  The space for the keymap is
  1035.      allocated with `malloc ()'; you should `free ()' it when you are
  1036.      done.
  1037.  - Function: Keymap rl_copy_keymap (Keymap map)
  1038.      Return a new keymap which is a copy of MAP.
  1039.  - Function: Keymap rl_make_keymap ()
  1040.      Return a new keymap with the printing characters bound to
  1041.      rl_insert, the lowercase Meta characters bound to run their
  1042.      equivalents, and the Meta digits bound to produce numeric
  1043.      arguments.
  1044.  - Function: void rl_discard_keymap (Keymap keymap)
  1045.      Free the storage associated with KEYMAP.
  1046.    Readline has several internal keymaps.  These functions allow you to
  1047. change which keymap is active.
  1048.  - Function: Keymap rl_get_keymap ()
  1049.      Returns the currently active keymap.
  1050.  - Function: void rl_set_keymap (Keymap keymap)
  1051.      Makes KEYMAP the currently active keymap.
  1052.  - Function: Keymap rl_get_keymap_by_name (char *name)
  1053.      Return the keymap matching NAME.  NAME is one which would be
  1054.      supplied in a `set keymap' inputrc line (*note Readline Init
  1055.      File::.).
  1056.  - Function: char * rl_get_keymap_name (Keymap keymap)
  1057.      Return the name matching KEYMAP.  NAME is one which would be
  1058.      supplied in a `set keymap' inputrc line (*note Readline Init
  1059.      File::.).
  1060. File: readline.info,  Node: Binding Keys,  Next: Associating Function Names and Bindings,  Prev: Keymaps,  Up: Readline Convenience Functions
  1061. Binding Keys
  1062. ------------
  1063.    You associate keys with functions through the keymap.  Readline has
  1064. several internal keymaps: `emacs_standard_keymap', `emacs_meta_keymap',
  1065. `emacs_ctlx_keymap', `vi_movement_keymap', and `vi_insertion_keymap'.
  1066. `emacs_standard_keymap' is the default, and the examples in this manual
  1067. assume that.
  1068.    These functions manage key bindings.
  1069.  - Function: int rl_bind_key (int key, Function *function)
  1070.      Binds KEY to FUNCTION in the currently active keymap.  Returns
  1071.      non-zero in the case of an invalid KEY.
  1072.  - Function: int rl_bind_key_in_map (int key, Function *function,
  1073.           Keymap map)
  1074.      Bind KEY to FUNCTION in MAP.  Returns non-zero in the case of an
  1075.      invalid KEY.
  1076.  - Function: int rl_unbind_key (int key)
  1077.      Bind KEY to the null function in the currently active keymap.
  1078.      Returns non-zero in case of error.
  1079.  - Function: int rl_unbind_key_in_map (int key, Keymap map)
  1080.      Bind KEY to the null function in MAP.  Returns non-zero in case of
  1081.      error.
  1082.  - Function: int rl_generic_bind (int type, char *keyseq, char *data,
  1083.           Keymap map)
  1084.      Bind the key sequence represented by the string KEYSEQ to the
  1085.      arbitrary pointer DATA.  TYPE says what kind of data is pointed to
  1086.      by DATA; this can be a function (`ISFUNC'), a macro (`ISMACR'), or
  1087.      a keymap (`ISKMAP').  This makes new keymaps as necessary.  The
  1088.      initial keymap in which to do bindings is MAP.
  1089.  - Function: int rl_parse_and_bind (char *line)
  1090.      Parse LINE as if it had been read from the `inputrc' file and
  1091.      perform any key bindings and variable assignments found (*note
  1092.      Readline Init File::.).
  1093.  - Function: int rl_read_init_file (char *filename)
  1094.      Read keybindings and variable assignments from FILENAME (*note
  1095.      Readline Init File::.).
  1096. File: readline.info,  Node: Associating Function Names and Bindings,  Next: Allowing Undoing,  Prev: Binding Keys,  Up: Readline Convenience Functions
  1097. Associating Function Names and Bindings
  1098. ---------------------------------------
  1099.    These functions allow you to find out what keys invoke named
  1100. functions and the functions invoked by a particular key sequence.
  1101.  - Function: Function * rl_named_function (char *name)
  1102.      Return the function with name NAME.
  1103.  - Function: Function * rl_function_of_keyseq (char *keyseq, Keymap
  1104.           map, int *type)
  1105.      Return the function invoked by KEYSEQ in keymap MAP.  If MAP is
  1106.      NULL, the current keymap is used.  If TYPE is not NULL, the type
  1107.      of the object is returned in it (one of `ISFUNC', `ISKMAP', or
  1108.      `ISMACR').
  1109.  - Function: char ** rl_invoking_keyseqs (Function *function)
  1110.      Return an array of strings representing the key sequences used to
  1111.      invoke FUNCTION in the current keymap.
  1112.  - Function: char ** rl_invoking_keyseqs_in_map (Function *function,
  1113.           Keymap map)
  1114.      Return an array of strings representing the key sequences used to
  1115.      invoke FUNCTION in the keymap MAP.
  1116.  - Function: void rl_function_dumper (int readable)
  1117.      Print the readline function names and the key sequences currently
  1118.      bound to them to `rl_outstream'.  If READABLE is non-zero, the
  1119.      list is formatted in such a way that it can be made part of an
  1120.      `inputrc' file and re-read.
  1121.  - Function: void rl_list_funmap_names ()
  1122.      Print the names of all bindable Readline functions to
  1123.      `rl_outstream'.
  1124. File: readline.info,  Node: Allowing Undoing,  Next: Redisplay,  Prev: Associating Function Names and Bindings,  Up: Readline Convenience Functions
  1125. Allowing Undoing
  1126. ----------------
  1127.    Supporting the undo command is a painless thing, and makes your
  1128. functions much more useful.  It is certainly easy to try something if
  1129. you know you can undo it.  I could use an undo function for the stock
  1130. market.
  1131.    If your function simply inserts text once, or deletes text once, and
  1132. uses `rl_insert_text ()' or `rl_delete_text ()' to do it, then undoing
  1133. is already done for you automatically.
  1134.    If you do multiple insertions or multiple deletions, or any
  1135. combination of these operations, you should group them together into
  1136. one operation.  This is done with `rl_begin_undo_group ()' and
  1137. `rl_end_undo_group ()'.
  1138.    The types of events that can be undone are:
  1139.      enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
  1140.    Notice that `UNDO_DELETE' means to insert some text, and
  1141. `UNDO_INSERT' means to delete some text.  That is, the undo code tells
  1142. undo what to undo, not how to undo it.  `UNDO_BEGIN' and `UNDO_END' are
  1143. tags added by `rl_begin_undo_group ()' and `rl_end_undo_group ()'.
  1144.  - Function: int rl_begin_undo_group ()
  1145.      Begins saving undo information in a group construct.  The undo
  1146.      information usually comes from calls to `rl_insert_text ()' and
  1147.      `rl_delete_text ()', but could be the result of calls to
  1148.      `rl_add_undo ()'.
  1149.  - Function: int rl_end_undo_group ()
  1150.      Closes the current undo group started with `rl_begin_undo_group
  1151.      ()'.  There should be one call to `rl_end_undo_group ()' for each
  1152.      call to `rl_begin_undo_group ()'.
  1153.  - Function: void rl_add_undo (enum undo_code what, int start, int end,
  1154.           char *text)
  1155.      Remember how to undo an event (according to WHAT).  The affected
  1156.      text runs from START to END, and encompasses TEXT.
  1157.  - Function: void free_undo_list ()
  1158.      Free the existing undo list.
  1159.  - Function: int rl_do_undo ()
  1160.      Undo the first thing on the undo list.  Returns `0' if there was
  1161.      nothing to undo, non-zero if something was undone.
  1162.    Finally, if you neither insert nor delete text, but directly modify
  1163. the existing text (e.g., change its case), call `rl_modifying ()' once,
  1164. just before you modify the text.  You must supply the indices of the
  1165. text range that you are going to modify.
  1166.  - Function: int rl_modifying (int start, int end)
  1167.      Tell Readline to save the text between START and END as a single
  1168.      undo unit.  It is assumed that you will subsequently modify that
  1169.      text.
  1170. File: readline.info,  Node: Redisplay,  Next: Modifying Text,  Prev: Allowing Undoing,  Up: Readline Convenience Functions
  1171. Redisplay
  1172. ---------
  1173.  - Function: void rl_redisplay ()
  1174.      Change what's displayed on the screen to reflect the current
  1175.      contents of `rl_line_buffer'.
  1176.  - Function: int rl_forced_update_display ()
  1177.      Force the line to be updated and redisplayed, whether or not
  1178.      Readline thinks the screen display is correct.
  1179.  - Function: int rl_on_new_line ()
  1180.      Tell the update routines that we have moved onto a new (empty)
  1181.      line, usually after ouputting a newline.
  1182.  - Function: int rl_reset_line_state ()
  1183.      Reset the display state to a clean state and redisplay the current
  1184.      line starting on a new line.
  1185.  - Function: int rl_message (va_alist)
  1186.      The arguments are a string as would be supplied to `printf'.  The
  1187.      resulting string is displayed in the "echo area".  The echo area
  1188.      is also used to display numeric arguments and search strings.
  1189.  - Function: int rl_clear_message ()
  1190.      Clear the message in the echo area.
  1191. File: readline.info,  Node: Modifying Text,  Next: Utility Functions,  Prev: Redisplay,  Up: Readline Convenience Functions
  1192. Modifying Text
  1193. --------------
  1194.  - Function: int rl_insert_text (char *text)
  1195.      Insert TEXT into the line at the current cursor position.
  1196.  - Function: int rl_delete_text (int start, int end)
  1197.      Delete the text between START and END in the current line.
  1198.  - Function: char * rl_copy_text (int start, int end)
  1199.      Return a copy of the text between START and END in the current
  1200.      line.
  1201.  - Function: int rl_kill_text (int start, int end)
  1202.      Copy the text between START and END in the current line to the
  1203.      kill ring, appending or prepending to the last kill if the last
  1204.      command was a kill command.  The text is deleted.  If START is
  1205.      less than END, the text is appended, otherwise prepended.  If the
  1206.      last command was not a kill, a new kill ring slot is used.
  1207. File: readline.info,  Node: Utility Functions,  Next: Alternate Interface,  Prev: Modifying Text,  Up: Readline Convenience Functions
  1208. Utility Functions
  1209. -----------------
  1210.  - Function: int rl_read_key ()
  1211.      Return the next character available.  This handles input inserted
  1212.      into the input stream via PENDING INPUT (*note Readline
  1213.      Variables::.) and `rl_stuff_char ()', macros, and characters read
  1214.      from the keyboard.
  1215.  - Function: int rl_getc (FILE *)
  1216.      Return the next character available from the keyboard.
  1217.  - Function: int rl_stuff_char (int c)
  1218.      Insert C into the Readline input stream.  It will be "read" before
  1219.      Readline attempts to read characters from the terminal with
  1220.      `rl_read_key ()'.
  1221.  - Function: rl_extend_line_buffer (int len)
  1222.      Ensure that `rl_line_buffer' has enough space to hold LEN
  1223.      characters, possibly reallocating it if necessary.
  1224.  - Function: int rl_initialize ()
  1225.      Initialize or re-initialize Readline's internal state.
  1226.  - Function: int rl_reset_terminal (char *terminal_name)
  1227.      Reinitialize Readline's idea of the terminal settings using
  1228.      TERMINAL_NAME as the terminal type (e.g., `vt100').
  1229.  - Function: int alphabetic (int c)
  1230.      Return 1 if C is an alphabetic character.
  1231.  - Function: int numeric (int c)
  1232.      Return 1 if C is a numeric character.
  1233.  - Function: int ding ()
  1234.      Ring the terminal bell, obeying the setting of `bell-style'.
  1235.    The following are implemented as macros, defined in `chartypes.h'.
  1236.  - Function: int uppercase_p (int c)
  1237.      Return 1 if C is an uppercase alphabetic character.
  1238.  - Function: int lowercase_p (int c)
  1239.      Return 1 if C is a lowercase alphabetic character.
  1240.  - Function: int digit_p (int c)
  1241.      Return 1 if C is a numeric character.
  1242.  - Function: int to_upper (int c)
  1243.      If C is a lowercase alphabetic character, return the corresponding
  1244.      uppercase character.
  1245.  - Function: int to_lower (int c)
  1246.      If C is an uppercase alphabetic character, return the corresponding
  1247.      lowercase character.
  1248.  - Function: int digit_value (int c)
  1249.      If C is a number, return the value it represents.
  1250. File: readline.info,  Node: Alternate Interface,  Prev: Utility Functions,  Up: Readline Convenience Functions
  1251. Alternate Interface
  1252. -------------------
  1253.    An alternate interface is available to plain `readline()'.  Some
  1254. applications need to interleave keyboard I/O with file, device, or
  1255. window system I/O, typically by using a main loop to `select()' on
  1256. various file descriptors.  To accomodate this need, readline can also
  1257. be invoked as a `callback' function from an event loop.  There are
  1258. functions available to make this easy.
  1259.  - Function: void rl_callback_handler_install (char *prompt, Vfunction
  1260.           *lhandler)
  1261.      Set up the terminal for readline I/O and display the initial
  1262.      expanded value of PROMPT.  Save the value of LHANDLER to use as a
  1263.      callback when a complete line of input has been entered.
  1264.  - Function: void rl_callback_read_char ()
  1265.      Whenever an application determines that keyboard input is
  1266.      available, it should call `rl_callback_read_char()', which will
  1267.      read the next character from the current input source.  If that
  1268.      character completes the line, `rl_callback_read_char' will invoke
  1269.      the LHANDLER function saved by `rl_callback_handler_install' to
  1270.      process the line.  `EOF' is  indicated by calling LHANDLER with a
  1271.      `NULL' line.
  1272.  - Function: void rl_callback_handler_remove ()
  1273.      Restore the terminal to its initial state and remove the line
  1274.      handler.  This may be called from within a callback as well as
  1275.      independently.
  1276. An Example
  1277. ----------
  1278.    Here is a function which changes lowercase characters to their
  1279. uppercase equivalents, and uppercase characters to lowercase.  If this
  1280. function was bound to `M-c', then typing `M-c' would change the case of
  1281. the character under point.  Typing `M-1 0 M-c' would change the case of
  1282. the following 10 characters, leaving the cursor on the last character
  1283. changed.
  1284.      /* Invert the case of the COUNT following characters. */
  1285.      int
  1286.      invert_case_line (count, key)
  1287.           int count, key;
  1288.      {
  1289.        register int start, end, i;
  1290.      
  1291.        start = rl_point;
  1292.      
  1293.        if (rl_point >= rl_end)
  1294.          return (0);
  1295.      
  1296.        if (count < 0)
  1297.          {
  1298.            direction = -1;
  1299.            count = -count;
  1300.          }
  1301.        else
  1302.          direction = 1;
  1303.      
  1304.        /* Find the end of the range to modify. */
  1305.        end = start + (count * direction);
  1306.      
  1307.        /* Force it to be within range. */
  1308.        if (end > rl_end)
  1309.          end = rl_end;
  1310.        else if (end < 0)
  1311.          end = 0;
  1312.      
  1313.        if (start == end)
  1314.          return (0);
  1315.      
  1316.        if (start > end)
  1317.          {
  1318.            int temp = start;
  1319.            start = end;
  1320.            end = temp;
  1321.          }
  1322.      
  1323.        /* Tell readline that we are modifying the line, so it will save
  1324.           the undo information. */
  1325.        rl_modifying (start, end);
  1326.      
  1327.        for (i = start; i != end; i++)
  1328.          {
  1329.            if (uppercase_p (rl_line_buffer[i]))
  1330.              rl_line_buffer[i] = to_lower (rl_line_buffer[i]);
  1331.            else if (lowercase_p (rl_line_buffer[i]))
  1332.              rl_line_buffer[i] = to_upper (rl_line_buffer[i]);
  1333.          }
  1334.        /* Move point to on top of the last character changed. */
  1335.        rl_point = (direction == 1) ? end - 1 : start;
  1336.        return (0);
  1337.      }
  1338. File: readline.info,  Node: Custom Completers,  Prev: Readline Convenience Functions,  Up: Programming with GNU Readline
  1339. Custom Completers
  1340. =================
  1341.    Typically, a program that reads commands from the user has a way of
  1342. disambiguating commands and data.  If your program is one of these, then
  1343. it can provide completion for commands, data, or both.  The following
  1344. sections describe how your program and Readline cooperate to provide
  1345. this service.
  1346. * Menu:
  1347. * How Completing Works::    The logic used to do completion.
  1348. * Completion Functions::    Functions provided by Readline.
  1349. * Completion Variables::    Variables which control completion.
  1350. * A Short Completion Example::    An example of writing completer subroutines.
  1351. File: readline.info,  Node: How Completing Works,  Next: Completion Functions,  Up: Custom Completers
  1352. How Completing Works
  1353. --------------------
  1354.    In order to complete some text, the full list of possible completions
  1355. must be available.  That is, it is not possible to accurately expand a
  1356. partial word without knowing all of the possible words which make sense
  1357. in that context.  The Readline library provides the user interface to
  1358. completion, and two of the most common completion functions:  filename
  1359. and username.  For completing other types of text, you must write your
  1360. own completion function.  This section describes exactly what such
  1361. functions must do, and provides an example.
  1362.    There are three major functions used to perform completion:
  1363.   1. The user-interface function `rl_complete ()'.  This function is
  1364.      called with the same arguments as other Readline functions
  1365.      intended for interactive use:  COUNT and INVOKING_KEY.  It
  1366.      isolates the word to be completed and calls `completion_matches
  1367.      ()' to generate a list of possible completions.  It then either
  1368.      lists the possible completions, inserts the possible completions,
  1369.      or actually performs the completion, depending on which behavior
  1370.      is desired.
  1371.   2. The internal function `completion_matches ()' uses your
  1372.      "generator" function to generate the list of possible matches, and
  1373.      then returns the array of these matches.  You should place the
  1374.      address of your generator function in
  1375.      `rl_completion_entry_function'.
  1376.   3. The generator function is called repeatedly from
  1377.      `completion_matches ()', returning a string each time.  The
  1378.      arguments to the generator function are TEXT and STATE.  TEXT is
  1379.      the partial word to be completed.  STATE is zero the first time
  1380.      the function is called, allowing the generator to perform any
  1381.      necessary initialization, and a positive non-zero integer for each
  1382.      subsequent call.  When the generator function returns `(char
  1383.      *)NULL' this signals `completion_matches ()' that there are no
  1384.      more possibilities left.  Usually the generator function computes
  1385.      the list of possible completions when STATE is zero, and returns
  1386.      them one at a time on subsequent calls.  Each string the generator
  1387.      function returns as a match must be allocated with `malloc()';
  1388.      Readline frees the strings when it has finished with them.
  1389.  - Function: int rl_complete (int ignore, int invoking_key)
  1390.      Complete the word at or before point.  You have supplied the
  1391.      function that does the initial simple matching selection algorithm
  1392.      (see `completion_matches ()').  The default is to do filename
  1393.      completion.
  1394.  - Variable: Function * rl_completion_entry_function
  1395.      This is a pointer to the generator function for `completion_matches
  1396.      ()'.  If the value of `rl_completion_entry_function' is `(Function
  1397.      *)NULL' then the default filename generator function,
  1398.      `filename_completion_function ()', is used.
  1399. File: readline.info,  Node: Completion Functions,  Next: Completion Variables,  Prev: How Completing Works,  Up: Custom Completers
  1400. Completion Functions
  1401. --------------------
  1402.    Here is the complete list of callable completion functions present in
  1403. Readline.
  1404.  - Function: int rl_complete_internal (int what_to_do)
  1405.      Complete the word at or before point.  WHAT_TO_DO says what to do
  1406.      with the completion.  A value of `?' means list the possible
  1407.      completions.  `TAB' means do standard completion.  `*' means
  1408.      insert all of the possible completions.  `!' means to display all
  1409.      of the possible completions, if there is more than one, as well as
  1410.      performing partial completion.
  1411.  - Function: int rl_complete (int ignore, int invoking_key)
  1412.      Complete the word at or before point.  You have supplied the
  1413.      function that does the initial simple matching selection algorithm
  1414.      (see `completion_matches ()' and `rl_completion_entry_function').
  1415.      The default is to do filename completion.  This calls
  1416.      `rl_complete_internal ()' with an argument depending on
  1417.      INVOKING_KEY.
  1418.  - Function: int rl_possible_completions (int count, int invoking_key))
  1419.      List the possible completions.  See description of `rl_complete
  1420.      ()'.  This calls `rl_complete_internal ()' with an argument of `?'.
  1421.  - Function: int rl_insert_completions (int count, int invoking_key))
  1422.      Insert the list of possible completions into the line, deleting the
  1423.      partially-completed word.  See description of `rl_complete ()'.
  1424.      This calls `rl_complete_internal ()' with an argument of `*'.
  1425.  - Function: char ** completion_matches (char *text, CPFunction
  1426.           *entry_func)
  1427.      Returns an array of `(char *)' which is a list of completions for
  1428.      TEXT.  If there are no completions, returns `(char **)NULL'.  The
  1429.      first entry in the returned array is the substitution for TEXT.
  1430.      The remaining entries are the possible completions.  The array is
  1431.      terminated with a `NULL' pointer.
  1432.      ENTRY_FUNC is a function of two args, and returns a `(char *)'.
  1433.      The first argument is TEXT.  The second is a state argument; it is
  1434.      zero on the first call, and non-zero on subsequent calls.
  1435.      eNTRY_FUNC returns a `NULL'  pointer to the caller when there are
  1436.      no more matches.
  1437.  - Function: char * filename_completion_function (char *text, int state)
  1438.      A generator function for filename completion in the general case.
  1439.      Note that completion in Bash is a little different because of all
  1440.      the pathnames that must be followed when looking up completions
  1441.      for a command.  The Bash source is a useful reference for writing
  1442.      custom completion functions.
  1443.  - Function: char * username_completion_function (char *text, int state)
  1444.      A completion generator for usernames.  TEXT contains a partial
  1445.      username preceded by a random character (usually `~').  As with all
  1446.      completion generators, STATE is zero on the first call and non-zero
  1447.      for subsequent calls.
  1448. File: readline.info,  Node: Completion Variables,  Next: A Short Completion Example,  Prev: Completion Functions,  Up: Custom Completers
  1449. Completion Variables
  1450. --------------------
  1451.  - Variable: Function * rl_completion_entry_function
  1452.      A pointer to the generator function for `completion_matches ()'.
  1453.      `NULL' means to use `filename_entry_function ()', the default
  1454.      filename completer.
  1455.  - Variable: CPPFunction * rl_attempted_completion_function
  1456.      A pointer to an alternative function to create matches.  The
  1457.      function is called with TEXT, START, and END.  START and END are
  1458.      indices in `rl_line_buffer' saying what the boundaries of TEXT
  1459.      are.  If this function exists and returns `NULL', or if this
  1460.      variable is set to `NULL', then `rl_complete ()' will call the
  1461.      value of `rl_completion_entry_function' to generate matches,
  1462.      otherwise the array of strings returned will be used.
  1463.  - Variable: CPFunction * rl_filename_quoting_function
  1464.      A pointer to a function that will quote a filename in an
  1465.      application- specific fashion.  This is called if filename
  1466.      completion is being attempted and one of the characters in
  1467.      `rl_filename_quote_characters' appears in a completed filename.
  1468.      The function is called with TEXT, MATCH_TYPE, and QUOTE_POINTER.
  1469.      The TEXT is the filename to be quoted.  The MATCH_TYPE is either
  1470.      `SINGLE_MATCH', if there is only one completion match, or
  1471.      `MULT_MATCH'.  Some functions use this to decide whether or not to
  1472.      insert a closing quote character.  The QUOTE_POINTER is a pointer
  1473.      to any opening quote character the user typed.  Some functions
  1474.      choose to reset this character.
  1475.  - Variable: CPFunction * rl_filename_dequoting_function
  1476.      A pointer to a function that will remove application-specific
  1477.      quoting characters from a filename before completion is attempted,
  1478.      so those characters do not interfere with matching the text
  1479.      against names in the filesystem.  It is called with TEXT, the text
  1480.      of the word to be dequoted, and QUOTE_CHAR, which is the quoting
  1481.      character that delimits the filename (usually `'' or `"').  If
  1482.      QUOTE_CHAR is zero, the filename was not in an embedded string.
  1483.  - Variable: Function * rl_char_is_quoted_p
  1484.      A pointer to a function to call that determines whether or not a
  1485.      specific character in the line buffer is quoted, according to
  1486.      whatever quoting mechanism the program calling readline uses.  The
  1487.      function is called with two arguments: TEXT, the text of the line,
  1488.      and INDEX, the index of the character in the line.  It is used to
  1489.      decide whether a character found in
  1490.      `rl_completer_word_break_characters' should be used to break words
  1491.      for the completer.
  1492.  - Variable: int rl_completion_query_items
  1493.      Up to this many items will be displayed in response to a
  1494.      possible-completions call.  After that, we ask the user if she is
  1495.      sure she wants to see them all.  The default value is 100.
  1496.  - Variable: char * rl_basic_word_break_characters
  1497.      The basic list of characters that signal a break between words for
  1498.      the completer routine.  The default value of this variable is the
  1499.      characters which break words for completion in Bash, i.e., `"
  1500.      \t\n\"\\'`@$><=;|&{("'.
  1501.  - Variable: char * rl_basic_quote_characters
  1502.      List of quote characters which can cause a word break.
  1503.  - Variable: char * rl_completer_word_break_characters
  1504.      The list of characters that signal a break between words for
  1505.      `rl_complete_internal ()'.  The default list is the value of
  1506.      `rl_basic_word_break_characters'.
  1507.  - Variable: char * rl_completer_quote_characters
  1508.      List of characters which can be used to quote a substring of the
  1509.      line.  Completion occurs on the entire substring, and within the
  1510.      substring `rl_completer_word_break_characters' are treated as any
  1511.      other character, unless they also appear within this list.
  1512.  - Variable: char * rl_filename_quote_characters
  1513.      A list of characters that cause a filename to be quoted by the
  1514.      completer when they appear in a completed filename.  The default
  1515.      is empty.
  1516.  - Variable: char * rl_special_prefixes
  1517.      The list of characters that are word break characters, but should
  1518.      be left in TEXT when it is passed to the completion function.
  1519.      Programs can use this to help determine what kind of completing to
  1520.      do.  For instance, Bash sets this variable to "$@" so that it can
  1521.      complete shell variables and hostnames.
  1522.  - Variable: int rl_completion_append_character
  1523.      When a single completion alternative matches at the end of the
  1524.      command line, this character is appended to the inserted
  1525.      completion text.  The default is a space character (` ').  Setting
  1526.      this to the null character (`\0') prevents anything being appended
  1527.      automatically.  This can be changed in custom completion functions
  1528.      to provide the "most sensible word separator character" according
  1529.      to an application-specific command line syntax specification.
  1530.  - Variable: int rl_ignore_completion_duplicates
  1531.      If non-zero, then disallow duplicates in the matches.  Default is
  1532.      1.
  1533.  - Variable: int rl_filename_completion_desired
  1534.      Non-zero means that the results of the matches are to be treated as
  1535.      filenames.  This is *always* zero on entry, and can only be changed
  1536.      within a completion entry generator function.  If it is set to a
  1537.      non-zero value, directory names have a slash appended and Readline
  1538.      attempts to quote completed filenames if they contain any embedded
  1539.      word break characters.
  1540.  - Variable: int rl_filename_quoting_desired
  1541.      Non-zero means that the results of the matches are to be quoted
  1542.      using double quotes (or an application-specific quoting mechanism)
  1543.      if the completed filename contains any characters in
  1544.      `rl_filename_quote_chars'.  This is *always* non-zero on entry,
  1545.      and can only be changed within a completion entry generator
  1546.      function.  The quoting is effected via a call to the function
  1547.      pointed to by `rl_filename_quoting_function'.
  1548.  - Variable: int rl_inhibit_completion
  1549.      If this variable is non-zero, completion is inhibit<ed.  The
  1550.      completion character will be inserted as any other bound to
  1551.      `self-insert'.
  1552.  - Variable: Function * rl_ignore_some_completions_function
  1553.      This function, if defined, is called by the completer when real
  1554.      filename completion is done, after all the matching names have
  1555.      been generated.  It is passed a `NULL' terminated array of matches.
  1556.      The first element (`matches[0]') is the maximal substring common
  1557.      to all matches. This function can re-arrange the list of matches
  1558.      as required, but each element deleted from the array must be freed.
  1559.  - Variable: Function * rl_directory_completion_hook
  1560.      This function, if defined, is allowed to modify the directory
  1561.      portion of filenames Readline completes.  It is called with the
  1562.      address of a string (the current directory name) as an argument.
  1563.      It could be used to expand symbolic links or shell variables in
  1564.      pathnames.
  1565. File: readline.info,  Node: A Short Completion Example,  Prev: Completion Variables,  Up: Custom Completers
  1566. A Short Completion Example
  1567. --------------------------
  1568.    Here is a small application demonstrating the use of the GNU Readline
  1569. library.  It is called `fileman', and the source code resides in
  1570. `examples/fileman.c'.  This sample application provides completion of
  1571. command names, line editing features, and access to the history list.
  1572.      /* fileman.c -- A tiny application which demonstrates how to use the
  1573.         GNU Readline library.  This application interactively allows users
  1574.         to manipulate files and their modes. */
  1575.      
  1576.      #include <stdio.h>
  1577.      #include <sys/types.h>
  1578.      #include <sys/file.h>
  1579.      #include <sys/stat.h>
  1580.      #include <sys/errno.h>
  1581.      
  1582.      #include <readline/readline.h>
  1583.      #include <readline/history.h>
  1584.      
  1585.      extern char *getwd ();
  1586.      extern char *xmalloc ();
  1587.      
  1588.      /* The names of functions that actually do the manipulation. */
  1589.      int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
  1590.      int com_delete (), com_help (), com_cd (), com_quit ();
  1591.      
  1592.      /* A structure which contains information on the commands this program
  1593.         can understand. */
  1594.      
  1595.      typedef struct {
  1596.        char *name;            /* User printable name of the function. */
  1597.        Function *func;        /* Function to call to do the job. */
  1598.        char *doc;            /* Documentation for this function.  */
  1599.      } COMMAND;
  1600.      
  1601.      COMMAND commands[] = {
  1602.        { "cd", com_cd, "Change to directory DIR" },
  1603.        { "delete", com_delete, "Delete FILE" },
  1604.        { "help", com_help, "Display this text" },
  1605.        { "?", com_help, "Synonym for `help'" },
  1606.        { "list", com_list, "List files in DIR" },
  1607.        { "ls", com_list, "Synonym for `list'" },
  1608.        { "pwd", com_pwd, "Print the current working directory" },
  1609.        { "quit", com_quit, "Quit using Fileman" },
  1610.        { "rename", com_rename, "Rename FILE to NEWNAME" },
  1611.        { "stat", com_stat, "Print out statistics on FILE" },
  1612.        { "view", com_view, "View the contents of FILE" },
  1613.        { (char *)NULL, (Function *)NULL, (char *)NULL }
  1614.      };
  1615.      
  1616.      /* Forward declarations. */
  1617.      char *stripwhite ();
  1618.      COMMAND *find_command ();
  1619.      
  1620.      /* The name of this program, as taken from argv[0]. */
  1621.      char *progname;
  1622.      
  1623.      /* When non-zero, this global means the user is done using this program. */
  1624.      int done;
  1625.      
  1626.      char *
  1627.      dupstr (s)
  1628.           int s;
  1629.      {
  1630.        char *r;
  1631.      
  1632.        r = xmalloc (strlen (s) + 1);
  1633.        strcpy (r, s);
  1634.        return (r);
  1635.      }
  1636.      
  1637.      main (argc, argv)
  1638.           int argc;
  1639.           char **argv;
  1640.      {
  1641.        char *line, *s;
  1642.      
  1643.        progname = argv[0];
  1644.      
  1645.        initialize_readline ();    /* Bind our completer. */
  1646.      
  1647.        /* Loop reading and executing lines until the user quits. */
  1648.        for ( ; done == 0; )
  1649.          {
  1650.            line = readline ("FileMan: ");
  1651.      
  1652.            if (!line)
  1653.              break;
  1654.      
  1655.            /* Remove leading and trailing whitespace from the line.
  1656.               Then, if there is anything left, add it to the history list
  1657.               and execute it. */
  1658.            s = stripwhite (line);
  1659.      
  1660.            if (*s)
  1661.              {
  1662.                add_history (s);
  1663.                execute_line (s);
  1664.              }
  1665.      
  1666.            free (line);
  1667.          }
  1668.        exit (0);
  1669.      }
  1670.      
  1671.      /* Execute a command line. */
  1672.      int
  1673.      execute_line (line)
  1674.           char *line;
  1675.      {
  1676.        register int i;
  1677.        COMMAND *command;
  1678.        char *word;
  1679.      
  1680.        /* Isolate the command word. */
  1681.        i = 0;
  1682.        while (line[i] && whitespace (line[i]))
  1683.          i++;
  1684.        word = line + i;
  1685.      
  1686.        while (line[i] && !whitespace (line[i]))
  1687.          i++;
  1688.      
  1689.        if (line[i])
  1690.          line[i++] = '\0';
  1691.      
  1692.        command = find_command (word);
  1693.      
  1694.        if (!command)
  1695.          {
  1696.            fprintf (stderr, "%s: No such command for FileMan.\n", word);
  1697.            return (-1);
  1698.          }
  1699.      
  1700.        /* Get argument to command, if any. */
  1701.        while (whitespace (line[i]))
  1702.          i++;
  1703.      
  1704.        word = line + i;
  1705.      
  1706.        /* Call the function. */
  1707.        return ((*(command->func)) (word));
  1708.      }
  1709.      
  1710.      /* Look up NAME as the name of a command, and return a pointer to that
  1711.         command.  Return a NULL pointer if NAME isn't a command name. */
  1712.      COMMAND *
  1713.      find_command (name)
  1714.           char *name;
  1715.      {
  1716.        register int i;
  1717.      
  1718.        for (i = 0; commands[i].name; i++)
  1719.          if (strcmp (name, commands[i].name) == 0)
  1720.            return (&commands[i]);
  1721.      
  1722.        return ((COMMAND *)NULL);
  1723.      }
  1724.      
  1725.      /* Strip whitespace from the start and end of STRING.  Return a pointer
  1726.         into STRING. */
  1727.      char *
  1728.      stripwhite (string)
  1729.           char *string;
  1730.      {
  1731.        register char *s, *t;
  1732.      
  1733.        for (s = string; whitespace (*s); s++)
  1734.          ;
  1735.      
  1736.        if (*s == 0)
  1737.          return (s);
  1738.      
  1739.        t = s + strlen (s) - 1;
  1740.        while (t > s && whitespace (*t))
  1741.          t--;
  1742.        *++t = '\0';
  1743.      
  1744.        return s;
  1745.      }
  1746.      
  1747.      /* **************************************************************** */
  1748.      /*                                                                  */
  1749.      /*                  Interface to Readline Completion                */
  1750.      /*                                                                  */
  1751.      /* **************************************************************** */
  1752.      
  1753.      char *command_generator ();
  1754.      char **fileman_completion ();
  1755.      
  1756.      /* Tell the GNU Readline library how to complete.  We want to try to complete
  1757.         on command names if this is the first word in the line, or on filenames
  1758.         if not. */
  1759.      initialize_readline ()
  1760.      {
  1761.        /* Allow conditional parsing of the ~/.inputrc file. */
  1762.        rl_readline_name = "FileMan";
  1763.      
  1764.        /* Tell the completer that we want a crack first. */
  1765.        rl_attempted_completion_function = (CPPFunction *)fileman_completion;
  1766.      }
  1767.      
  1768.      /* Attempt to complete on the contents of TEXT.  START and END bound the
  1769.         region of rl_line_buffer that contains the word to complete.  TEXT is
  1770.         the word to complete.  We can use the entire contents of rl_line_buffer
  1771.         in case we want to do some simple parsing.  Return the array of matches,
  1772.         or NULL if there aren't any. */
  1773.      char **
  1774.      fileman_completion (text, start, end)
  1775.           char *text;
  1776.           int start, end;
  1777.      {
  1778.        char **matches;
  1779.      
  1780.        matches = (char **)NULL;
  1781.      
  1782.        /* If this word is at the start of the line, then it is a command
  1783.           to complete.  Otherwise it is the name of a file in the current
  1784.           directory. */
  1785.        if (start == 0)
  1786.          matches = completion_matches (text, command_generator);
  1787.      
  1788.        return (matches);
  1789.      }
  1790.      
  1791.      /* Generator function for command completion.  STATE lets us know whether
  1792.         to start from scratch; without any state (i.e. STATE == 0), then we
  1793.         start at the top of the list. */
  1794.      char *
  1795.      command_generator (text, state)
  1796.           char *text;
  1797.           int state;
  1798.      {
  1799.        static int list_index, len;
  1800.        char *name;
  1801.      
  1802.        /* If this is a new word to complete, initialize now.  This includes
  1803.           saving the length of TEXT for efficiency, and initializing the index
  1804.           variable to 0. */
  1805.        if (!state)
  1806.          {
  1807.            list_index = 0;
  1808.            len = strlen (text);
  1809.          }
  1810.      
  1811.        /* Return the next name which partially matches from the command list. */
  1812.        while (name = commands[list_index].name)
  1813.          {
  1814.            list_index++;
  1815.      
  1816.            if (strncmp (name, text, len) == 0)
  1817.              return (dupstr(name));
  1818.          }
  1819.      
  1820.        /* If no names matched, then return NULL. */
  1821.        return ((char *)NULL);
  1822.      }
  1823.      
  1824.      /* **************************************************************** */
  1825.      /*                                                                  */
  1826.      /*                       FileMan Commands                           */
  1827.      /*                                                                  */
  1828.      /* **************************************************************** */
  1829.      
  1830.      /* String to pass to system ().  This is for the LIST, VIEW and RENAME
  1831.         commands. */
  1832.      static char syscom[1024];
  1833.      
  1834.      /* List the file(s) named in arg. */
  1835.      com_list (arg)
  1836.           char *arg;
  1837.      {
  1838.        if (!arg)
  1839.          arg = "";
  1840.      
  1841.        sprintf (syscom, "ls -FClg %s", arg);
  1842.        return (system (syscom));
  1843.      }
  1844.      
  1845.      com_view (arg)
  1846.           char *arg;
  1847.      {
  1848.        if (!valid_argument ("view", arg))
  1849.          return 1;
  1850.      
  1851.        sprintf (syscom, "more %s", arg);
  1852.        return (system (syscom));
  1853.      }
  1854.      
  1855.      com_rename (arg)
  1856.           char *arg;
  1857.      {
  1858.        too_dangerous ("rename");
  1859.        return (1);
  1860.      }
  1861.      
  1862.      com_stat (arg)
  1863.           char *arg;
  1864.      {
  1865.        struct stat finfo;
  1866.      
  1867.        if (!valid_argument ("stat", arg))
  1868.          return (1);
  1869.      
  1870.        if (stat (arg, &finfo) == -1)
  1871.          {
  1872.            perror (arg);
  1873.            return (1);
  1874.          }
  1875.      
  1876.        printf ("Statistics for `%s':\n", arg);
  1877.      
  1878.        printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
  1879.                finfo.st_nlink,
  1880.                (finfo.st_nlink == 1) ? "" : "s",
  1881.                finfo.st_size,
  1882.                (finfo.st_size == 1) ? "" : "s");
  1883.        printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
  1884.        printf ("      Last access at: %s", ctime (&finfo.st_atime));
  1885.        printf ("    Last modified at: %s", ctime (&finfo.st_mtime));
  1886.        return (0);
  1887.      }
  1888.      
  1889.      com_delete (arg)
  1890.           char *arg;
  1891.      {
  1892.        too_dangerous ("delete");
  1893.        return (1);
  1894.      }
  1895.      
  1896.      /* Print out help for ARG, or for all of the commands if ARG is
  1897.         not present. */
  1898.      com_help (arg)
  1899.           char *arg;
  1900.      {
  1901.        register int i;
  1902.        int printed = 0;
  1903.      
  1904.        for (i = 0; commands[i].name; i++)
  1905.          {
  1906.            if (!*arg || (strcmp (arg, commands[i].name) == 0))
  1907.              {
  1908.                printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
  1909.                printed++;
  1910.              }
  1911.          }
  1912.      
  1913.        if (!printed)
  1914.          {
  1915.            printf ("No commands match `%s'.  Possibilties are:\n", arg);
  1916.      
  1917.            for (i = 0; commands[i].name; i++)
  1918.              {
  1919.                /* Print in six columns. */
  1920.                if (printed == 6)
  1921.                  {
  1922.                    printed = 0;
  1923.                    printf ("\n");
  1924.                  }
  1925.      
  1926.                printf ("%s\t", commands[i].name);
  1927.                printed++;
  1928.              }
  1929.      
  1930.            if (printed)
  1931.              printf ("\n");
  1932.          }
  1933.        return (0);
  1934.      }
  1935.      
  1936.      /* Change to the directory ARG. */
  1937.      com_cd (arg)
  1938.           char *arg;
  1939.      {
  1940.        if (chdir (arg) == -1)
  1941.          {
  1942.            perror (arg);
  1943.            return 1;
  1944.          }
  1945.      
  1946.        com_pwd ("");
  1947.        return (0);
  1948.      }
  1949.      
  1950.      /* Print out the current working directory. */
  1951.      com_pwd (ignore)
  1952.           char *ignore;
  1953.      {
  1954.        char dir[1024], *s;
  1955.      
  1956.        s = getwd (dir);
  1957.        if (s == 0)
  1958.          {
  1959.            printf ("Error getting pwd: %s\n", dir);
  1960.            return 1;
  1961.          }
  1962.      
  1963.        printf ("Current directory is %s\n", dir);
  1964.        return 0;
  1965.      }
  1966.      
  1967.      /* The user wishes to quit using this program.  Just set DONE non-zero. */
  1968.      com_quit (arg)
  1969.           char *arg;
  1970.      {
  1971.        done = 1;
  1972.        return (0);
  1973.      }
  1974.      
  1975.      /* Function which tells you that you can't do this. */
  1976.      too_dangerous (caller)
  1977.           char *caller;
  1978.      {
  1979.        fprintf (stderr,
  1980.                 "%s: Too dangerous for me to distribute.  Write it yourself.\n",
  1981.                 caller);
  1982.      }
  1983.      
  1984.      /* Return non-zero if ARG is a valid argument for CALLER, else print
  1985.         an error message and return zero. */
  1986.      int
  1987.      valid_argument (caller, arg)
  1988.           char *caller, *arg;
  1989.      {
  1990.        if (!arg || !*arg)
  1991.          {
  1992.            fprintf (stderr, "%s: Argument required.\n", caller);
  1993.            return (0);
  1994.          }
  1995.      
  1996.        return (1);
  1997.      }
  1998. File: readline.info,  Node: Concept Index,  Next: Function and Variable Index,  Prev: Programming with GNU Readline,  Up: Top
  1999. Concept Index
  2000. *************
  2001. * Menu:
  2002. * command editing:                      Readline Bare Essentials.
  2003. * editing command lines:                Readline Bare Essentials.
  2004. * initialization file, readline:        Readline Init File.
  2005. * interaction, readline:                Readline Interaction.
  2006. * kill ring:                            Readline Killing Commands.
  2007. * killing text:                         Readline Killing Commands.
  2008. * notation, readline:                   Readline Bare Essentials.
  2009. * readline, function:                   Basic Behavior.
  2010. * yanking text:                         Readline Killing Commands.
  2011. File: readline.info,  Node: Function and Variable Index,  Prev: Concept Index,  Up: Top
  2012. Function and Variable Index
  2013. ***************************
  2014. * Menu:
  2015. * (:                                    Utility Functions.
  2016. * abort (C-g):                          Miscellaneous Commands.
  2017. * accept-line (Newline, Return):        Commands For History.
  2018. * alphabetic:                           Utility Functions.
  2019. * backward-char (C-b):                  Commands For Moving.
  2020. * backward-delete-char (Rubout):        Commands For Text.
  2021. * backward-kill-line (C-x Rubout):      Commands For Killing.
  2022. * backward-kill-word (M-DEL):           Commands For Killing.
  2023. * backward-word (M-b):                  Commands For Moving.
  2024. * beginning-of-history (M-<):           Commands For History.
  2025. * beginning-of-line (C-a):              Commands For Moving.
  2026. * bell-style:                           Readline Init File Syntax.
  2027. * call-last-kbd-macro (C-x e):          Keyboard Macros.
  2028. * capitalize-word (M-c):                Commands For Text.
  2029. * character-search (C-]):               Miscellaneous Commands.
  2030. * character-search-backward (M-C-]):    Miscellaneous Commands.
  2031. * clear-screen (C-l):                   Commands For Moving.
  2032. * comment-begin:                        Readline Init File Syntax.
  2033. * complete (TAB):                       Commands For Completion.
  2034. * completion-query-items:               Readline Init File Syntax.
  2035. * completion_matches:                   Completion Functions.
  2036. * convert-meta:                         Readline Init File Syntax.
  2037. * copy-backward-word ():                Commands For Killing.
  2038. * copy-forward-word ():                 Commands For Killing.
  2039. * copy-region-as-kill ():               Commands For Killing.
  2040. * delete-char (C-d):                    Commands For Text.
  2041. * delete-horizontal-space ():           Commands For Killing.
  2042. * digit-argument (M-0, M-1, ... M-):    Numeric Arguments.
  2043. * digit_p:                              Utility Functions.
  2044. * digit_value:                          Utility Functions.
  2045. * ding:                                 Utility Functions.
  2046. * disable-completion:                   Readline Init File Syntax.
  2047. * do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands.
  2048. * downcase-word (M-l):                  Commands For Text.
  2049. * dump-functions ():                    Miscellaneous Commands.
  2050. * dump-macros ():                       Miscellaneous Commands.
  2051. * dump-variables ():                    Miscellaneous Commands.
  2052. * editing-mode:                         Readline Init File Syntax.
  2053. * enable-keypad:                        Readline Init File Syntax.
  2054. * end-kbd-macro (C-x )):                Keyboard Macros.
  2055. * end-of-history (M->):                 Commands For History.
  2056. * end-of-line (C-e):                    Commands For Moving.
  2057. * exchange-point-and-mark (C-x C-x):    Miscellaneous Commands.
  2058. * expand-tilde:                         Readline Init File Syntax.
  2059. * filename_completion_function:         Completion Functions.
  2060. * forward-char (C-f):                   Commands For Moving.
  2061. * forward-search-history (C-s):         Commands For History.
  2062. * forward-word (M-f):                   Commands For Moving.
  2063. * free_undo_list:                       Allowing Undoing.
  2064. * history-search-backward ():           Commands For History.
  2065. * history-search-forward ():            Commands For History.
  2066. * horizontal-scroll-mode:               Readline Init File Syntax.
  2067. * input-meta:                           Readline Init File Syntax.
  2068. * insert-comment (M-#):                 Miscellaneous Commands.
  2069. * insert-completions (M-*):             Commands For Completion.
  2070. * keymap:                               Readline Init File Syntax.
  2071. * kill-line (C-k):                      Commands For Killing.
  2072. * kill-region ():                       Commands For Killing.
  2073. * kill-whole-line ():                   Commands For Killing.
  2074. * kill-word (M-d):                      Commands For Killing.
  2075. * lowercase_p:                          Utility Functions.
  2076. * mark-modified-lines:                  Readline Init File Syntax.
  2077. * meta-flag:                            Readline Init File Syntax.
  2078. * next-history (C-n):                   Commands For History.
  2079. * non-incremental-forward-search-history (M-n): Commands For History.
  2080. * non-incremental-reverse-search-history (M-p): Commands For History.
  2081. * numeric:                              Utility Functions.
  2082. * output-meta:                          Readline Init File Syntax.
  2083. * possible-completions (M-?):           Commands For Completion.
  2084. * prefix-meta (ESC):                    Miscellaneous Commands.
  2085. * previous-history (C-p):               Commands For History.
  2086. * quoted-insert (C-q, C-v):             Commands For Text.
  2087. * re-read-init-file (C-x C-r):          Miscellaneous Commands.
  2088. * readline:                             Basic Behavior.
  2089. * redraw-current-line ():               Commands For Moving.
  2090. * reverse-search-history (C-r):         Commands For History.
  2091. * revert-line (M-r):                    Miscellaneous Commands.
  2092. * rl_add_defun:                         Function Naming.
  2093. * rl_add_undo:                          Allowing Undoing.
  2094. * rl_attempted_completion_function:     Completion Variables.
  2095. * rl_basic_quote_characters:            Completion Variables.
  2096. * rl_basic_word_break_characters:       Completion Variables.
  2097. * rl_begin_undo_group:                  Allowing Undoing.
  2098. * rl_binding_keymap:                    Readline Variables.
  2099. * rl_bind_key:                          Binding Keys.
  2100. * rl_bind_key_in_map:                   Binding Keys.
  2101. * rl_callback_handler_install:          Alternate Interface.
  2102. * rl_callback_handler_remove:           Alternate Interface.
  2103. * rl_callback_read_char:                Alternate Interface.
  2104. * rl_char_is_quoted_p:                  Completion Variables.
  2105. * rl_clear_message:                     Redisplay.
  2106. * rl_complete:                          Completion Functions.
  2107. * rl_complete:                          How Completing Works.
  2108. * rl_completer_quote_characters:        Completion Variables.
  2109. * rl_completer_word_break_characters:   Completion Variables.
  2110. * rl_complete_internal:                 Completion Functions.
  2111. * rl_completion_append_character:       Completion Variables.
  2112. * rl_completion_entry_function:         Completion Variables.
  2113. * rl_completion_entry_function:         How Completing Works.
  2114. * rl_completion_query_items:            Completion Variables.
  2115. * rl_copy_keymap:                       Keymaps.
  2116. * rl_copy_text:                         Modifying Text.
  2117. * rl_delete_text:                       Modifying Text.
  2118. * rl_directory_completion_hook:         Completion Variables.
  2119. * rl_discard_keymap:                    Keymaps.
  2120. * rl_done:                              Readline Variables.
  2121. * rl_do_undo:                           Allowing Undoing.
  2122. * rl_end:                               Readline Variables.
  2123. * rl_end_undo_group:                    Allowing Undoing.
  2124. * rl_event_hook:                        Readline Variables.
  2125. * rl_executing_keymap:                  Readline Variables.
  2126. * rl_filename_completion_desired:       Completion Variables.
  2127. * rl_filename_dequoting_function:       Completion Variables.
  2128. * rl_filename_quote_characters:         Completion Variables.
  2129. * rl_filename_quoting_desired:          Completion Variables.
  2130. * rl_filename_quoting_function:         Completion Variables.
  2131. * rl_forced_update_display:             Redisplay.
  2132. * rl_function_dumper:                   Associating Function Names and Bindings.
  2133. * rl_function_of_keyseq:                Associating Function Names and Bindings.
  2134. * rl_generic_bind:                      Binding Keys.
  2135. * rl_getc:                              Utility Functions.
  2136. * rl_getc_function:                     Readline Variables.
  2137. * rl_get_keymap:                        Keymaps.
  2138. * rl_get_keymap_by_name:                Keymaps.
  2139. * rl_get_keymap_name:                   Keymaps.
  2140. * rl_ignore_completion_duplicates:      Completion Variables.
  2141. * rl_ignore_some_completions_function:  Completion Variables.
  2142. * rl_inhibit_completion:                Completion Variables.
  2143. * rl_initialize:                        Utility Functions.
  2144. * rl_insert_completions:                Completion Functions.
  2145. * rl_insert_text:                       Modifying Text.
  2146. * rl_instream:                          Readline Variables.
  2147. * rl_invoking_keyseqs:                  Associating Function Names and Bindings.
  2148. * rl_invoking_keyseqs_in_map:           Associating Function Names and Bindings.
  2149. * rl_kill_text:                         Modifying Text.
  2150. * rl_library_version:                   Readline Variables.
  2151. * rl_line_buffer:                       Readline Variables.
  2152. * rl_list_funmap_names:                 Associating Function Names and Bindings.
  2153. * rl_make_bare_keymap:                  Keymaps.
  2154. * rl_make_keymap:                       Keymaps.
  2155. * rl_mark:                              Readline Variables.
  2156. * rl_message:                           Redisplay.
  2157. * rl_modifying:                         Allowing Undoing.
  2158. * rl_named_function:                    Associating Function Names and Bindings.
  2159. * rl_on_new_line:                       Redisplay.
  2160. * rl_outstream:                         Readline Variables.
  2161. * rl_parse_and_bind:                    Binding Keys.
  2162. * rl_pending_input:                     Readline Variables.
  2163. * rl_point:                             Readline Variables.
  2164. * rl_possible_completions:              Completion Functions.
  2165. * rl_prompt:                            Readline Variables.
  2166. * rl_readline_name:                     Readline Variables.
  2167. * rl_read_init_file:                    Binding Keys.
  2168. * rl_read_key:                          Utility Functions.
  2169. * rl_redisplay:                         Redisplay.
  2170. * rl_redisplay_function:                Readline Variables.
  2171. * rl_reset_line_state:                  Redisplay.
  2172. * rl_reset_terminal:                    Utility Functions.
  2173. * rl_set_keymap:                        Keymaps.
  2174. * rl_special_prefixes:                  Completion Variables.
  2175. * rl_startup_hook:                      Readline Variables.
  2176. * rl_stuff_char:                        Utility Functions.
  2177. * rl_terminal_name:                     Readline Variables.
  2178. * rl_unbind_key:                        Binding Keys.
  2179. * rl_unbind_key_in_map:                 Binding Keys.
  2180. * self-insert (a, b, A, 1, !, ...):     Commands For Text.
  2181. * set-mark (C-@):                       Miscellaneous Commands.
  2182. * show-all-if-ambiguous:                Readline Init File Syntax.
  2183. * start-kbd-macro (C-x ():              Keyboard Macros.
  2184. * tab-insert (M-TAB):                   Commands For Text.
  2185. * tilde-expand (M-~):                   Miscellaneous Commands.
  2186. * to_lower:                             Utility Functions.
  2187. * to_upper:                             Utility Functions.
  2188. * transpose-chars (C-t):                Commands For Text.
  2189. * transpose-words (M-t):                Commands For Text.
  2190. * undo (C-_, C-x C-u):                  Miscellaneous Commands.
  2191. * universal-argument ():                Numeric Arguments.
  2192. * unix-line-discard (C-u):              Commands For Killing.
  2193. * unix-word-rubout (C-w):               Commands For Killing.
  2194. * upcase-word (M-u):                    Commands For Text.
  2195. * uppercase_p:                          Utility Functions.
  2196. * username_completion_function:         Completion Functions.
  2197. * visible-stats:                        Readline Init File Syntax.
  2198. * yank (C-y):                           Commands For Killing.
  2199. * yank-last-arg (M-., M-_):             Commands For History.
  2200. * yank-nth-arg (M-C-y):                 Commands For History.
  2201. * yank-pop (M-y):                       Commands For Killing.
  2202. Tag Table:
  2203. Node: Top
  2204. Node: Command Line Editing
  2205. Node: Introduction and Notation
  2206. Node: Readline Interaction
  2207. Node: Readline Bare Essentials
  2208. Node: Readline Movement Commands
  2209. Node: Readline Killing Commands
  2210. Node: Readline Arguments
  2211. Node: Searching
  2212. Node: Readline Init File
  2213. 11203
  2214. Node: Readline Init File Syntax
  2215. 12266
  2216. Node: Conditional Init Constructs
  2217. 20056
  2218. Node: Sample Init File
  2219. 22338
  2220. Node: Bindable Readline Commands
  2221. 25372
  2222. Node: Commands For Moving
  2223. 26123
  2224. Node: Commands For History
  2225. 26971
  2226. Node: Commands For Text
  2227. 29585
  2228. Node: Commands For Killing
  2229. 31328
  2230. Node: Numeric Arguments
  2231. 33355
  2232. Node: Commands For Completion
  2233. 34480
  2234. Node: Keyboard Macros
  2235. 35364
  2236. Node: Miscellaneous Commands
  2237. 35923
  2238. Node: Readline vi Mode
  2239. 38734
  2240. Node: Programming with GNU Readline
  2241. 40490
  2242. Node: Basic Behavior
  2243. 41359
  2244. Node: Custom Functions
  2245. 44672
  2246. Node: The Function Type
  2247. 45273
  2248. Node: Function Writing
  2249. 46118
  2250. Node: Readline Variables
  2251. 47202
  2252. Node: Readline Convenience Functions
  2253. 50290
  2254. Node: Function Naming
  2255. 51021
  2256. Node: Keymaps
  2257. 52248
  2258. Node: Binding Keys
  2259. 53962
  2260. Node: Associating Function Names and Bindings
  2261. 55906
  2262. Node: Allowing Undoing
  2263. 57484
  2264. Node: Redisplay
  2265. 60069
  2266. Node: Modifying Text
  2267. 61140
  2268. Node: Utility Functions
  2269. 62051
  2270. Node: Alternate Interface
  2271. 64170
  2272. Node: Custom Completers
  2273. 67464
  2274. Node: How Completing Works
  2275. 68185
  2276. Node: Completion Functions
  2277. 71181
  2278. Node: Completion Variables
  2279. 74196
  2280. Node: A Short Completion Example
  2281. 81338
  2282. Node: Concept Index
  2283. 93644
  2284. Node: Function and Variable Index
  2285. 94389
  2286. End Tag Table
  2287.