[GAP Forum] Can't bind readline functions

Frank Lübeck frank.luebeck at math.rwth-aachen.de
Mon Feb 10 14:19:38 GMT 2020


On Mon, Feb 10, 2020 at 12:28:52PM +0100, Ralf wrote:
> Hi,
> 
> I recently started to use gap and I was happy to see that it comes with
> a readline interface. However it doesn't seem to work as advertised. For
> instance in other readline enabled programs I usually make have use of
> the function "reverse-search-history" which is by default bound to
> "C-r". However, it does not work in gap. I even added it to my .inputrc
> file (which I should not need since it is the default). Although gap
> honours certain changes to the .inputrc like the "blink-matching-paren"
> variable it seems to fail to honour binding functions to certain keys.
> Not even the dump-function example in section 6.9.1 of the reference
> manual works, i.e. the lines in my .inputrc
> 
> $if GAP
>     set blink-matching-paren on
>     "\C-r": reverse-search-history
>     "\C-n": dump-functions
> $endif

Dear Ralf, dear Forum,

You are right, GAP's documentation should be improved here.

I will add the following paragraph to the section you mentioned above:

  Caveat:  GAP  overwrites  the  following  keys (after reading the ~/.inputrc
  file):  \C-g,  \C-i,  \C-n, \C-o, \C-p, \C-r, \C-\, \e<, \e>, Up, Down, TAB,
  Space, PageUp, PageDown. So, do not redefine these in your ~/.inputrc.

(and I will adjust the example .inputrc).

GAP does not use readline's history mechanism, so binding a key to
"reverse-search-history" is not very useful. The keys C-n, C-p (and Down and
Up) allow to scroll forward and backward in history, and C-r searches for
previous lines with the current line as substring.

Depending on your configuration GAP can also use input from previous GAP
sessions in its history, see

?SaveCommandLineHistory

Best regards,
  Frank Lübeck

PS: It is probably not very useful, but if you really want to overwrite one
of the keys listed above, you can
   - reread your .inputrc after starting GAP with \C-x\C-r
   - or use some calls of 'ReadlineInitLine' in your ~/.gap/gaprc file

-- 
///  Dr. Frank Lübeck, Lehrstuhl D für Mathematik, Pontdriesch 14/16,
\\\                    52062 Aachen, Germany
///  E-mail: Frank.Luebeck at Math.RWTH-Aachen.De
\\\  WWW:    http://www.math.rwth-aachen.de/~Frank.Luebeck/



More information about the Forum mailing list