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: a suggested solution for better external' completion in certain emacs modes Date: Mon, 08 Nov 2004 23:30:14 +0000 Message-ID: <87k6svzzp5.fsf_-_@tapsellferrier.co.uk> References: <87smal64nc.fsf@orebokech.com> <87wtx45rag.fsf_-_@tapsellferrier.co.uk> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1099957063 18395 80.91.229.6 (8 Nov 2004 23:37:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 Nov 2004 23:37:43 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 09 00:37:34 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 1CRJ4o-00029i-00 for ; Tue, 09 Nov 2004 00:37:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CRJDB-0002xJ-73 for ged-emacs-devel@m.gmane.org; Mon, 08 Nov 2004 18:46:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CRJD1-0002x7-Fl for emacs-devel@gnu.org; Mon, 08 Nov 2004 18:46:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CRJD0-0002wk-Kp for emacs-devel@gnu.org; Mon, 08 Nov 2004 18:46:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CRJD0-0002wP-FF for emacs-devel@gnu.org; Mon, 08 Nov 2004 18:46:02 -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 1CRJ3N-0005AU-C0 for emacs-devel@gnu.org; Mon, 08 Nov 2004 18:36:05 -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 1CRIui-0000cs-97 for ; Mon, 08 Nov 2004 23:27:08 +0000 Original-Received: from nferrier by kanga with local (Exim 4.30 #1 (Debian)) id 1CRIxj-0006PB-6A for ; Mon, 08 Nov 2004 23:30:15 +0000 Original-To: emacs-devel@gnu.org In-Reply-To: (Peter Heslin's message of "Tue, 2 Nov 2004 22:48:25 +0000 (UTC)") 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:29608 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29608 As we are all aware, certain Emacs interactions are not as useful as their shell like counterparts. For example, using sql-mode to interact with PostgreSQL is not as useful as doing it outside of Emacs. The reason for this is that comint mode cannot effectively communicate with certain programs to do things like completion. I have a proposal for fixing that and this email describes it. Most of the programs whose integration with Emacs we want to improve use the GNU Readline library. This is why they have sophisticated completion mechanisms. GNU Readline works by defining an API for the things that a shell like program will want to do and allowing keys to be bound to those API functions. So my suggestion for improving Emacs access to such programs is to add an option to the GNU Readline library which allows Emacs to call Readline API functions 'out of band'. In effect this would work like this: - Emacs starts a Readline program, eg: psql (the PostgreSQL client) with a special option specifying signifying this mode of operation. - Readline somehow sees the option (maybe it is passed as an ENV var) and configures itself for this mode of operation Readline and Emacs are now connected by some sort of stream (probably just a standard comint/stdin scheme). - Readline advertises to Emacs the functions the current program supports by writing the information (a sexp?) to the stream - Emacs reads the config from Readline and configures itself appropriately to bind Emacs keys to functions which send API calls to Readline over the stream. - Readline communicates the status of the current line, and other status information (eg: completions) back over the stream for Emacs to display. This seems like it wouldn't be that hard to add to Emacs and probably not to Readline either. Anyone have any thoughts? -- Nic Ferrier http://www.tapsellferrier.co.uk