Mercurial > hg > octave-nkf
changeset 3807:e4e25cdb6786
[project @ 2001-03-08 21:21:29 by jwe]
author | jwe |
---|---|
date | Thu, 08 Mar 2001 21:21:33 +0000 |
parents | ae32674080b0 |
children | 885b296ef83a |
files | readline/CHANGELOG readline/CHANGES readline/ChangeLog readline/MANIFEST readline/Makefile.in readline/bind.c readline/compat.c readline/complete.c readline/config.h.in readline/doc/Makefile.in readline/doc/hstech.texinfo readline/doc/manvers.texinfo readline/doc/readline.0 readline/doc/readline.3 readline/doc/rltech.texinfo readline/doc/rluser.texinfo readline/histexpand.c readline/histfile.c readline/history.c readline/history.h readline/input.c readline/isearch.c readline/readline.h readline/rlprivate.h readline/support/config.sub readline/terminal.c readline/tilde.c readline/undo.c readline/util.c |
diffstat | 29 files changed, 697 insertions(+), 481 deletions(-) [+] |
line wrap: on
line diff
--- a/readline/CHANGELOG +++ b/readline/CHANGELOG @@ -445,3 +445,12 @@ doc/Makefile.in - don't remove the dvi, postscript, html, info, and text `objects' on a `make distclean', only on a `make maintainer-clean' + + 3/6 + --- +doc/history.{0,3}, doc/history_3.ps + - new manual page for history library + +doc/Makefile.in + - rules to install and uninstall history.3 in ${man3dir} + - rules to build history.0 and history_3.ps
--- a/readline/CHANGES +++ b/readline/CHANGES @@ -84,6 +84,17 @@ z. The formatted documentation included in the base readline distribution is no longer removed on a `make distclean'. +aa. Some changes were made to avoid gcc warnings with -Wall. + +bb. rl_get_keymap_by_name now finds keymaps case-insensitively, so + `set keymap EMACS' works. + +cc. The history file writing and truncation functions now return a useful + status on error. + +dd. Fixed a bug that could cause applications to dereference a NULL pointer + if a NULL second argument was passed to history_expand(). + 2. New Features in Readline a. The blink timeout for paren matching is now settable by applications. @@ -119,6 +130,21 @@ j. The documentation has been updated to cover nearly all of the public functions and variables declared in readline.h. +k. New function, rl_get_screen_size (int *rows, int *columns), returns + readline's idea of the screen dimensions. + +l. The timeout in rl_gather_tyi (readline keyboard input polling function) + is now settable via a function (rl_set_keyboard_input_timeout()). + +m. Renamed the max_input_history variable to history_max_entries; the old + variable is maintained for backwards compatibility. + +n. The list of characters that separate words for the history tokenizer is + now settable with a variable: history_word_delimiters. The default + value is as before. + +o. There is a new history.3 manual page documenting the history library. + ------------------------------------------------------------------------------- This document details the changes between this version, readline-4.1, and the previous version, readline-4.0.
--- a/readline/ChangeLog +++ b/readline/ChangeLog @@ -1,3 +1,9 @@ +2001-03-08 John W. Eaton <jwe@bevo.che.wisc.edu> + + * Makefile.in (install, uninstall): For Octave, do nothing. + + * Update to readline-4.2-beta2. + 2001-02-07 John W. Eaton <jwe@bevo.che.wisc.edu> * skip-autoheader: New file.
--- a/readline/MANIFEST +++ b/readline/MANIFEST @@ -87,6 +87,7 @@ doc/hstech.texinfo f doc/hsuser.texinfo f doc/readline.3 f +doc/history.3 f doc/texi2dvi f doc/texi2html f examples/Makefile.in f @@ -113,4 +114,6 @@ doc/history.html f doc/rluserman.html f doc/readline.0 f +doc/history.0 f doc/readline_3.ps f +doc/history_3.ps f
--- a/readline/Makefile.in +++ b/readline/Makefile.in @@ -193,8 +193,6 @@ maybe-uninstall-headers: uninstall-headers -# For Octave, do nothing for these. - install uninstall: #install: installdirs $(STATIC_LIBS) install-headers
--- a/readline/bind.c +++ b/readline/bind.c @@ -1562,7 +1562,7 @@ register int i; for (i = 0; keymap_names[i].name; i++) - if (strcmp (name, keymap_names[i].name) == 0) + if (_rl_stricmp (name, keymap_names[i].name) == 0) return (keymap_names[i].map); return ((Keymap) NULL); }
--- a/readline/compat.c +++ b/readline/compat.c @@ -35,6 +35,7 @@ extern int rl_maybe_unsave_line __P((void)); extern int rl_maybe_replace_line __P((void)); +extern int rl_crlf __P((void)); extern int rl_ding __P((void)); extern int rl_alphabetic __P((int));
--- a/readline/complete.c +++ b/readline/complete.c @@ -90,7 +90,6 @@ #endif static char *rl_quote_filename __P((char *, int, char *)); -static char *rl_strpbrk __P((const char *, const char *)); static char **remove_duplicate_matches __P((char **)); static void insert_match __P((char *, int, int, char *)); @@ -297,25 +296,6 @@ /* */ /************************************/ -/* Find the first occurrence in STRING1 of any character from STRING2. - Return a pointer to the character in STRING1. */ -static char * -rl_strpbrk (string1, string2) - const char *string1, *string2; -{ - register const char *scan; - - for (; *string1; string1++) - { - for (scan = string2; *scan; scan++) - { - if (*string1 == *scan) - return ((char *)string1); - } - } - return ((char *)NULL); -} - /* The user must press "y" or "n". Non-zero return means "y" pressed. */ static int get_y_or_n () @@ -1076,7 +1056,7 @@ This also checks whether the common prefix of several matches needs to be quoted. */ should_quote = rl_filename_quote_characters - ? (rl_strpbrk (match, rl_filename_quote_characters) != 0) + ? (_rl_strpbrk (match, rl_filename_quote_characters) != 0) : 0; do_replace = should_quote ? mtype : NO_MATCH;
--- a/readline/config.h.in +++ b/readline/config.h.in @@ -1,9 +1,4 @@ -/* config.h.in. */ - -/* This file was created by hand, NOT autoheader. There is no - config.h.bot file or acconfig.h file in the readline sources. If - you run autoheader in this directory, you will end up with a - broken config.h.in file. */ +/* config.h.in. Maintained by hand. */ /* Define if on MINIX. */ #undef _MINIX @@ -129,7 +124,6 @@ #undef HAVE_POSIX_SIGSETJMP -/* config.h.bot */ /* modify settings or make new ones based on what autoconf tells us. */ /* Ultrix botches type-ahead when switching from canonical to
--- a/readline/doc/Makefile.in +++ b/readline/doc/Makefile.in @@ -63,9 +63,9 @@ DVIOBJ = readline.dvi history.dvi rluserman.dvi INFOOBJ = readline.info history.info rluserman.info -PSOBJ = readline.ps history.ps rluserman.ps readline_3.ps +PSOBJ = readline.ps history.ps rluserman.ps readline_3.ps history_3.ps HTMLOBJ = readline.html history.html rluserman.html -TEXTOBJ = readline.0 +TEXTOBJ = readline.0 history.0 INTERMEDIATE_OBJ = rlman.dvi hist.dvi rluserman.dvi @@ -135,7 +135,13 @@ readline_3.ps: readline.3 ${RM} $@ - ${GROFF} -man < readline.3 > $@ + ${GROFF} -man < $(srcdir)/readline.3 > $@ + +history.0: history.3 + +history_3.ps: history.3 + ${RM} $@ + ${GROFF} -man < $(srcdir)/history.3 > $@ clean: $(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \ @@ -176,9 +182,11 @@ install-info --dir-file=$(infodir)/dir $(infodir)/history.info ; \ else true; fi -${INSTALL_DATA} $(srcdir)/readline.3 $(man3dir)/readline.3 + -${INSTALL_DATA} $(srcdir)/history.3 $(man3dir)/history.3 uninstall: $(RM) $(infodir)/readline.info $(RM) $(infodir)/rluserman.info $(RM) $(infodir)/history.info $(RM) $(man3dir)/readline.3 + $(RM) $(man3dir)/history.3
--- a/readline/doc/hstech.texinfo +++ b/readline/doc/hstech.texinfo @@ -97,7 +97,9 @@ The state of the History library is encapsulated into a single structure: @example -/* A structure used to pass around the current state of the history. */ +/* + * A structure used to pass around the current state of the history. + */ typedef struct _hist_state @{ HIST_ENTRY **entries; /* Pointer to the entries themselves. */ int offset; /* The location pointer within this array. */ @@ -114,7 +116,7 @@ @section History Functions This section describes the calling sequence for the various functions -present in GNU History. +exported by the @sc{gnu} History library. @menu * Initializing History and State Management:: Functions to call when you @@ -239,6 +241,8 @@ @deftypefun int history_set_pos (int pos) Set the current history offset to @var{pos}, an absolute index into the list. +Returns 1 on success, 0 if @var{pos} is less than zero or greater +than the number of history entries. @end deftypefun @deftypefun {HIST_ENTRY *} previous_history (void) @@ -315,25 +319,28 @@ @deftypefun int write_history (const char *filename) Write the current history to @var{filename}, overwriting @var{filename} if necessary. -If @var{filename} is @code{NULL}, then write the history list to @file{~/.history}. -Values returned are as in @code{read_history()}. +If @var{filename} is @code{NULL}, then write the history list to +@file{~/.history}. +Returns 0 on success, or @code{errno} on a read or write error. @end deftypefun @deftypefun int append_history (int nelements, const char *filename) Append the last @var{nelements} of the history list to @var{filename}. If @var{filename} is @code{NULL}, then append to @file{~/.history}. +Returns 0 on success, or @code{errno} on a read or write error. @end deftypefun @deftypefun int history_truncate_file (const char *filename, int nlines) Truncate the history file @var{filename}, leaving only the last @var{nlines} lines. If @var{filename} is @code{NULL}, then @file{~/.history} is truncated. +Returns 0 on success, or @code{errno} on failure. @end deftypefun @node History Expansion @subsection History Expansion -These functions implement @code{csh}-like history expansion. +These functions implement history expansion. @deftypefun int history_expand (char *string, char **output) Expand @var{string}, placing the result into @var{output}, a pointer @@ -356,11 +363,6 @@ error message. @end deftypefun -@deftypefun {char *} history_arg_extract (int first, int last, const char *string) -Extract a string segment consisting of the @var{first} through @var{last} -arguments present in @var{string}. Arguments are split as in Bash. -@end deftypefun - @deftypefun {char *} get_history_event (const char *string, int *cindex, int qchar) Returns the text of the history event beginning at @var{string} + @var{*cindex}. @var{*cindex} is modified to point to after the event @@ -372,15 +374,22 @@ @deftypefun {char **} history_tokenize (const char *string) Return an array of tokens parsed out of @var{string}, much as the -shell might. The tokens are split on the characters @code{" \t\n()<>;&|$"}, +shell might. The tokens are split on the characters in the +@var{history_word_delimiters} variable, and shell quoting conventions are obeyed. @end deftypefun +@deftypefun {char *} history_arg_extract (int first, int last, const char *string) +Extract a string segment consisting of the @var{first} through @var{last} +arguments present in @var{string}. Arguments are split using +@code{history_tokenize}. +@end deftypefun + @node History Variables @section History Variables This section describes the externally-visible variables exported by -the GNU History Library. +the @sc{gnu} History Library. @deftypevar int history_base The logical offset of the first entry in the history list. @@ -390,13 +399,14 @@ The number of entries currently stored in the history list. @end deftypevar -@deftypevar int max_input_history +@deftypevar int history_max_entries The maximum number of history entries. This must be changed using @code{stifle_history()}. @end deftypevar @deftypevar char history_expansion_char -The character that starts a history event. The default is @samp{!}. +The character that introduces a history event. The default is @samp{!}. +Setting this to 0 inhibits history expansion. @end deftypevar @deftypevar char history_subst_char @@ -411,10 +421,15 @@ This is disabled by default. @end deftypevar +@deftypevar {char *} history_word_delimiters +The characters that separate tokens for \fBhistory_tokenize()\fP. +The default value is @code{" \t\n()<>;&|$"}. +@end deftypevar + @deftypevar {char *} history_no_expand_chars The list of characters which inhibit history expansion if found immediately -following @var{history_expansion_char}. The default is space, TAB, and -@samp{=}. +following @var{history_expansion_char}. The default is space, tab, newline, +carriage return, and @samp{=}. @end deftypevar @deftypevar {char *} history_search_delimiter_chars @@ -443,7 +458,7 @@ @node History Programming Example @section History Programming Example -The following program demonstrates simple use of the GNU History Library. +The following program demonstrates simple use of the @sc{gnu} History Library. @smallexample #include <stdio.h>
--- a/readline/doc/manvers.texinfo +++ b/readline/doc/manvers.texinfo @@ -1,6 +1,6 @@ @set EDITION 4.2-beta @set VERSION 4.2-beta -@set UPDATED 2001 Feb 5 -@set UPDATE-MONTH Feb 2001 +@set UPDATED 2001 Mar 6 +@set UPDATE-MONTH Mar 2001 -@set LASTCHANGE Mon Feb 5 09:10:18 EST 2001 +@set LASTCHANGE Tue Mar 6 13:25:07 EST 2001
--- a/readline/doc/readline.0 +++ b/readline/doc/readline.0 @@ -61,7 +61,7 @@ -GNU Readline 4.2 2001 Feb 5 1 +GNU Readline 4.2 2001 Mar 5 1 @@ -119,15 +119,15 @@ command or the text of a macro and a key sequence to which it should be bound. The name may be specified in one of two ways: as a symbolic key name, possibly with _M_e_t_a_- or - _C_o_n_t_r_o_l_- prefixes, or as a key sequence. When using the - form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is the name - of a key spelled out in English. For example: + _C_o_n_t_r_o_l_- prefixes, or as a key sequence. - Control-u: universal-argument + When using the form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_- + _n_a_m_e is the name of a key spelled out in English. For + example: -GNU Readline 4.2 2001 Feb 5 2 +GNU Readline 4.2 2001 Mar 5 2 @@ -136,6 +136,7 @@ READLINE(3) READLINE(3) + Control-u: universal-argument Meta-Rubout: backward-kill-word Control-o: "> output" @@ -149,17 +150,20 @@ sseeqq differs from kkeeyynnaammee above in that strings denoting an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key - escapes can be used, as in the following example. + escapes can be used, as in the following example, but the + symbolic character names are not recognized. "\C-u": universal-argument "\C-x\C-r": re-read-init-file "\e[11~": "Function Key 1" - In this example, _C_-_u is again bound to the function uunnii-- - vveerrssaall--aarrgguummeenntt. _C_-_x _C_-_r is bound to the function - rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the - text ``Function Key 1''. The full set of GNU Emacs style - escape sequences is + In this example, _C_-_u is again bound to the function uunnii-- + vveerrssaall--aarrgguummeenntt. _C_-_x _C_-_r is bound to the function + rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the + text ``Function Key 1''. + + The full set of GNU Emacs style escape sequences available + when specifying key sequences is \\CC-- control prefix \\MM-- meta prefix \\ee an escape character @@ -167,7 +171,7 @@ \\"" literal ", a double quote \\'' literal ', a single quote - In addition to the GNU Emacs style escape sequences, a + In addition to the GNU Emacs style escape sequences, a second set of backslash escapes is available: \\aa alert (bell) \\bb backspace @@ -177,23 +181,19 @@ \\rr carriage return \\tt horizontal tab \\vv vertical tab - \\_n_n_n the character whose ASCII code is the octal + \\_n_n_n the character whose ASCII code is the octal value _n_n_n (one to three digits) - \\xx_n_n_n the character whose ASCII code is the hex- + \\xx_n_n_n the character whose ASCII code is the hex- adecimal value _n_n_n (one to three digits) When entering the text of a macro, single or double quotes - should be used to indicate a macro definition. Unquoted + should be used to indicate a macro definition. Unquoted text is assumed to be a function name. In the macro body, - the backslash escapes described above are expanded. Back- - slash will quote any other character in the macro text, - including " and '. - - BBaasshh allows the current readline key bindings to be + the backslash escapes described above are expanded. -GNU Readline 4.2 2001 Feb 5 3 +GNU Readline 4.2 2001 Mar 5 3 @@ -202,64 +202,64 @@ READLINE(3) READLINE(3) - displayed or modified with the bbiinndd builtin command. The - editing mode may be switched during interactive use by - using the --oo option to the sseett builtin command. Other - programs using this library provide similar mechanisms. - The _i_n_p_u_t_r_c file may be edited and re-read if a program - does not provide any other means to incorporate new bind- + Backslash will quote any other character in the macro + text, including " and '. + + BBaasshh allows the current readline key bindings to be dis- + played or modified with the bbiinndd builtin command. The + editing mode may be switched during interactive use by + using the --oo option to the sseett builtin command. Other + programs using this library provide similar mechanisms. + The _i_n_p_u_t_r_c file may be edited and re-read if a program + does not provide any other means to incorporate new bind- ings. VVaarriiaabblleess - Readline has variables that can be used to further cus- + Readline has variables that can be used to further cus- tomize its behavior. A variable may be set in the _i_n_p_u_t_r_c file with a statement of the form sseett _v_a_r_i_a_b_l_e_-_n_a_m_e _v_a_l_u_e Except where noted, readline variables can take the values - OOnn or OOffff (without regard to case). The variables and + OOnn or OOffff (without regard to case). The variables and their default values are: bbeellll--ssttyyllee ((aauuddiibbllee)) - Controls what happens when readline wants to ring - the terminal bell. If set to nnoonnee, readline never + Controls what happens when readline wants to ring + the terminal bell. If set to nnoonnee, readline never rings the bell. If set to vviissiibbllee, readline uses a - visible bell if one is available. If set to aauuddii-- + visible bell if one is available. If set to aauuddii-- bbllee, readline attempts to ring the terminal's bell. ccoommmmeenntt--bbeeggiinn ((````##'''')) - The string that is inserted in vvii mode when the - iinnsseerrtt--ccoommmmeenntt command is executed. This command - is bound to MM--## in emacs mode and to ## in vi com- + The string that is inserted in vvii mode when the + iinnsseerrtt--ccoommmmeenntt command is executed. This command + is bound to MM--## in emacs mode and to ## in vi com- mand mode. ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff)) - If set to OOnn, readline performs filename matching + If set to OOnn, readline performs filename matching and completion in a case-insensitive fashion. ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000)) - This determines when the user is queried about - viewing the number of possible completions gener- - ated by the ppoossssiibbllee--ccoommpplleettiioonnss command. It may - be set to any integer value greater than or equal - to zero. If the number of possible completions is - greater than or equal to the value of this vari- + This determines when the user is queried about + viewing the number of possible completions gener- + ated by the ppoossssiibbllee--ccoommpplleettiioonnss command. It may + be set to any integer value greater than or equal + to zero. If the number of possible completions is + greater than or equal to the value of this vari- able, the user is asked whether or not he wishes to - view them; otherwise they are simply listed on the + view them; otherwise they are simply listed on the terminal. ccoonnvveerrtt--mmeettaa ((OOnn)) If set to OOnn, readline will convert characters with - the eighth bit set to an ASCII key sequence by - stripping the eighth bit and prefixing it with an - escape character (in effect, using escape as the + the eighth bit set to an ASCII key sequence by + stripping the eighth bit and prefixing it with an + escape character (in effect, using escape as the _m_e_t_a _p_r_e_f_i_x). - ddiissaabbllee--ccoommpplleettiioonn ((OOffff)) - If set to OOnn, readline will inhibit word comple- - tion. Completion characters will be inserted into - the line as if they had been mapped to sseellff--iinnsseerrtt. -GNU Readline 4.2 2001 Feb 5 4 +GNU Readline 4.2 2001 Mar 5 4 @@ -268,64 +268,64 @@ READLINE(3) READLINE(3) + ddiissaabbllee--ccoommpplleettiioonn ((OOffff)) + If set to OOnn, readline will inhibit word comple- + tion. Completion characters will be inserted into + the line as if they had been mapped to sseellff--iinnsseerrtt. eeddiittiinngg--mmooddee ((eemmaaccss)) - Controls whether readline begins with a set of key - bindings similar to emacs or vi. eeddiittiinngg--mmooddee can + Controls whether readline begins with a set of key + bindings similar to emacs or vi. eeddiittiinngg--mmooddee can be set to either eemmaaccss or vvii. eennaabbllee--kkeeyyppaadd ((OOffff)) - When set to OOnn, readline will try to enable the + When set to OOnn, readline will try to enable the application keypad when it is called. Some systems need this to enable the arrow keys. eexxppaanndd--ttiillddee ((OOffff)) - If set to oonn, tilde expansion is performed when + If set to oonn, tilde expansion is performed when readline attempts word completion. hhoorriizzoonnttaall--ssccrroollll--mmooddee ((OOffff)) - When set to OOnn, makes readline use a single line - for display, scrolling the input horizontally on a - single screen line when it becomes longer than the + When set to OOnn, makes readline use a single line + for display, scrolling the input horizontally on a + single screen line when it becomes longer than the screen width rather than wrapping to a new line. iinnppuutt--mmeettaa ((OOffff)) - If set to OOnn, readline will enable eight-bit input - (that is, it will not clear the eighth bit in the + If set to OOnn, readline will enable eight-bit input + (that is, it will not clear the eighth bit in the characters it reads), regardless of what the termi- nal claims it can support. The name mmeettaa--ffllaagg is a synonym for this variable. iisseeaarrcchh--tteerrmmiinnaattoorrss ((````CC--[[ CC--JJ'''')) - The string of characters that should terminate an - incremental search without subsequently executing - the character as a command. If this variable has - not been given a value, the characters _E_S_C and _C_-_J + The string of characters that should terminate an + incremental search without subsequently executing + the character as a command. If this variable has + not been given a value, the characters _E_S_C and _C_-_J will terminate an incremental search. kkeeyymmaapp ((eemmaaccss)) - Set the current readline keymap. The set of legal - keymap names is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, + Set the current readline keymap. The set of legal + keymap names is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_m_o_v_e_, _v_i_-_c_o_m_m_a_n_d, and _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d; _e_m_a_c_s is equivalent - to _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s. - The value of eeddiittiinngg--mmooddee also affects the default + to _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s. + The value of eeddiittiinngg--mmooddee also affects the default keymap. mmaarrkk--ddiirreeccttoorriieess ((OOnn)) - If set to OOnn, completed directory names have a + If set to OOnn, completed directory names have a slash appended. mmaarrkk--mmooddiiffiieedd--lliinneess ((OOffff)) If set to OOnn, history lines that have been modified are displayed with a preceding asterisk (**). oouuttppuutt--mmeettaa ((OOffff)) If set to OOnn, readline will display characters with - the eighth bit set directly rather than as a meta- + the eighth bit set directly rather than as a meta- prefixed escape sequence. pprriinntt--ccoommpplleettiioonnss--hhoorriizzoonnttaallllyy ((OOffff)) - If set to OOnn, readline will display completions - with matches sorted horizontally in alphabetical + If set to OOnn, readline will display completions + with matches sorted horizontally in alphabetical order, rather than down the screen. - sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff)) - This alters the default behavior of the completion - functions. If set to oonn, words which have more - than one possible completion cause the matches to -GNU Readline 4.2 2001 Feb 5 5 +GNU Readline 4.2 2001 Mar 5 5 @@ -334,38 +334,42 @@ READLINE(3) READLINE(3) - be listed immediately instead of ringing the bell. + sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff)) + This alters the default behavior of the completion + functions. If set to oonn, words which have more + than one possible completion cause the matches to + be listed immediately instead of ringing the bell. vviissiibbllee--ssttaattss ((OOffff)) If set to OOnn, a character denoting a file's type as - reported by _s_t_a_t(2) is appended to the filename + reported by _s_t_a_t(2) is appended to the filename when listing possible completions. CCoonnddiittiioonnaall CCoonnssttrruuccttss - Readline implements a facility similar in spirit to the - conditional compilation features of the C preprocessor + Readline implements a facility similar in spirit to the + conditional compilation features of the C preprocessor which allows key bindings and variable settings to be per- - formed as the result of tests. There are four parser + formed as the result of tests. There are four parser directives used. - $$iiff The $$iiff construct allows bindings to be made based - on the editing mode, the terminal being used, or - the application using readline. The text of the - test extends to the end of the line; no characters + $$iiff The $$iiff construct allows bindings to be made based + on the editing mode, the terminal being used, or + the application using readline. The text of the + test extends to the end of the line; no characters are required to isolate it. - mmooddee The mmooddee== form of the $$iiff directive is used - to test whether readline is in emacs or vi - mode. This may be used in conjunction with + mmooddee The mmooddee== form of the $$iiff directive is used + to test whether readline is in emacs or vi + mode. This may be used in conjunction with the sseett kkeeyymmaapp command, for instance, to set - bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and _e_m_a_c_s_- - _c_t_l_x keymaps only if readline is starting + bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and _e_m_a_c_s_- + _c_t_l_x keymaps only if readline is starting out in emacs mode. tteerrmm The tteerrmm== form may be used to include termi- - nal-specific key bindings, perhaps to bind - the key sequences output by the terminal's - function keys. The word on the right side - of the == is tested against the full name of + nal-specific key bindings, perhaps to bind + the key sequences output by the terminal's + function keys. The word on the right side + of the == is tested against the full name of the terminal and the portion of the terminal name before the first --. This allows _s_u_n to match both _s_u_n and _s_u_n_-_c_m_d, for instance. @@ -374,24 +378,20 @@ The aapppplliiccaattiioonn construct is used to include application-specific settings. Each program using the readline library sets the _a_p_p_l_i_c_a_- - _t_i_o_n _n_a_m_e, and an initialization file can - test for a particular value. This could be + _t_i_o_n _n_a_m_e, and an initialization file can + test for a particular value. This could be used to bind key sequences to functions use- - ful for a specific program. For instance, - the following command adds a key sequence - that quotes the current or previous word in + ful for a specific program. For instance, + the following command adds a key sequence + that quotes the current or previous word in Bash: $$iiff Bash # Quote the current or previous word - "\C-xq": "\eb\"\ef\"" - $$eennddiiff - - $$eennddiiff This command, as seen in the previous example, -GNU Readline 4.2 2001 Feb 5 6 +GNU Readline 4.2 2001 Mar 5 6 @@ -400,64 +400,64 @@ READLINE(3) READLINE(3) - terminates an $$iiff command. + "\C-xq": "\eb\"\ef\"" + $$eennddiiff - $$eellssee Commands in this branch of the $$iiff directive are + $$eennddiiff This command, as seen in the previous example, ter- + minates an $$iiff command. + + $$eellssee Commands in this branch of the $$iiff directive are executed if the test fails. $$iinncclluuddee - This directive takes a single filename as an argu- - ment and reads commands and bindings from that - file. For example, the following directive would + This directive takes a single filename as an argu- + ment and reads commands and bindings from that + file. For example, the following directive would read _/_e_t_c_/_i_n_p_u_t_r_c: $$iinncclluuddee _/_e_t_c_/_i_n_p_u_t_r_c SSEEAARRCCHHIINNGG - Readline provides commands for searching through the com- - mand history for lines containing a specified string. - There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_-_i_n_c_r_e_m_e_n_- + Readline provides commands for searching through the com- + mand history for lines containing a specified string. + There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_-_i_n_c_r_e_m_e_n_- _t_a_l. - Incremental searches begin before the user has finished + Incremental searches begin before the user has finished typing the search string. As each character of the search string is typed, readline displays the next entry from the - history matching the string typed so far. An incremental - search requires only as many characters as needed to find + history matching the string typed so far. An incremental + search requires only as many characters as needed to find the desired history entry. To search backward in the his- - tory for a particular string, type CC--rr. Typing CC--ss + tory for a particular string, type CC--rr. Typing CC--ss searches forward through the history. The characters pre- - sent in the value of the iisseeaarrcchh--tteerrmmiinnaattoorrss variable are + sent in the value of the iisseeaarrcchh--tteerrmmiinnaattoorrss variable are used to terminate an incremental search. If that variable - has not been assigned a value the _E_s_c_a_p_e and CC--JJ charac- + has not been assigned a value the _E_s_c_a_p_e and CC--JJ charac- ters will terminate an incremental search. CC--GG will abort an incremental search and restore the original line. When the search is terminated, the history entry containing the search string becomes the current line. - To find other matching entries in the history list, type - CC--ss or CC--rr as appropriate. This will search backward or - forward in the history for the next line matching the - search string typed so far. Any other key sequence bound - to a readline command will terminate the search and exe- + To find other matching entries in the history list, type + CC--ss or CC--rr as appropriate. This will search backward or + forward in the history for the next line matching the + search string typed so far. Any other key sequence bound + to a readline command will terminate the search and exe- cute that command. For instance, a newline will terminate the search and accept the line, thereby executing the com- - mand from the history list. A movement command will ter- - minate the search, make the last line found the current + mand from the history list. A movement command will ter- + minate the search, make the last line found the current line, and begin editing. - Non-incremental searches read the entire search string + Non-incremental searches read the entire search string before starting to search for matching history lines. The - search string may be typed by the user or be part of the + search string may be typed by the user or be part of the contents of the current line. -EEDDIITTIINNGG CCOOMMMMAANNDDSS - The following is a list of the names of the commands and - the default key sequences to which they are bound. - -GNU Readline 4.2 2001 Feb 5 7 +GNU Readline 4.2 2001 Mar 5 7 @@ -466,11 +466,14 @@ READLINE(3) READLINE(3) - Command names without an accompanying key sequence are +EEDDIITTIINNGG CCOOMMMMAANNDDSS + The following is a list of the names of the commands and + the default key sequences to which they are bound. Com- + mand names without an accompanying key sequence are unbound by default. In the following descriptions, _p_o_i_n_t refers to the current - cursor position, and _m_a_r_k refers to a cursor position + cursor position, and _m_a_r_k refers to a cursor position saved by the sseett--mmaarrkk command. The text between the point and mark is referred to as the _r_e_g_i_o_n. @@ -484,46 +487,43 @@ bbaacckkwwaarrdd--cchhaarr ((CC--bb)) Move back a character. ffoorrwwaarrdd--wwoorrdd ((MM--ff)) - Move forward to the end of the next word. Words - are composed of alphanumeric characters (letters + Move forward to the end of the next word. Words + are composed of alphanumeric characters (letters and digits). bbaacckkwwaarrdd--wwoorrdd ((MM--bb)) - Move back to the start of the current or previous - word. Words are composed of alphanumeric charac- + Move back to the start of the current or previous + word. Words are composed of alphanumeric charac- ters (letters and digits). cclleeaarr--ssccrreeeenn ((CC--ll)) - Clear the screen leaving the current line at the - top of the screen. With an argument, refresh the + Clear the screen leaving the current line at the + top of the screen. With an argument, refresh the current line without clearing the screen. rreeddrraaww--ccuurrrreenntt--lliinnee Refresh the current line. CCoommmmaannddss ffoorr MMaanniippuullaattiinngg tthhee HHiissttoorryy aacccceepptt--lliinnee ((NNeewwlliinnee,, RReettuurrnn)) - Accept the line regardless of where the cursor is. - If this line is non-empty, it may be added to the - history list for future recall with aadddd__hhiissttoorryy(()). + Accept the line regardless of where the cursor is. + If this line is non-empty, it may be added to the + history list for future recall with aadddd__hhiissttoorryy(()). If the line is a modified history line, the history line is restored to its original state. pprreevviioouuss--hhiissttoorryy ((CC--pp)) - Fetch the previous command from the history list, + Fetch the previous command from the history list, moving back in the list. nneexxtt--hhiissttoorryy ((CC--nn)) - Fetch the next command from the history list, mov- + Fetch the next command from the history list, mov- ing forward in the list. bbeeggiinnnniinngg--ooff--hhiissttoorryy ((MM--<<)) Move to the first line in the history. eenndd--ooff--hhiissttoorryy ((MM-->>)) - Move to the end of the input history, i.e., the + Move to the end of the input history, i.e., the line currently being entered. - rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((CC--rr)) - Search backward starting at the current line and - moving `up' through the history as necessary. This - is an incremental search. -GNU Readline 4.2 2001 Feb 5 8 + +GNU Readline 4.2 2001 Mar 5 8 @@ -532,64 +532,64 @@ READLINE(3) READLINE(3) + rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((CC--rr)) + Search backward starting at the current line and + moving `up' through the history as necessary. This + is an incremental search. ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((CC--ss)) - Search forward starting at the current line and - moving `down' through the history as necessary. + Search forward starting at the current line and + moving `down' through the history as necessary. This is an incremental search. nnoonn--iinnccrreemmeennttaall--rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((MM--pp)) Search backward through the history starting at the - current line using a non-incremental search for a + current line using a non-incremental search for a string supplied by the user. nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((MM--nn)) - Search forward through the history using a non- - incremental search for a string supplied by the + Search forward through the history using a non- + incremental search for a string supplied by the user. hhiissttoorryy--sseeaarrcchh--ffoorrwwaarrdd - Search forward through the history for the string + Search forward through the history for the string of characters between the start of the current line - and the current cursor position (the _p_o_i_n_t). This + and the current cursor position (the _p_o_i_n_t). This is a non-incremental search. hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd - Search backward through the history for the string + Search backward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. yyaannkk--nntthh--aarrgg ((MM--CC--yy)) - Insert the first argument to the previous command - (usually the second word on the previous line) at - point (the current cursor position). With an argu- - ment _n, insert the _nth word from the previous com- - mand (the words in the previous command begin with - word 0). A negative argument inserts the _nth word - from the end of the previous command. + Insert the first argument to the previous command + (usually the second word on the previous line) at + point. With an argument _n, insert the _nth word + from the previous command (the words in the previ- + ous command begin with word 0). A negative argu- + ment inserts the _nth word from the end of the pre- + vious command. yyaannkk--llaasstt--aarrgg ((MM--..,, MM--__)) - Insert the last argument to the previous command - (the last word of the previous history entry). + Insert the last argument to the previous command + (the last word of the previous history entry). With an argument, behave exactly like yyaannkk--nntthh--aarrgg. Successive calls to yyaannkk--llaasstt--aarrgg move back through - the history list, inserting the last argument of + the history list, inserting the last argument of each line in turn. CCoommmmaannddss ffoorr CChhaannggiinngg TTeexxtt ddeelleettee--cchhaarr ((CC--dd)) - Delete the character under the cursor. If point is - at the beginning of the line, there are no charac- - ters in the line, and the last character typed was - not bound to ddeelleettee--cchhaarr, then return EEOOFF. + Delete the character at point. If point is at the + beginning of the line, there are no characters in + the line, and the last character typed was not + bound to ddeelleettee--cchhaarr, then return EEOOFF. bbaacckkwwaarrdd--ddeelleettee--cchhaarr ((RRuubboouutt)) Delete the character behind the cursor. When given - a numeric argument, save the deleted text on the + a numeric argument, save the deleted text on the kill ring. ffoorrwwaarrdd--bbaacckkwwaarrdd--ddeelleettee--cchhaarr - Delete the character under the cursor, unless the + Delete the character under the cursor, unless the cursor is at the end of the line, in which case the - character behind the cursor is deleted. - qquuootteedd--iinnsseerrtt ((CC--qq,, CC--vv)) - Add the next character that you type to the line - verbatim. This is how to insert characters like -GNU Readline 4.2 2001 Feb 5 9 +GNU Readline 4.2 2001 Mar 5 9 @@ -598,21 +598,24 @@ READLINE(3) READLINE(3) + character behind the cursor is deleted. + qquuootteedd--iinnsseerrtt ((CC--qq,, CC--vv)) + Add the next character that you type to the line + verbatim. This is how to insert characters like CC--qq, for example. ttaabb--iinnsseerrtt ((MM--TTAABB)) Insert a tab character. sseellff--iinnsseerrtt ((aa,, bb,, AA,, 11,, !!,, ......)) Insert the character typed. ttrraannssppoossee--cchhaarrss ((CC--tt)) - Drag the character before point forward over the - character at point, moving point forward as well. - If point is at the end of the line, then transpose - the two characters before point. Negative argu- - ments don't work. + Drag the character before point forward over the + character at point, moving point forward as well. + If point is at the end of the line, then this + transposes the two characters before point. Nega- + tive arguments have no effect. ttrraannssppoossee--wwoorrddss ((MM--tt)) - Drag the word behind the cursor past the word in - front of the cursor, moving the cursor over that - word as well. + Drag the word before point past the word after + point, moving point over that word as well. uuppccaassee--wwoorrdd ((MM--uu)) Uppercase the current (or following) word. With a negative argument, uppercase the previous word, but @@ -628,34 +631,31 @@ KKiilllliinngg aanndd YYaannkkiinngg kkiillll--lliinnee ((CC--kk)) - Kill the text from the current cursor position to - the end of the line. + Kill the text from point to the end of the line. bbaacckkwwaarrdd--kkiillll--lliinnee ((CC--xx RRuubboouutt)) Kill backward to the beginning of the line. uunniixx--lliinnee--ddiissccaarrdd ((CC--uu)) - Kill backward from point to the beginning of the + Kill backward from point to the beginning of the line. The killed text is saved on the kill-ring. kkiillll--wwhhoollee--lliinnee - Kill all characters on the current line, no matter - where the cursor is. + Kill all characters on the current line, no matter + where point is. kkiillll--wwoorrdd ((MM--dd)) - Kill from the cursor to the end of the current - word, or if between words, to the end of the next - word. Word boundaries are the same as those used - by ffoorrwwaarrdd--wwoorrdd. + Kill from point the end of the current word, or if + between words, to the end of the next word. Word + boundaries are the same as those used by ffoorr-- + wwaarrdd--wwoorrdd. bbaacckkwwaarrdd--kkiillll--wwoorrdd ((MM--RRuubboouutt)) - Kill the word behind the cursor. Word boundaries - are the same as those used by bbaacckkwwaarrdd--wwoorrdd. + Kill the word behind point. Word boundaries are + the same as those used by bbaacckkwwaarrdd--wwoorrdd. uunniixx--wwoorrdd--rruubboouutt ((CC--ww)) - Kill the word behind the cursor, using white space - as a word boundary. The word boundaries are dif- - ferent from bbaacckkwwaarrdd--kkiillll--wwoorrdd. - ddeelleettee--hhoorriizzoonnttaall--ssppaaccee ((MM--\\)) - Delete all spaces and tabs around point. + Kill the word behind point, using white space as a + word boundary. The killed text is saved on the + kill-ring. -GNU Readline 4.2 2001 Feb 5 10 +GNU Readline 4.2 2001 Mar 5 10 @@ -664,9 +664,11 @@ READLINE(3) READLINE(3) + ddeelleettee--hhoorriizzoonnttaall--ssppaaccee ((MM--\\)) + Delete all spaces and tabs around point. kkiillll--rreeggiioonn - Kill the text between the point and _m_a_r_k (saved - cursor position). This text is referred to as the + Kill the text between the point and _m_a_r_k (saved + cursor position). This text is referred to as the _r_e_g_i_o_n. ccooppyy--rreeggiioonn--aass--kkiillll Copy the text in the region to the kill buffer. @@ -674,54 +676,52 @@ Copy the word before point to the kill buffer. The word boundaries are the same as bbaacckkwwaarrdd--wwoorrdd. ccooppyy--ffoorrwwaarrdd--wwoorrdd - Copy the word following point to the kill buffer. + Copy the word following point to the kill buffer. The word boundaries are the same as ffoorrwwaarrdd--wwoorrdd. yyaannkk ((CC--yy)) - Yank the top of the kill ring into the buffer at - the cursor. + Yank the top of the kill ring into the buffer at + point. yyaannkk--ppoopp ((MM--yy)) - Rotate the kill ring, and yank the new top. Only + Rotate the kill ring, and yank the new top. Only works following yyaannkk or yyaannkk--ppoopp. NNuummeerriicc AArrgguummeennttss ddiiggiitt--aarrgguummeenntt ((MM--00,, MM--11,, ......,, MM----)) - Add this digit to the argument already accumulat- - ing, or start a new argument. M-- starts a nega- + Add this digit to the argument already accumulat- + ing, or start a new argument. M-- starts a nega- tive argument. uunniivveerrssaall--aarrgguummeenntt - This is another way to specify an argument. If - this command is followed by one or more digits, - optionally with a leading minus sign, those digits + This is another way to specify an argument. If + this command is followed by one or more digits, + optionally with a leading minus sign, those digits define the argument. If the command is followed by digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the - numeric argument, but is otherwise ignored. As a - special case, if this command is immediately fol- - lowed by a character that is neither a digit or + numeric argument, but is otherwise ignored. As a + special case, if this command is immediately fol- + lowed by a character that is neither a digit or minus sign, the argument count for the next command - is multiplied by four. The argument count is ini- - tially one, so executing this function the first - time makes the argument count four, a second time + is multiplied by four. The argument count is ini- + tially one, so executing this function the first + time makes the argument count four, a second time makes the argument count sixteen, and so on. CCoommpplleettiinngg ccoommpplleettee ((TTAABB)) - Attempt to perform completion on the text before + Attempt to perform completion on the text before point. The actual completion performed is applica- - tion-specific. BBaasshh, for instance, attempts com- - pletion treating the text as a variable (if the - text begins with $$), username (if the text begins - with ~~), hostname (if the text begins with @@), or - command (including aliases and functions) in turn. + tion-specific. BBaasshh, for instance, attempts com- + pletion treating the text as a variable (if the + text begins with $$), username (if the text begins + with ~~), hostname (if the text begins with @@), or + command (including aliases and functions) in turn. If none of these produces a match, filename comple- - tion is attempted. GGddbb, on the other hand, allows - completion of program functions and variables, and - only attempts filename completion under certain - circumstances. + tion is attempted. GGddbb, on the other hand, allows + completion of program functions and variables, and + only attempts filename completion under certain - -GNU Readline 4.2 2001 Feb 5 11 +GNU Readline 4.2 2001 Mar 5 11 @@ -730,25 +730,27 @@ READLINE(3) READLINE(3) + circumstances. ppoossssiibbllee--ccoommpplleettiioonnss ((MM--??)) - List the possible completions of the text before + List the possible completions of the text before point. iinnsseerrtt--ccoommpplleettiioonnss ((MM--**)) - Insert all completions of the text before point - that would have been generated by ppoossssiibbllee--ccoommppllee-- + Insert all completions of the text before point + that would have been generated by ppoossssiibbllee--ccoommppllee-- ttiioonnss. mmeennuu--ccoommpplleettee - Similar to ccoommpplleettee, but replaces the word to be + Similar to ccoommpplleettee, but replaces the word to be completed with a single match from the list of pos- sible completions. Repeated execution of mmeennuu--ccoomm-- - pplleettee steps through the list of possible comple- + pplleettee steps through the list of possible comple- tions, inserting each match in turn. At the end of - the list of completions, the bell is rung and the - original text is restored. An argument of _n moves - _n positions forward in the list of matches; a nega- - tive argument may be used to move backward through - the list. This command is intended to be bound to - TTAABB, but is unbound by default. + the list of completions, the bell is rung (subject + to the setting of Bbell-style)) aanndd tthhee oorriiggiinnaall + tteexxtt iiss rreessttoorreedd.. AAnn aarrgguummeenntt ooff _n mmoovveess _n ppoossii-- + ttiioonnss ffoorrwwaarrdd iinn tthhee lliisstt ooff mmaattcchheess;; aa nneeggaattiivvee + aarrgguummeenntt mmaayy bbee uusseedd ttoo mmoovvee bbaacckkwwaarrdd tthhrroouugghh tthhee + lliisstt.. TThhiiss ccoommmmaanndd iiss iinntteennddeedd ttoo bbee bboouunndd ttoo TTAABB,, + bbuutt iiss uunnbboouunndd bbyy ddeeffaauulltt.. ddeelleettee--cchhaarr--oorr--lliisstt Deletes the character under the cursor if not at the beginning or end of the line (like ddeelleettee-- @@ -781,13 +783,11 @@ command that is bound to the corresponding upper- case character. pprreeffiixx--mmeettaa ((EESSCC)) - Metafy the next character typed. EESSCC ff is equiva- - lent to MMeettaa--ff. + Metafy the next character typed. EESSCC ff is - -GNU Readline 4.2 2001 Feb 5 12 +GNU Readline 4.2 2001 Mar 5 12 @@ -796,6 +796,7 @@ READLINE(3) READLINE(3) + equivalent to MMeettaa--ff. uunnddoo ((CC--__,, CC--xx CC--uu)) Incremental undo, separately remembered for each line. @@ -806,46 +807,45 @@ ttiillddee--eexxppaanndd ((MM--&&)) Perform tilde expansion on the current word. sseett--mmaarrkk ((CC--@@,, MM--<<ssppaaccee>>)) - Set the mark to the current point. If a numeric - argument is supplied, the mark is set to that posi- - tion. + Set the mark to the point. If a numeric argument + is supplied, the mark is set to that position. eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx)) - Swap the point with the mark. The current cursor - position is set to the saved position, and the old + Swap the point with the mark. The current cursor + position is set to the saved position, and the old cursor position is saved as the mark. cchhaarraacctteerr--sseeaarrcchh ((CC--]])) - A character is read and point is moved to the next - occurrence of that character. A negative count + A character is read and point is moved to the next + occurrence of that character. A negative count searches for previous occurrences. cchhaarraacctteerr--sseeaarrcchh--bbaacckkwwaarrdd ((MM--CC--]])) - A character is read and point is moved to the pre- - vious occurrence of that character. A negative + A character is read and point is moved to the pre- + vious occurrence of that character. A negative count searches for subsequent occurrences. iinnsseerrtt--ccoommmmeenntt ((MM--##)) The value of the readline ccoommmmeenntt--bbeeggiinn variable is - inserted at the beginning of the current line, and - the line is accepted as if a newline had been - typed. The default value of ccoommmmeenntt--bbeeggiinn makes + inserted at the beginning of the current line, and + the line is accepted as if a newline had been + typed. The default value of ccoommmmeenntt--bbeeggiinn makes the current line a shell comment. dduummpp--ffuunnccttiioonnss - Print all of the functions and their key bindings - to the readline output stream. If a numeric argu- + Print all of the functions and their key bindings + to the readline output stream. If a numeric argu- ment is supplied, the output is formatted in such a way that it can be made part of an _i_n_p_u_t_r_c file. dduummpp--vvaarriiaabblleess - Print all of the settable variables and their val- - ues to the readline output stream. If a numeric - argument is supplied, the output is formatted in - such a way that it can be made part of an _i_n_p_u_t_r_c + Print all of the settable variables and their val- + ues to the readline output stream. If a numeric + argument is supplied, the output is formatted in + such a way that it can be made part of an _i_n_p_u_t_r_c file. dduummpp--mmaaccrrooss - Print all of the readline key sequences bound to - macros and the strings they ouput. If a numeric - argument is supplied, the output is formatted in - such a way that it can be made part of an _i_n_p_u_t_r_c + Print all of the readline key sequences bound to + macros and the strings they ouput. If a numeric + argument is supplied, the output is formatted in + such a way that it can be made part of an _i_n_p_u_t_r_c file. eemmaaccss--eeddiittiinngg--mmooddee ((CC--ee)) - When in vvii editing mode, this causes a switch to + When in vvii editing mode, this causes a switch to eemmaaccss editing mode. vvii--eeddiittiinngg--mmooddee ((MM--CC--jj)) When in eemmaaccss editing mode, this causes a switch to @@ -853,7 +853,7 @@ -GNU Readline 4.2 2001 Feb 5 13 +GNU Readline 4.2 2001 Mar 5 13 @@ -863,20 +863,20 @@ DDEEFFAAUULLTT KKEEYY BBIINNDDIINNGGSS - The following is a list of the default emacs and vi bind- - ings. Characters with the eighth bit set are written as + The following is a list of the default emacs and vi bind- + ings. Characters with the eighth bit set are written as M-<character>, and are referred to as _m_e_t_a_f_i_e_d characters. - The printable ASCII characters not mentioned in the list - of emacs standard bindings are bound to the sseellff--iinnsseerrtt - function, which just inserts the given character into the - input line. In vi insertion mode, all characters not - specifically mentioned are bound to sseellff--iinnsseerrtt. Charac- - ters assigned to signal generation by _s_t_t_y(1) or the ter- - minal driver, such as C-Z or C-C, retain that function. - Upper and lower case metafied characters are bound to the - same function in the emacs mode meta keymap. The remain- - ing characters are unbound, which causes readline to ring - the bell (subject to the setting of the bbeellll--ssttyyllee vari- + The printable ASCII characters not mentioned in the list + of emacs standard bindings are bound to the sseellff--iinnsseerrtt + function, which just inserts the given character into the + input line. In vi insertion mode, all characters not + specifically mentioned are bound to sseellff--iinnsseerrtt. Charac- + ters assigned to signal generation by _s_t_t_y(1) or the ter- + minal driver, such as C-Z or C-C, retain that function. + Upper and lower case metafied characters are bound to the + same function in the emacs mode meta keymap. The remain- + ing characters are unbound, which causes readline to ring + the bell (subject to the setting of the bbeellll--ssttyyllee vari- able). EEmmaaccss MMooddee @@ -919,7 +919,7 @@ -GNU Readline 4.2 2001 Feb 5 14 +GNU Readline 4.2 2001 Mar 5 14 @@ -968,7 +968,7 @@ "M-Y" yank-pop "M-\" delete-horizontal-space "M-~" tilde-expand - "M-C-?" backward-delete-word + "M-C-?" backward-kill-word "M-_" yank-last-arg Emacs Control-X bindings @@ -985,7 +985,7 @@ -GNU Readline 4.2 2001 Feb 5 15 +GNU Readline 4.2 2001 Mar 5 15 @@ -1034,6 +1034,7 @@ "C-V" quoted-insert "C-W" unix-word-rubout "C-Y" yank + "C-_" vi-undo " " forward-char "#" insert-comment "$" end-of-line @@ -1047,11 +1048,10 @@ "/" vi-search "0" beginning-of-line "1" to "9" vi-arg-digit - ";" vi-char-search -GNU Readline 4.2 2001 Feb 5 16 +GNU Readline 4.2 2001 Mar 5 16 @@ -1060,6 +1060,7 @@ READLINE(3) READLINE(3) + ";" vi-char-search "=" vi-complete "?" vi-search "A" vi-append-eol @@ -1100,7 +1101,7 @@ "r" vi-change-char "s" vi-subst "t" vi-char-search - "u" undo + "u" vi-undo "w" vi-next-word "x" vi-delete "y" vi-yank-to @@ -1112,12 +1113,11 @@ _T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey _b_a_s_h(1) -FFIILLEESS -GNU Readline 4.2 2001 Feb 5 17 +GNU Readline 4.2 2001 Mar 5 17 @@ -1126,6 +1126,7 @@ READLINE(3) READLINE(3) +FFIILLEESS _~_/_._i_n_p_u_t_r_c Individual rreeaaddlliinnee initialization file @@ -1137,19 +1138,19 @@ chet@ins.CWRU.Edu BBUUGG RREEPPOORRTTSS - If you find a bug in rreeaaddlliinnee,, you should report it. But - first, you should make sure that it really is a bug, and - that it appears in the latest version of the rreeaaddlliinnee + If you find a bug in rreeaaddlliinnee,, you should report it. But + first, you should make sure that it really is a bug, and + that it appears in the latest version of the rreeaaddlliinnee library that you have. - Once you have determined that a bug actually exists, mail - a bug report to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g. If you have a fix, - you are welcome to mail that as well! Suggestions and - `philosophical' bug reports may be mailed to _b_u_g_-_r_e_a_d_- + Once you have determined that a bug actually exists, mail + a bug report to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g. If you have a fix, + you are welcome to mail that as well! Suggestions and + `philosophical' bug reports may be mailed to _b_u_g_-_r_e_a_d_- _l_i_n_e@_g_n_u_._o_r_g or posted to the Usenet newsgroup ggnnuu..bbaasshh..bbuugg. - Comments and bug reports concerning this manual page + Comments and bug reports concerning this manual page should be directed to _c_h_e_t_@_i_n_s_._C_W_R_U_._E_d_u. BBUUGGSS @@ -1182,7 +1183,6 @@ - -GNU Readline 4.2 2001 Feb 5 18 +GNU Readline 4.2 2001 Mar 5 18
--- a/readline/doc/readline.3 +++ b/readline/doc/readline.3 @@ -6,9 +6,9 @@ .\" Case Western Reserve University .\" chet@ins.CWRU.Edu .\" -.\" Last Change: Mon Feb 5 08:51:52 EST 2001 +.\" Last Change: Mon Mar 5 09:58:38 EST 2001 .\" -.TH READLINE 3 "2001 Feb 5" "GNU Readline 4.2" +.TH READLINE 3 "2001 Mar 5" "GNU Readline 4.2" .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. @@ -168,6 +168,7 @@ it should be bound. The name may be specified in one of two ways: as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP prefixes, or as a key sequence. +.PP When using the form \fBkeyname\fP:\^\fIfunction-name\fP or \fImacro\fP, .I keyname is the name of a key spelled out in English. For example: @@ -202,7 +203,8 @@ above in that strings denoting an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key escapes can be -used, as in the following example. +used, as in the following example, but the symbolic character names +are not recognized. .sp .RS "\eC\-u": universal\-argument @@ -224,7 +226,9 @@ is bound to insert the text .if t \f(CWFunction Key 1\fP. .if n ``Function Key 1''. -The full set of GNU Emacs style escape sequences is +.PP +The full set of GNU Emacs style escape sequences available when specifying +key sequences is .RS .PD 0 .TP @@ -651,8 +655,8 @@ .TP .B yank\-nth\-arg (M\-C\-y) Insert the first argument to the previous command (usually -the second word on the previous line) at point (the current -cursor position). With an argument +the second word on the previous line) at point. +With an argument .IR n , insert the \fIn\fPth word from the previous command (the words in the previous command begin with word 0). A negative argument @@ -671,7 +675,7 @@ .PD 0 .TP .B delete\-char (C\-d) -Delete the character under the cursor. If point is at the +Delete the character at point. If point is at the beginning of the line, there are no characters in the line, and the last character typed was not bound to \fBdelete\-char\fP, then return .SM @@ -698,12 +702,14 @@ .TP .B transpose\-chars (C\-t) Drag the character before point forward over the character at point, -moving point forward as well. If point is at the end of the line, then -transpose the two characters before point. Negative arguments don't work. +moving point forward as well. +If point is at the end of the line, then this transposes +the two characters before point. +Negative arguments have no effect. .TP .B transpose\-words (M\-t) -Drag the word behind the cursor past the word in front of the cursor, -moving the cursor over that word as well. +Drag the word before point past the word after point, +moving point over that word as well. .TP .B upcase\-word (M\-u) Uppercase the current (or following) word. With a negative argument, @@ -722,7 +728,7 @@ .PD 0 .TP .B kill\-line (C\-k) -Kill the text from the current cursor position to the end of the line. +Kill the text from point to the end of the line. .TP .B backward\-kill\-line (C\-x Rubout) Kill backward to the beginning of the line. @@ -733,22 +739,20 @@ .\" There is no real difference between this and backward-kill-line .TP .B kill\-whole\-line -Kill all characters on the current line, no matter where the -cursor is. +Kill all characters on the current line, no matter where point is. .TP .B kill\-word (M\-d) -Kill from the cursor to the end of the current word, or if between +Kill from point the end of the current word, or if between words, to the end of the next word. Word boundaries are the same as those used by \fBforward\-word\fP. .TP .B backward\-kill\-word (M\-Rubout) -Kill the word behind the cursor. Word boundaries are the same as -those used by \fBbackward\-word\fP. +Kill the word behind point. +Word boundaries are the same as those used by \fBbackward\-word\fP. .TP .B unix\-word\-rubout (C\-w) -Kill the word behind the cursor, using white space as a word boundary. -The word boundaries are different from -.BR backward\-kill\-word . +Kill the word behind point, using white space as a word boundary. +The killed text is saved on the kill-ring. .TP .B delete\-horizontal\-space (M\-\e) Delete all spaces and tabs around point. @@ -769,7 +773,7 @@ The word boundaries are the same as \fBforward\-word\fP. .TP .B yank (C\-y) -Yank the top of the kill ring into the buffer at the cursor. +Yank the top of the kill ring into the buffer at point. .TP .B yank\-pop (M\-y) Rotate the kill ring, and yank the new top. Only works following @@ -830,8 +834,9 @@ with a single match from the list of possible completions. Repeated execution of \fBmenu\-complete\fP steps through the list of possible completions, inserting each match in turn. -At the end of the list of completions, the bell is rung and the -original text is restored. +At the end of the list of completions, the bell is rung +(subject to the setting of \Bbell\-style\fP) +and the original text is restored. An argument of \fIn\fP moves \fIn\fP positions forward in the list of matches; a negative argument may be used to move backward through the list. @@ -896,7 +901,7 @@ Perform tilde expansion on the current word. .TP .B set\-mark (C\-@, M\-<space>) -Set the mark to the current point. If a +Set the mark to the point. If a numeric argument is supplied, the mark is set to that position. .TP .B exchange\-point\-and\-mark (C\-x C\-x) @@ -1056,7 +1061,7 @@ "M-Y" yank-pop "M-\e" delete-horizontal-space "M-~" tilde-expand -"M-C-?" backward-delete-word +"M-C-?" backward-kill-word "M-_" yank-last-arg .PP Emacs Control-X bindings @@ -1116,6 +1121,7 @@ "C-V" quoted-insert "C-W" unix-word-rubout "C-Y" yank +"C-_" vi-undo "\^ " forward-char "#" insert-comment "$" end-of-line @@ -1170,7 +1176,7 @@ "r" vi-change-char "s" vi-subst "t" vi-char-search -"u" undo +"u" vi-undo "w" vi-next-word "x" vi-delete "y" vi-yank-to
--- a/readline/doc/rltech.texinfo +++ b/readline/doc/rltech.texinfo @@ -35,9 +35,9 @@ @node Programming with GNU Readline @chapter Programming with GNU Readline -This chapter describes the interface between the GNU Readline Library and +This chapter describes the interface between the @sc{gnu} Readline Library and other programs. If you are a programmer, and you wish to include the -features found in GNU Readline +features found in @sc{gnu} Readline such as completion, line editing, and interactive history manipulation in your own programs, this section is for you. @@ -66,10 +66,6 @@ @findex readline @cindex readline, function -@example -@code{char *readline (const char *@var{prompt});} -@end example - The function @code{readline()} prints a prompt @var{prompt} and then reads and returns a single line of text from the user. If @var{prompt} is @code{NULL} or the empty string, no prompt is displayed. @@ -77,6 +73,10 @@ the caller should @code{free()} the line when it has finished with it. The declaration for @code{readline} in ANSI C is +@example +@code{char *readline (const char *@var{prompt});} +@end example + @noindent So, one might say @example @@ -330,6 +330,8 @@ @deftypevar {char *} rl_prompt The prompt Readline uses. This is set from the argument to @code{readline()}, and should not be assigned to directly. +The @code{rl_set_prompt()} function (@pxref{Redisplay}) may +be used to modify the prompt string after calling @code{readline()}. @end deftypevar @deftypevar int rl_already_prompted @@ -390,25 +392,27 @@ @deftypevar {rl_hook_func_t *} rl_event_hook If non-zero, this is the address of a function to call periodically -when readline is waiting for terminal input. +when Readline is waiting for terminal input. +By default, this will be called at most ten times a second if there +is no keyboard input. @end deftypevar @deftypevar {rl_getc_func_t *} rl_getc_function -If non-zero, @code{readline} will call indirectly through this pointer +If non-zero, Readline will call indirectly through this pointer to get a character from the input stream. By default, it is set to -@code{rl_getc}, the default @code{readline} character input function +@code{rl_getc}, the default Readline character input function (@pxref{Character Input}). @end deftypevar @deftypevar {rl_voidfunc_t *} rl_redisplay_function -If non-zero, @code{readline} will call indirectly through this pointer +If non-zero, Readline will call indirectly through this pointer to update the display with the current contents of the editing buffer. -By default, it is set to @code{rl_redisplay}, the default @code{readline} +By default, it is set to @code{rl_redisplay}, the default Readline redisplay function (@pxref{Redisplay}). @end deftypevar @deftypevar {rl_vintfunc_t *} rl_prep_term_function -If non-zero, @code{readline} will call indirectly through this pointer +If non-zero, Readline will call indirectly through this pointer to initialize the terminal. The function takes a single argument, an @code{int} flag that says whether or not to use eight-bit characters. By default, this is set to @code{rl_prep_terminal} @@ -416,7 +420,7 @@ @end deftypevar @deftypevar {rl_voidfunc_t *} rl_deprep_term_function -If non-zero, @code{readline} will call indirectly through this pointer +If non-zero, Readline will call indirectly through this pointer to reset the terminal. This function should undo the effects of @code{rl_prep_term_function}. By default, this is set to @code{rl_deprep_terminal} @@ -521,6 +525,7 @@ * Character Input:: Functions to read keyboard input. * Terminal Management:: Functions to manage terminal settings. * Utility Functions:: Generally useful functions and hooks. +* Miscellaneous Functions:: Functions that don't fall into any category. * Alternate Interface:: Using Readline in a `callback' fashion. @end menu @@ -826,6 +831,14 @@ Move the cursor to the start of the next screen line. @end deftypefun +@deftypefun int rl_show_char (int c) +Display character @var{c} on @code{rl_outstream}. +If Readline has not been set to display meta characters directly, this +will convert meta characters to a meta-prefixed key sequence. +This is intended for use by applications which wish to do their own +redisplay. +@end deftypefun + @deftypefun int rl_message (const char *, @dots{}) The arguments are a format string as would be supplied to @code{printf}, possibly containing conversion specifications such as @samp{%d}, and @@ -857,6 +870,13 @@ It returns the number of visible characters on the last line of the (possibly multi-line) prompt. @end deftypefun + +@deftypefun int rl_set_prompt (const char *prompt) +Make Readline use @var{prompt} for subsequent redisplay. This calls +@code{rl_expand_prompt()} to expand the prompt and sets @code{rl_prompt} +to the result. +@end deftypefun + @node Modifying Text @subsection Modifying Text @@ -882,6 +902,12 @@ not a kill, a new kill ring slot is used. @end deftypefun +@deftypefun int rl_push_macro_input (char *macro) +Cause @var{macro} to be inserted into the line, as if it had been invoked +by a key bound to a macro. Not especially useful; use +@code{rl_insert_text()} instead. +@end deftypefun + @node Character Input @subsection Character Input @@ -909,7 +935,7 @@ @end deftypefun @deftypefun int rl_clear_pending_input (void) -Unet @var{rl_pending_input}, effectively negating the effect of any +Unset @var{rl_pending_input}, effectively negating the effect of any previous call to @code{rl_execute_next()}. This works only if the pending input has not already been read with @code{rl_read_key()}. @end deftypefun @@ -917,14 +943,14 @@ @node Terminal Management @subsection Terminal Management -@deftypefun int rl_prep_terminal (int meta_flag) +@deftypefun void rl_prep_terminal (int meta_flag) Modify the terminal settings for Readline's use, so @code{readline()} can read a single character at a time from the keyboard. The @var{meta_flag} argument should be non-zero if Readline should read eight-bit input. @end deftypefun -@deftypefun in rl_deprep_terminal (void) +@deftypefun void rl_deprep_terminal (void) Undo the effects of @code{rl_prep_terminal()}, leaving the terminal in the state in which it was before the most recent call to @code{rl_prep_terminal()}. @@ -932,14 +958,14 @@ @deftypefun void rl_tty_set_default_bindings (Keymap kmap) Read the operating system's terminal editing characters (as would be displayed -by @code{stty} to their readline equivalents. The bindings are performed +by @code{stty}) to their Readline equivalents. The bindings are performed in @var{kmap}. @end deftypefun @deftypefun int rl_reset_terminal (const char *terminal_name) Reinitialize Readline's idea of the terminal settings using @var{terminal_name} as the terminal type (e.g., @code{vt100}). -If @var{terminal_name} is NULL, the value of the @code{TERM} +If @var{terminal_name} is @code{NULL}, the value of the @code{TERM} environment variable is used. @end deftypefun @@ -1004,6 +1030,37 @@ If @var{c} is a number, return the value it represents. @end deftypefun +@node Miscellaneous Functions +@subsection Miscellaneous Functions + +@deftypefun int rl_macro_bind (const char *keyseq, const char *macro, Keymap map) +Bind the key sequence @var{keyseq} to invoke the macro @var{macro}. +The binding is performed in @var{map}. When @var{keyseq} is invoked, the +@var{macro} will be inserted into the line. This function is deprecated; +use @code{rl_generic_bind()} instead. +@end deftypefun + +@deftypefun void rl_macro_dumper (int readable) +Print the key sequences bound to macros and their values, using +the current keymap, to @code{rl_outstream}. +If @var{readable} is non-zero, the list is formatted in such a way +that it can be made part of an @code{inputrc} file and re-read. +@end deftypefun + +@deftypefun int rl_variable_bind (const char *variable, const char *value) +Make the Readline variable @var{variable} have @var{value}. +This behaves as if the readline command +@samp{set @var{variable} @var{value}} had been executed in an @code{inputrc} +file (@pxref{Readline Init File Syntax}). +@end deftypefun + +@deftypefun void rl_variable_dumper (int readable) +Print the readline variable names and their current values +to @code{rl_outstream}. +If @var{readable} is non-zero, the list is formatted in such a way +that it can be made part of an @code{inputrc} file and re-read. +@end deftypefun + @node Alternate Interface @subsection Alternate Interface @@ -1107,13 +1164,13 @@ Signals are asynchronous events sent to a process by the Unix kernel, sometimes on behalf of another process. They are intended to indicate -exceptional events, like a user pressing the interrupt key on his -terminal, or a network connection being broken. There is a class of -signals that can be sent to the process currently reading input from -the keyboard. Since Readline changes the terminal attributes when it -is called, it needs to perform special processing when a signal is -received to restore the terminal to a sane state, or provide application -writers with functions to do so manually. +exceptional events, like a user pressing the interrupt key on his terminal, +or a network connection being broken. There is a class of signals that can +be sent to the process currently reading input from the keyboard. Since +Readline changes the terminal attributes when it is called, it needs to +perform special processing when such a signal is received in order to +restore the terminal to a sane state, or provide application writers with +functions to do so manually. Readline contains an internal signal handler that is installed for a number of signals (@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @@ -1204,6 +1261,15 @@ @var{cols} columns. @end deftypefun +If an application does not want to install a @code{SIGWINCH} handler, but +is still interested in the screen dimensions, Readline's idea of the screen +size may be queried. + +@deftypefun void rl_get_screen_size (int *rows, int *cols) +Return Readline's idea of the terminal's size in the +variables pointed to by the arguments. +@end deftypefun + The following functions install and remove Readline's signal handlers. @deftypefun int rl_set_signals (void) @@ -1334,25 +1400,25 @@ @end deftypefun @deftypefun {char **} rl_completion_matches (const char *text, rl_compentry_func_t *entry_func) -Returns an array of @code{(char *)} which is a list of completions for +Returns an array of strings which is a list of completions for @var{text}. If there are no completions, returns @code{NULL}. The first entry in the returned array is the substitution for @var{text}. The remaining entries are the possible completions. The array is terminated with a @code{NULL} pointer. @var{entry_func} is a function of two args, and returns a -@code{(char *)}. The first argument is @var{text}. The second is a +@code{char *}. The first argument is @var{text}. The second is a state argument; it is zero on the first call, and non-zero on subsequent calls. @var{entry_func} returns a @code{NULL} pointer to the caller when there are no more matches. @end deftypefun @deftypefun {char *} rl_filename_completion_function (const char *text, int state) -A generator function for filename completion in the general case. Note -that completion in Bash is a little different because of all -the pathnames that must be followed when looking up completions for a -command. The Bash source is a useful reference for writing custom -completion functions. +A generator function for filename completion in the general case. +@var{text} is a partial filename. +The Bash source is a useful reference for writing custom +completion functions (the Bash completion functions call this and other +Readline functions). @end deftypefun @deftypefun {char *} rl_username_completion_function (const char *text, int state) @@ -1382,7 +1448,7 @@ array of strings returned will be used. If this function sets the @code{rl_attempted_completion_over} variable to a non-zero value, Readline will not perform its default -completion if this function returns no matches. +completion even if this function returns no matches. @end deftypevar @deftypevar {rl_quote_func_t *} rl_filename_quoting_function @@ -1412,7 +1478,7 @@ @deftypevar {rl_linebuf_func_t *} rl_char_is_quoted_p A pointer to a function to call that determines whether or not a specific character in the line buffer is quoted, according to whatever quoting -mechanism the program calling readline uses. The function is called with +mechanism the program calling Readline uses. The function is called with two arguments: @var{text}, the text of the line, and @var{index}, the index of the character in the line. It is used to decide whether a character found in @code{rl_completer_word_break_characters} should be @@ -1428,12 +1494,12 @@ @deftypevar {const char *} rl_basic_word_break_characters The basic list of characters that signal a break between words for the completer routine. The default value of this variable is the characters -which break words for completion in Bash, i.e., +which break words for completion in Bash: @code{" \t\n\"\\'`@@$><=;|&@{("}. @end deftypevar @deftypevar {const char *} rl_basic_quote_characters -List of quote characters which can cause a word break. +A list of quote characters which can cause a word break. @end deftypevar @deftypevar {const char *} rl_completer_word_break_characters @@ -1443,7 +1509,7 @@ @end deftypevar @deftypevar {const char *} rl_completer_quote_characters -List of characters which can be used to quote a substring of the line. +A list of characters which can be used to quote a substring of the line. Completion occurs on the entire substring, and within the substring @code{rl_completer_word_break_characters} are treated as any other character, unless they also appear within this list. @@ -1473,7 +1539,8 @@ @end deftypevar @deftypevar int rl_ignore_completion_duplicates -If non-zero, then disallow duplicates in the matches. Default is 1. +If non-zero, then duplicates in the matches are removed. +The default is 1. @end deftypevar @deftypevar int rl_filename_completion_desired @@ -1499,8 +1566,8 @@ @deftypevar int rl_attempted_completion_over If an application-specific completion function assigned to @code{rl_attempted_completion_function} sets this variable to a non-zero -value, Readline will not perform its default filename completion if the -application's completion function returns no matches. +value, Readline will not perform its default filename completion even +if the application's completion function returns no matches. It should be set only by an application's completion function. @end deftypevar
--- a/readline/doc/rluser.texinfo +++ b/readline/doc/rluser.texinfo @@ -362,7 +362,15 @@ @item Variable Settings You can modify the run-time behavior of Readline by altering the values of variables in Readline -using the @code{set} command within the init file. Here is how to +using the @code{set} command within the init file. +The syntax is simple: + +@example +set @var{variable} @var{value} +@end example + +@noindent +Here, for example, is how to change from the default Emacs-like key binding to use @code{vi} line editing commands: @@ -370,6 +378,9 @@ set editing-mode vi @end example +Variable names and values, where appropriate, are recognized without regard +to case. + @ifset BashFeatures The @w{@code{bind -V}} command lists the current Readline variable names and values. @xref{Bash Builtins}. @@ -378,6 +389,7 @@ A great deal of run-time behavior is changeable with the following variables. +@cindex variables, readline @table @code @item bell-style @@ -532,6 +544,9 @@ can be expressed in different ways, depending on what you find most comfortable. +In addition to command names, readline allows keys to be bound +to a string that is inserted when the key is pressed (a @var{macro}). + @ifset BashFeatures The @w{@code{bind -p}} command displays Readline function names and bindings in a format that can put directly into an initialization file. @@ -686,7 +701,8 @@ @item application The @var{application} construct is used to include application-specific settings. Each program using the Readline -library sets the @var{application name}, and you can test for it. +library sets the @var{application name}, and you can test for +a particular value. This could be used to bind key sequences to functions useful for a specific program. For instance, the following command adds a key sequence that quotes the current or previous word in Bash: @@ -709,6 +725,7 @@ @item $include This directive takes a single filename as an argument and reads commands and bindings from that file. +For example, the following directive reads from @file{/etc/inputrc}: @example $include /etc/inputrc @end example @@ -842,8 +859,8 @@ @w{@code{bind -P}} or, for a more terse format, suitable for an @var{inputrc} file, @w{@code{bind -p}}. (@xref{Bash Builtins}.) @end ifset +Command names without an accompanying key sequence are unbound by default. -Command names without an accompanying key sequence are unbound by default. In the following descriptions, @dfn{point} refers to the current cursor position, and @dfn{mark} refers to a cursor position saved by the @code{set-mark} command. @@ -899,15 +916,15 @@ If this line is non-empty, it may be added to the history list for future recall with @code{add_history()}. -If this line is a modified history line, then restore the history line +If this line is a modified history line, the history line is restored to its original state. @end ifclear @item previous-history (C-p) -Move `up' through the history list. +Move `back' through the history list, fetching the previous command. @item next-history (C-n) -Move `down' through the history list. +Move `forward' through the history list, fetching the next command. @item beginning-of-history (M-<) Move to the first line in the history. @@ -947,7 +964,8 @@ @item yank-nth-arg (M-C-y) Insert the first argument to the previous command (usually -the second word on the previous line). With an argument @var{n}, +the second word on the previous line) at point. +With an argument @var{n}, insert the @var{n}th word from the previous command (the words in the previous command begin with word 0). A negative argument inserts the @var{n}th word from the end of the previous command. @@ -966,7 +984,7 @@ @ftable @code @item delete-char (C-d) -Delete the character under the cursor. If the cursor is at the +Delete the character at point. If point is at the beginning of the line, there are no characters in the line, and the last character typed was not bound to @code{delete-char}, then return @sc{eof}. @@ -1033,7 +1051,7 @@ Kill backward from the cursor to the beginning of the current line. @item kill-whole-line () -Kill all characters on the current line, no matter point is. +Kill all characters on the current line, no matter where point is. By default, this is unbound. @item kill-word (M-d) @@ -1071,8 +1089,7 @@ By default, this command is unbound. @item yank (C-y) -Yank the top of the kill ring into the buffer at the current -cursor position. +Yank the top of the kill ring into the buffer at point. @item yank-pop (M-y) Rotate the kill-ring, and yank the new top. You can only do this if @@ -1121,7 +1138,7 @@ @end ifclear @item possible-completions (M-?) -List the possible completions of the text before the cursor. +List the possible completions of the text before point. @item insert-completions (M-*) Insert all completions of the text before point that would have @@ -1132,8 +1149,9 @@ with a single match from the list of possible completions. Repeated execution of @code{menu-complete} steps through the list of possible completions, inserting each match in turn. -At the end of the list of completions, the bell is rung and the -original text is restored. +At the end of the list of completions, the bell is rung +(subject to the setting of @code{bell-style}) +and the original text is restored. An argument of @var{n} moves @var{n} positions forward in the list of matches; a negative argument may be used to move backward through the list. @@ -1238,7 +1256,7 @@ that is bound to the corresponding uppercase character. @item prefix-meta (@key{ESC}) -Make the next character typed be metafied. This is for keyboards +Metafy the next character typed. This is for keyboards without a meta key. Typing @samp{@key{ESC} f} is equivalent to typing @kbd{M-f}. @@ -1258,7 +1276,7 @@ Perform tilde expansion on the current word. @item set-mark (C-@@) -Set the mark to the current point. If a +Set the mark to the point. If a numeric argument is supplied, the mark is set to that position. @item exchange-point-and-mark (C-x C-x) @@ -1363,7 +1381,8 @@ @end ifset @ifclear BashFeatures In order to switch interactively between @code{emacs} and @code{vi} -editing modes, use the command @kbd{M-C-j} (toggle-editing-mode). +editing modes, use the command @kbd{M-C-j} (bound to emacs-editing-mode +when in @code{vi} mode and to vi-editing-mode in @code{emacs} mode). @end ifclear The Readline default is @code{emacs} mode.
--- a/readline/histexpand.c +++ b/readline/histexpand.c @@ -93,6 +93,9 @@ The default is 0. */ int history_quotes_inhibit_expansion = 0; +/* Used to split words by history_tokenize_internal. */ +char *history_word_delimiters = HISTORY_WORD_DELIMITERS; + /* If set, this points to a function that is called to verify that a particular history expansion should be performed. */ rl_linebuf_func_t *history_inhibit_expansion_function; @@ -819,6 +822,9 @@ /* Used when adding the string. */ char *temp; + if (output == 0) + return 0; + /* Setting the history expansion character to 0 inhibits all history expansion. */ if (history_expansion_char == 0) @@ -868,7 +874,7 @@ history expansion performed on it. Skip the rest of the line and break out of the loop. */ if (history_comment_char && string[i] == history_comment_char && - (i == 0 || member (string[i - 1], HISTORY_WORD_DELIMITERS))) + (i == 0 || member (string[i - 1], history_word_delimiters))) { while (string[i]) i++; @@ -966,7 +972,7 @@ } case -2: /* history_comment_char */ - if (i == 0 || member (string[i - 1], HISTORY_WORD_DELIMITERS)) + if (i == 0 || member (string[i - 1], history_word_delimiters)) { temp = xmalloc (l - i + 1); strcpy (temp, string + i); @@ -1306,7 +1312,7 @@ continue; } - if (!delimiter && (member (string[i], HISTORY_WORD_DELIMITERS))) + if (!delimiter && (member (string[i], history_word_delimiters))) break; if (!delimiter && member (string[i], HISTORY_QUOTE_CHARACTERS))
--- a/readline/histfile.c +++ b/readline/histfile.c @@ -222,14 +222,15 @@ } /* Truncate the history file FNAME, leaving only LINES trailing lines. - If FNAME is NULL, then use ~/.history. */ + If FNAME is NULL, then use ~/.history. Returns 0 on success, errno + on failure. */ int history_truncate_file (fname, lines) const char *fname; int lines; { register int i; - int file, chars_read; + int file, chars_read, rv; char *buffer, *filename; struct stat finfo; size_t file_size; @@ -237,15 +238,28 @@ buffer = (char *)NULL; filename = history_filename (fname); file = open (filename, O_RDONLY|O_BINARY, 0666); + rv = 0; /* Don't try to truncate non-regular files. */ - if (file == -1 || fstat (file, &finfo) == -1 || S_ISREG (finfo.st_mode) == 0) + if (file == -1 || fstat (file, &finfo) == -1) { + rv = errno; if (file != -1) close (file); goto truncate_exit; } + if (S_ISREG (finfo.st_mode) == 0) + { + close (file); +#ifdef EFTYPE + rv = EFTYPE; +#else + rv = EINVAL; +#endif + goto truncate_exit; + } + file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ @@ -253,7 +267,11 @@ { close (file); #if defined (EFBIG) - errno = EFBIG; + rv = errno = EFBIG; +#elif defined (EOVERFLOW) + rv = errno = EOVERFLOW; +#else + rv = errno = EINVAL; #endif goto truncate_exit; } @@ -263,7 +281,10 @@ close (file); if (chars_read <= 0) - goto truncate_exit; + { + rv = (chars_read < 0) ? errno : 0; + goto truncate_exit; + } /* Count backwards from the end of buffer until we have passed LINES lines. */ @@ -304,7 +325,7 @@ FREE (buffer); free (filename); - return 0; + return rv; } /* Workhorse function for writing history. Writes NELEMENT entries @@ -317,10 +338,11 @@ { register int i; char *output; - int file, mode; + int file, mode, rv; mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY; output = history_filename (filename); + rv = 0; if ((file = open (output, mode, 0600)) == -1) { @@ -354,7 +376,8 @@ buffer[j++] = '\n'; } - write (file, buffer, buffer_size); + if (write (file, buffer, buffer_size) < 0) + rv = errno; free (buffer); } @@ -362,7 +385,7 @@ FREE (output); - return (0); + return (rv); } /* Append NELEMENT entries to FILENAME. The entries appended are from
--- a/readline/history.c +++ b/readline/history.c @@ -73,7 +73,8 @@ /* If HISTORY_STIFLED is non-zero, then this is the maximum number of entries to remember. */ -int max_input_history; +int history_max_entries; +int max_input_history; /* backwards compatibility */ /* The current location of the interactive history pointer. Just makes life easier for outside callers. */ @@ -219,12 +220,12 @@ { HIST_ENTRY *temp; - if (history_stifled && (history_length == max_input_history)) + if (history_stifled && (history_length == history_max_entries)) { register int i; /* If the history is stifled, and history_length is zero, - and it equals max_input_history, we don't save items. */ + and it equals history_max_entries, we don't save items. */ if (history_length == 0) return; @@ -345,7 +346,7 @@ } history_stifled = 1; - max_input_history = max; + max_input_history = history_max_entries = max; } /* Stop stifling the history. This returns the previous amount the @@ -357,10 +358,10 @@ if (history_stifled) { history_stifled = 0; - return (-max_input_history); + return (-history_max_entries); } - return (max_input_history); + return (history_max_entries); } int
--- a/readline/history.h +++ b/readline/history.h @@ -222,14 +222,18 @@ /* Exported history variables. */ extern int history_base; extern int history_length; -extern int max_input_history; +extern int history_max_entries; extern char history_expansion_char; extern char history_subst_char; +extern char *history_word_delimiters; extern char history_comment_char; extern char *history_no_expand_chars; extern char *history_search_delimiter_chars; extern int history_quotes_inhibit_expansion; +/* Backwards compatibility */ +extern int max_input_history; + /* If set, this function is called to decide whether or not a particular history expansion should be treated as a special case for the calling application and not expanded. */
--- a/readline/input.c +++ b/readline/input.c @@ -82,6 +82,8 @@ rl_getc_func_t *rl_getc_function = rl_getc; +static int _keyboard_input_timeout = 100000; /* 0.1 seconds; it's in usec */ + /* **************************************************************** */ /* */ /* Character Input Buffering */ @@ -169,7 +171,7 @@ FD_SET (tty, &readfds); FD_SET (tty, &exceptfds); timeout.tv_sec = 0; - timeout.tv_usec = 100000; /* 0.1 seconds */ + timeout.tv_usec = _keyboard_input_timeout; if (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) <= 0) return; /* Nothing to read. */ #endif @@ -222,6 +224,18 @@ } } +int +rl_set_keyboard_input_timeout (u) + int u; +{ + int o; + + o = _keyboard_input_timeout; + if (u > 0) + _keyboard_input_timeout = u; + return (o); +} + /* Is there input available to be read on the readline input file descriptor? Only works if the system has select(2) or FIONREAD. */ int @@ -244,7 +258,7 @@ FD_SET (tty, &readfds); FD_SET (tty, &exceptfds); timeout.tv_sec = 0; - timeout.tv_usec = 100000; /* 0.1 seconds */ + timeout.tv_usec = _keyboard_input_timeout; return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0); #endif
--- a/readline/isearch.c +++ b/readline/isearch.c @@ -64,6 +64,8 @@ identical lines many times in a row. */ static char *prev_line_found; +static unsigned char *default_isearch_terminators = "\033\012"; + /* Search backwards through the history looking for a string which is typed interactively. Start with the current line. */ int @@ -184,7 +186,7 @@ allocated_line = (char *)NULL; isearch_terminators = _rl_isearch_terminators ? _rl_isearch_terminators - : (unsigned char *)"\033\012"; + : default_isearch_terminators; /* Create an arrary of pointers to the lines that we want to search. */ rl_maybe_replace_line ();
--- a/readline/readline.h +++ b/readline/readline.h @@ -263,9 +263,11 @@ extern char *readline __P((const char *)); extern int rl_set_prompt __P((const char *)); +extern int rl_expand_prompt __P((char *)); extern int rl_initialize __P((void)); +/* Undocumented; unused by readline */ extern int rl_discard_argument __P((void)); /* Utility functions to bind keys to readline commands. */ @@ -311,13 +313,16 @@ extern char *rl_get_keymap_name __P((Keymap)); extern void rl_set_keymap __P((Keymap)); extern Keymap rl_get_keymap __P((void)); +/* Undocumented; used internally only. */ extern void rl_set_keymap_from_edit_mode __P((void)); extern char *rl_get_keymap_name_from_edit_mode __P((void)); /* Functions for manipulating the funmap, which maps command names to functions. */ extern int rl_add_funmap_entry __P((const char *, rl_command_func_t *)); +extern const char **rl_funmap_names __P((void)); +/* Undocumented, only used internally -- there is only one funmap, and this + function may be called only once. */ extern void rl_initialize_funmap __P((void)); -extern const char **rl_funmap_names __P((void)); /* Utility functions for managing keyboard macros. */ extern void rl_push_macro_input __P((char *)); @@ -367,7 +372,7 @@ extern int rl_reset_terminal __P((const char *)); extern void rl_resize_terminal __P((void)); extern void rl_set_screen_size __P((int, int)); -extern void rl_get_screen_size __P((int*, int*)); +extern void rl_get_screen_size __P((int *, int *)); /* Functions for character input. */ extern int rl_stuff_char __P((int)); @@ -375,6 +380,7 @@ extern int rl_clear_pending_input __P((void)); extern int rl_read_key __P((void)); extern int rl_getc __P((FILE *)); +extern int rl_set_keyboard_input_timeout __P((int)); /* `Public' utility functions . */ extern void rl_extend_line_buffer __P((int)); @@ -389,10 +395,9 @@ extern void rl_free_line_state __P((void)); /* Undocumented. */ -extern int rl_expand_prompt __P((char *)); - extern int rl_set_paren_blink_timeout __P((int)); +/* Undocumented. */ extern int rl_maybe_save_line __P((void)); extern int rl_maybe_unsave_line __P((void)); extern int rl_maybe_replace_line __P((void)); @@ -605,7 +610,8 @@ to be modified as an argument. Unlike rl_directory_completion_hook, it only modifies the directory name used in opendir(2), not what is displayed when the possible completions are printed or inserted. It is called - before rl_directory_completion_hook. */ + before rl_directory_completion_hook. I'm not happy with how this works + yet, so it's undocumented. */ extern rl_icppfunc_t *rl_directory_rewrite_hook; /* Backwards compatibility with previous versions of readline. */
--- a/readline/rlprivate.h +++ b/readline/rlprivate.h @@ -130,7 +130,7 @@ extern void _rl_redisplay_after_sigwinch __P((void)); extern void _rl_clean_up_for_exit __P((void)); extern void _rl_erase_entire_line __P((void)); -extern int _rl_currentb_display_line __P((void)); +extern int _rl_current_display_line __P((void)); /* input.c */ extern int _rl_any_typein __P((void)); @@ -160,6 +160,7 @@ extern void _rl_replace_text __P((const char *, int, int)); extern int _rl_char_search_internal __P((int, int, int)); extern int _rl_set_mark_at_pos __P((int)); +extern int _rl_free_saved_history_line __P((void)); /* rltty.c */ extern int _rl_disable_tty_signals __P((void)); @@ -182,6 +183,7 @@ extern int rl_alphabetic __P((int)); extern int _rl_abort_internal __P((void)); extern char *_rl_strindex __P((const char *, const char *)); +extern char *_rl_strpbrk __P((const char *, const char *)); extern int _rl_qsort_string_compare __P((char **, char **)); extern int (_rl_uppercase_p) __P((int)); extern int (_rl_lowercase_p) __P((int));
--- a/readline/support/config.sub +++ b/readline/support/config.sub @@ -173,7 +173,7 @@ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | miprs64vr5000el | mcore \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v) + | thumb | d10v | s390) basic_machine=$basic_machine-unknown ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65) @@ -676,6 +676,10 @@ rtpc | rtpc-*) basic_machine=romp-ibm ;; + s390-*) + basic_machine=s390-ibm + os=-linux + ;; sa29200) basic_machine=a29k-amd os=-udi
--- a/readline/terminal.c +++ b/readline/terminal.c @@ -238,6 +238,9 @@ _rl_set_screen_size (rows, cols) int rows, cols; { + if (rows == 0 || cols == 0) + return; + _rl_screenheight = rows; _rl_screenwidth = cols; @@ -255,15 +258,15 @@ } void -rl_get_screen_size (rows, cols) - int *rows, *cols; +rl_get_screen_size (rows, cols) + int *rows, *cols; { - if (rows) + if (rows) *rows = _rl_screenheight; - if (cols) - *cols = _rl_screenwidth; + if (cols) + *cols = _rl_screenwidth; } - + void rl_resize_terminal () {
--- a/readline/tilde.c +++ b/readline/tilde.c @@ -234,7 +234,7 @@ len = strlen (expansion); #ifdef __CYGWIN__ /* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when - $HOME for `user' is /. On cygwin, // denotes a network drive. */ + $HOME for `user' is /. On cygwin, // denotes a network drive. */ if (len > 1 || *expansion != '/' || *string != '/') #endif {
--- a/readline/undo.c +++ b/readline/undo.c @@ -107,11 +107,11 @@ rl_do_undo () { UNDO_LIST *release; - int waiting_for_begin = 0; - int start, end; + int waiting_for_begin, start, end; #define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i))) + start = end = waiting_for_begin = 0; do { if (!rl_undo_list)
--- a/readline/util.c +++ b/readline/util.c @@ -225,6 +225,25 @@ return ((char *)NULL); } +/* Find the first occurrence in STRING1 of any character from STRING2. + Return a pointer to the character in STRING1. */ +char * +_rl_strpbrk (string1, string2) + const char *string1, *string2; +{ + register const char *scan; + + for (; *string1; string1++) + { + for (scan = string2; *scan; scan++) + { + if (*string1 == *scan) + return ((char *)string1); + } + } + return ((char *)NULL); +} + #if !defined (HAVE_STRCASECMP) /* Compare at most COUNT characters from string1 to string2. Case doesn't matter. */