[GAP Forum] Can't bind readline functions

Ralf diffset at arcor.de
Mon Feb 10 14:14:31 GMT 2020


Am Mon, 10 Feb 2020 13:39:33 +0100
schrieb Bill Allombert <Bill.Allombert at math.u-bordeaux.fr>:

> On Mon, Feb 10, 2020 at 12:23:23PM +0000, Dima Pasechnik wrote:
> > Dear Ralf,
> > 
> > In GAP Ctrl-r and Ctrn-n was, in pre-readline times, used to scroll
> > the history back and forth, and it's still the case now.
> > 
> > AFAIK it's not customizable, yet.
> > (Patches to fix this are welcome).  

Okay, thanks, I can indeed bind dump-function or reverse-search-history
to e.g., C-a. However, section 6.8 of the reference manual (which I
hadn't read before because it tells me at the beginning to skip to
section 6.9 as I use readline) states that CTRL-A is also already bound
to a function (move the cursor to the beginning of the line). Why can
one be overwritten and the other not? However, this is moot since:

> As far as I understand, the problem is that GAP does not use the
> 'history' part of readline, but its own code, to implement 
> traditional GAP history behaviour.

Indeed, when I search for anything (e.g. I have the line
"Elements(GF(27));" in my history) using reverse-search-history of
readline it immediately fails after pressing "G":

(failed reverse-i-search)`G':

> However it is now possible to configure readline to have a similar
> behaviour than GAP by setting:
> 
> "\e[A": history-search-backward
> "\e[B": history-search-forward
> (and probably similar for Ctrl-r and Ctrl-n).

Does that mean there already is a home cooked history search like
"reverse-search-history" in gap that I could use? How would I do that?
Section 6.8 doesn't mention it (and also not Ctrl-R by the way).

> So it might be possible for GAP to use history while setting this
> default to keep the traditional behaviour.

I know how important it is to keep traditional behaviour. But, given how
ubiquitous readline (at least under linux) is, almost everyone should be
familiar with using it (if they'd use line editing at all). Furthermore,
readline is very stable and hides the heavy lifting in a ready-to-use
library. So it should not be that difficult to replace the traditional
history handling stuff with it. Right?

Ralf



More information about the Forum mailing list