From 1b17e766659d93d1e7bd6633bf78132e1abb3568 Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Sun, 9 Jul 2000 17:20:00 +0000 Subject: readline: 2000-07-09 Elena Zannoni * Import of readline 4.1. Locally modified files: Makefile.in, configure.in, configure (regenerated), config.h.in (regenerated), readline.h, rltty.c, shell.c signals.c. Locally added files: acconfig.h, config/*, config.h.bot, cross-build/*, doc/inc-hit.texinfo. New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h. examples: 2000-07-09 Elena Zannoni * Import of readline 4.1. New files: excallback.c, rlfe.c. doc: 2000-07-09 Elena Zannoni * Import of readline 4.1. Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for inclusion in the gdb manual. New file: rluserman.texinfo --- readline/parens.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'readline/parens.c') diff --git a/readline/parens.c b/readline/parens.c index a500c0a..b6de529 100644 --- a/readline/parens.c +++ b/readline/parens.c @@ -7,7 +7,7 @@ The GNU Readline Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 1, or + as published by the Free Software Foundation; either version 2, or (at your option) any later version. The GNU Readline Library is distributed in the hope that it will be @@ -18,23 +18,11 @@ The GNU General Public License is often shipped with GNU software, and is generally kept in a file called COPYING or LICENSE. If you do not have a copy of the license, write to the Free Software Foundation, - 675 Mass Ave, Cambridge, MA 02139, USA. */ + 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #define READLINE_LIBRARY #include "rlconf.h" -#if !defined (PAREN_MATCHING) -extern int rl_insert (); - -int -rl_insert_close (count, invoking_key) - int count, invoking_key; -{ - return (rl_insert (count, invoking_key)); -} - -#else /* PAREN_MATCHING */ - #if defined (HAVE_CONFIG_H) # include #endif @@ -64,8 +52,9 @@ extern char *strchr (), *strrchr (); #endif /* !strchr && !__STDC__ */ #include "readline.h" +#include "rlprivate.h" -extern int rl_explicit_arg; +static int find_matching_open __P((char *, int, int)); /* Non-zero means try to blink the matching open parenthesis when the close parenthesis is inserted. */ @@ -75,7 +64,25 @@ int rl_blink_matching_paren = 1; int rl_blink_matching_paren = 0; #endif /* !HAVE_SELECT */ -static int find_matching_open (); +/* Change emacs_standard_keymap to have bindings for paren matching when + ON_OR_OFF is 1, change them back to self_insert when ON_OR_OFF == 0. */ +void +_rl_enable_paren_matching (on_or_off) + int on_or_off; +{ + if (on_or_off) + { /* ([{ */ + rl_bind_key_in_map (')', rl_insert_close, emacs_standard_keymap); + rl_bind_key_in_map (']', rl_insert_close, emacs_standard_keymap); + rl_bind_key_in_map ('}', rl_insert_close, emacs_standard_keymap); + } + else + { /* ([{ */ + rl_bind_key_in_map (')', rl_insert, emacs_standard_keymap); + rl_bind_key_in_map (']', rl_insert, emacs_standard_keymap); + rl_bind_key_in_map ('}', rl_insert, emacs_standard_keymap); + } +} int rl_insert_close (count, invoking_key) @@ -152,5 +159,3 @@ find_matching_open (string, from, closer) } return (i); } - -#endif /* PAREN_MATCHING */ -- cgit v1.1