GNU readline

GNU readline

Post by Joeri Gerrit » Mon, 26 Feb 2001 05:25:24



Hello,

I'm not sure if this is the right group but anyway..
Currently I'm developig a learning shell and I would like my shell to
immediately predict a new command as soon as the previous one is
finished.

I want my shell to display this prediction on the command line so that
when, let's say, the prediction is "make", the user can execute it (if
it was the correct prediction) by just pressing <Enter>.
To display a prompt and to read commands from the user, the GNU readline
library is extremely usefull. Now, the GNU readline library (used by
bash) allows you to bind keys to a certain completion function. In bash,
<TAB> is binded to the dynamic completion function to establish the
default TAB-completion.
But I want my shell to predict immediately before any key is pressed.
How can I establish this ?

I hope you understand what I mean..
thanks in advance
Joeri


0495/544448
--
All mail clients suck, mutt just sucks less...

 
 
 

GNU readline

Post by brian hile » Thu, 01 Mar 2001 08:13:53



> I'm not sure if this is the right group but anyway..
> Currently I'm developig a learning shell and I would like my shell to
> immediately predict a new command as soon as the previous one is
> finished.

You mean, like:

        Command-line editor with predictions:
ftp://ftp.uu.net/usenet/comp.sources.unix/volume20/reactivekbd/part[01-04]

Quote:> I want my shell to display this prediction on the command line so that
> when, let's say, the prediction is "make", the user can execute it (if
> it was the correct prediction) by just pressing <Enter>.
> To display a prompt and to read commands from the user, the GNU readline
> library is extremely usefull. Now, the GNU readline library (used by
> bash) allows you to bind keys to a certain completion function. In bash,
> <TAB> is binded to the dynamic completion function to establish the
> default TAB-completion.
> But I want my shell to predict immediately before any key is pressed.
> How can I establish this ?
> I hope you understand what I mean..

Not well enough to determinately give the solution to your particular
problem. Fundamentally, you are talking about a C program, not a script
or script interface with a C program; am I right?

All interactive front-ends I am familiar with use pseudo terminals.
"Advanced Unix Programming" by Stevens has a good chapter on this
concept and programming technique.

Before you start something "from scratch" I suggest you investigate
the existing programs that are available now that offer what I
understand is the concept you are interested in (in addition to the
provided URL above):

ftp://wuarchive.wustl.edu/languages/c/unix-c/utils/fep.tar.gz
ftp://wuarchive.wustl.edu/languages/c/unix-c/utils/ile.tar.gz
ftp://wuarchive.wustl.edu/languages/c/unix-c/utils/atty.tar.Z

-Brian

 
 
 

1. GNU readline: make show-all-if-ambiguous the default ???

Hello, I've got a shell-ish program that uses the GNU readline (2.0)
for history and filename completion.  The default behavior for the
completion is to complete a word if it is unique, or beep.  Pressing
the <TAB> key twice in succession will print a list of all
possible commands.

I want to make the double-tab behavior the default for a single tab.
The docs claim tha t if you include 'set show-all-if-ambiguous'
in the ~/.inputrc file, it will do what I want - but is there
a way to make that change part of the program, rather than a user
specific preference?

thanx


--
____________________________________________________________________
   F. Tarek Rogers                          NetEdge Systems
   Phone:     919-991-9202                  P.O. Box 14993

2. Why can't my X program find my Xlibs?

3. GNU readline problem

4. volume group creation and fibre channel switch

5. gnu readline on Solaris 2.2

6. commands for using tape backup on linux

7. GNU Readline library linking problems

8. Netscape - wwwoffle - DNS problem!

9. DBX error with GNU readline

10. Substitute for GNU readline, that can handle UTF-8?

11. GNU Readline install problem

12. GNU Readline from a socket

13. problem building GNU readline 2.1/shared