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 00:35:01 +0000 Message-ID: <87bre7zwp6.fsf@tapsellferrier.co.uk> References: <87smal64nc.fsf@orebokech.com> <87wtx45rag.fsf_-_@tapsellferrier.co.uk> <87k6svzzp5.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 1099960698 26590 80.91.229.6 (9 Nov 2004 00:38:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Nov 2004 00:38:18 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 09 01:38:03 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 1CRK1L-00069R-00 for ; Tue, 09 Nov 2004 01:38:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CRK9i-0007tt-Lh for ged-emacs-devel@m.gmane.org; Mon, 08 Nov 2004 19:46:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CRK9E-0007fS-RW for emacs-devel@gnu.org; Mon, 08 Nov 2004 19:46:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CRK9E-0007ex-2s for emacs-devel@gnu.org; Mon, 08 Nov 2004 19:46:12 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CRK9D-0007eX-KB for emacs-devel@gnu.org; Mon, 08 Nov 2004 19:46:11 -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 1CRJzR-0002TE-4k for emacs-devel@gnu.org; Mon, 08 Nov 2004 19: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 1CRJvP-0000hh-2l; Tue, 09 Nov 2004 00:31:55 +0000 Original-Received: from nferrier by kanga with local (Exim 4.30 #1 (Debian)) id 1CRJyQ-0006Re-Ao; Tue, 09 Nov 2004 00:35:02 +0000 Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Mon, 08 Nov 2004 19:01:52 -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:29613 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29613 Stefan Monnier writes: >> - Emacs starts a Readline program, eg: psql (the PostgreSQL client) >> with a special option specifying signifying this mode of operation. > > A command-line argument is probably a bad idea (for cases like when you > start psql via a script (or a make file), ...). An env-var would be good. > >> This seems like it wouldn't be that hard to add to Emacs and probably >> not to Readline either. > > Sounds like a good idea. > > Such tools often offer things like a `listcompletions' commands which > Emacs can use to implement the completion itself. Such a thing is used by > GUD for gdb. Readline has a few standard functions: int rl_complete_internal (int what_to_do) int rl_complete (int ignore, int invoking_key) int rl_possible_completions (int count, int invoking_key) int rl_insert_completions (int count, int invoking_key) int rl_completion_mode (rl_command_func_t *cfunc) Which, AFAIK, is what *most* programs doing completion use. This is what Readline should advertise to Emacs (or whatever, this wouldn't be Emacs specific necessarily). There are a number of other Readline completion tools and, with slightly a complex advertising protocol, it would be possible to hook those in too. > Standardizing support for such things directly in comint might > also be a good idea, tho not as good because it only works for those > programs that go to the trouble of providing a `listcompletions' > command. But it wouldn't be difficult for comint to detect when this behaviour is offered by Readline, either: - do a version detect on the readline .so - have this feature make readline send a "hello", when the "hello" isn't received then comint will know this feature is not available. -- Nic Ferrier http://www.tapsellferrier.co.uk