Ilya Zakharevich on Fri, 31 Aug 2001 14:06:44 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PATCH 2.1.1] f1 for help


This patch binds <f1> (both xterm flavor and vt100 flavor) to show
help, and <f1><f1> to show long help.

Enjoy,
Ilya

--- ./Configure~	Fri Aug 31 13:35:56 2001
+++ ./Configure	Fri Aug 31 13:37:41 2001
@@ -560,6 +560,9 @@ if test "$optimization" != profiling; th
          if (grep rl_completion_append_character $x > /dev/null 2>&1); then
            rl_appendchar=yes
          fi
+         if (grep rl_generic_bind $x > /dev/null 2>&1); then
+           rl_genericbind=yes
+         fi
          if (grep rl_save_prompt $x > /dev/null 2>&1); then
            rl_save_prompt=yes;
          else
@@ -596,6 +599,9 @@ if test "$optimization" != profiling; th
     if test -z "$rl_appendchar"; then
       echo ..."Library readline does not have completion_append_char"
     fi
+    if test -z "$rl_genericbind"; then
+      echo ..."Library readline does not have rl_generic_bind"
+    fi
     if test -z "$rl_save_prompt"; then
       echo ..."Library readline does not have rl_save_prompt"
       if test -n "$_rl_save_prompt"; then
@@ -1256,7 +1262,7 @@ for variable in\
   runpath runpathprefix LDDYN LIBS DYNLIBS DYNFLAGS DYNRELOC\
   ranlib gzip zcat emacs perl ln_s make_sh exe_suff\
   readline readline_enabledp CPPF_defined rl_refresh_line_oldproto\
-  rl_appendchar rl_save_prompt _rl_save_prompt rl_message\
+  rl_appendchar rl_genericbind rl_save_prompt _rl_save_prompt rl_message\
   rl_completion_matches rl_completion_func_t\
   RLINCLUDE RLLIBS\
   sizeof_long endian has_exp2\
--- ./config/paricfg.h.SH~	Fri Aug 31 13:35:56 2001
+++ ./config/paricfg.h.SH	Fri Aug 31 13:37:41 2001
@@ -78,6 +78,9 @@ EOT
   if test -n "$rl_appendchar"; then
     echo '#define HAS_COMPLETION_APPEND_CHAR' >> $file
   fi
+  if test -n "$rl_genericbind"; then
+    echo '#define HAS_RL_GENERIC_BIND' >> $file
+  fi
   if test -n "$rl_refresh_line_oldproto"; then
     echo '#define OLD_RL_REFRESH_LINE' >> $file
   fi
--- ./src/gp/gp_rl.c~~	Fri Aug 31 14:00:28 2001
+++ ./src/gp/gp_rl.c	Fri Aug 31 14:01:33 2001
@@ -562,6 +562,8 @@ rl_short_help(int count, int key)
   FILE *save = pari_outfile;
   long flag = h_RL;
 
+  if (rl_last_func == rl_short_help)
+    count = -1;				/* Repeated HELP into a long help */
   while (off && is_keyword_char(rl_line_buffer[off-1])) off--;
 
   /* Check for \c type situation.  Could check for leading whitespace too... */
@@ -641,6 +643,17 @@ init_readline()
   Bind('H', rl_long_help,  emacs_meta_keymap);
   Bind('h', rl_short_help, vi_movement_keymap);
   Bind('H', rl_long_help,  vi_movement_keymap);
+#  ifdef HAS_RL_GENERIC_BIND
+#define KSbind1(s,f,k) \
+  ((int (*) (int type, char *keyseq, char *data, Keymap map))rl_generic_bind)\
+  (ISFUNC, (s), (char*)(f), (k))
+#define KSbind(s,f,k) rl_generic_bind(ISFUNC, (s), (char*)(f), (k))
+
+  KSbind("OP",   rl_short_help,  emacs_meta_keymap); /* f1, vt100 */
+  KSbind("[11~", rl_short_help,  emacs_meta_keymap); /* f1, xterm */
+  KSbind("OP",   rl_short_help,  vi_movement_keymap); /* f1, vt100 */
+  KSbind("[11~", rl_short_help,  vi_movement_keymap); /* f1, xterm */
+#  endif
   Bind('(', pari_rl_matched_insert, emacs_standard_keymap);
   Bind('[', pari_rl_matched_insert, emacs_standard_keymap);
   Bind(6, pari_rl_forward_sexp,  emacs_meta_keymap); /* M-C-f */