From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Nic Ferrier Newsgroups: gmane.emacs.devel Subject: Re: a suggested solution for better external' completion in certain emacs modes Date: Tue, 09 Nov 2004 23:12:23 +0000 Message-ID: References: <87smal64nc.fsf@orebokech.com> <87wtx45rag.fsf_-_@tapsellferrier.co.uk> <87k6svzzp5.fsf_-_@tapsellferrier.co.uk> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1100042220 13379 80.91.229.6 (9 Nov 2004 23:17:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Nov 2004 23:17:00 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 10 00:16:50 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CRfEH-0000lY-00 for ; Wed, 10 Nov 2004 00:16:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CRfMi-0005aJ-4s for ged-emacs-devel@m.gmane.org; Tue, 09 Nov 2004 18:25:32 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CRfMR-0005Wk-Al for emacs-devel@gnu.org; Tue, 09 Nov 2004 18:25:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CRfMQ-0005WL-H0 for emacs-devel@gnu.org; Tue, 09 Nov 2004 18:25:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CRfMQ-0005W5-Bd for emacs-devel@gnu.org; Tue, 09 Nov 2004 18:25:14 -0500 Original-Received: from [80.168.156.78] (helo=owls-tree.tapsellferrier.co.uk) by monty-python.gnu.org with esmtp (TLSv1:RC4-SHA:128) (Exim 4.34) id 1CRfDU-0004e5-EF; Tue, 09 Nov 2004 18:16:00 -0500 Original-Received: from [80.168.156.71] (helo=kanga ident=Debian-exim) by owls-tree.tapsellferrier.co.uk with esmtp (Exim 4.30 #1 (Debian)) id 1CRf6k-0002aL-HA; Tue, 09 Nov 2004 23:09:02 +0000 Original-Received: from nferrier by kanga with local (Exim 4.30 #1 (Debian)) id 1CRfA0-0007tn-Cl; Tue, 09 Nov 2004 23:12:24 +0000 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Tue, 09 Nov 2004 16:30:08 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:29684 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29684 ") Message-ID: <87lldawrag.fsf@tapsellferrier.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Richard Stallman 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? Sure. 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 rl_delete_text rl_copy_text rl_kill_text rl_complete rl_possible_completions rl_insert_completions) 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 programs. It would require quite a lot of work to make Readline do it though. -- Nic Ferrier http://www.tapsellferrier.co.uk