Karim BELABAS on Tue, 26 Nov 2002 18:41:56 +0100 (MET)

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

Re: [PATCH CVS] Readline improvements

On Thu, 17 Oct 2002, Ilya Zakharevich wrote:
> [Some time ago F1/M-h did not work before parentheses of
>   function()
> Apparently, it was recently fixed.

I did this in revision 1.9 (gp_rl.c), date: 2001/09/11 15:10:45

> However, in between somebody
> noticed this lack of functionallity, and switched off an important
> feature of TAB - to make TAB work as F1 in this situation.  Thus
> currently F1 and TAB do the same between parentheses (as above).]
> This patch:
>   a) Restores the historic behaviour of TAB (insert the template for
>      function arguments), if one wants help, press F1 or M-h;

I had removed it after receiving some complaints:

1) it is all too common to hit TAB once to many and get arguments inserted
without wanting it.

2) with default keymaps and common keyboard layouts, undoing is awkward
( Control + Shift + - ). The people who complained did not even know undoing
was possible (and they erased templates character by character).

3) what is the purpose of inserting templates, when actual parameters will
have in 99.99% of cases a different name ?

I think inserting the help text serves the same purpose (quick remainder of
argument types and ordering), without cluttering the command line. True
this duplicates the behaviour of <M-h>, <F1>.

I have applied your patch as is, but I'd rather restore the previous
behaviour or disable <TAB> altogether in this situation ( generic completion
with empty prefix ---> 550+ matches ) if overloading the completion key in
this way looks confusing.

Any other opinions about this behaviour ? [ typing <TAB> between a pair of
empty parentheses following a function name inserts the full prototype taken
from the online help ].

Actually, I just noticed that <F1> works fine on my home machines (Linux + PC
US keyboard), but not in my office environment (Solaris + generic X terminal
keyboard). I need to add something like

  KSbind("24z", rl_short_help,  emacs_standard_keymap); /* F1, xterm */

to gp_rl.c to make it work out of the box.

>   b) make default(readline,4) and default(readline,2) etc. switch the
>      electric TAB (as above) and electric-parens settings;

Hum. The idea was that all readline-specific settings go to .inputrc
( possibly enclosed by $if Pari-GP / $endif ), but why not ?

>   c) Better formatting of the message when one switches the two
>      setting above (by giving non-positive arguments to TAB or "(");
>   d) Colors now work with default(readline,0) too;


>   e) Beginning of support for Mouse-Editing in xterm (see
> http://groups.google.com/groups?selm=ani7hg%24bmf%241%40agate.berkeley.edu&output=gplain).
>      Currently we support the 2004 setting by interpreting F200/F201
>      as signals to switch off/back electric parens.  In particular,
>      one can have default(readline,2) *and* cut-and-paste in new xterm
>      without bad interactions (if one enables 2004 before entering gp).

I do not understand how this is used. I just downloaded Dickey's xterm-170,
compiled with the -DOPT_READLINE flag, but nothing happens when I click

Any special trick ?

Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathématiques, Bât. 425  Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud             Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France)           http://www.math.u-psud.fr/~belabas/
PARI/GP Home Page: http://www.parigp-home.de/