[Top][All Lists]

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

Re: a suggested solution for better external' completion in certain emac

From: Nic Ferrier
Subject: Re: a suggested solution for better external' completion in certain emacs modes
Date: Tue, 09 Nov 2004 23:12:23 +0000

Message-ID: <address@hidden>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Richard Stallman <address@hidden> writes:

>     - Readline advertises to Emacs the functions the current program
>       supports  by writing the information (a sexp?) to the stream
> I am not quite sure what this means.  What questions would this
> information answer?  Could you give an example?


Let's imagine I want to start psql (the PostgreSQL command line
client) in Emacs. This is what might happen, given my suggestion:

Emacs does:  READLINE_CTRL=API psql somedb

This opens the normal stream between the two programs, but puts
libreadline into 'api' mode

psql/Readline sends: (readline-api rl_insert_text 

This tells Emacs what function calls the readline program can accept.

The next step is that the user gives some input to emacs:

   select * from 

and then she presses C-TAB (the completion key). Emacs doesn't know
how to complete the line but it does know that psql/Readline supports
rl_complete so:

Emacs sends: (rl_complete "select * from ")

psql/Readline accepts the command, performs it and then:

psql/Readline sends: ("invoices" "orders" "expenses" "users")

and Emacs can display the completion list. The user types an "i" and
presses C-TAB so now....

Emacs sends: (rl_complete "select * from i")

and psql/Readline responds with: ("nvoices")

so now there is only one completion item Emacs can display the line:

    select * from invoices

At some point the user presses enter and Emacs passes the line to
psql/Readline again in some form that causes psql/Readline to execute
the line and send the output to the stream.

This would be a very cool way to solve the problem of getting at
completion services provided by, in particular, Readline enabled

It would require quite a lot of work to make Readline do it though.

Nic Ferrier

reply via email to

[Prev in Thread] Current Thread [Next in Thread]