From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29569 invoked by alias); 25 Feb 2016 02:13:25 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 29557 invoked by uid 89); 25 Feb 2016 02:13:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_40,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=COMPLETE, H*r:sk:DHE_RSA, tells, kawa X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 25 Feb 2016 02:13:23 +0000 Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1aYlQc-0003Vf-Pl for kawa@sourceware.org; Thu, 25 Feb 2016 03:13:18 +0100 Received: from 70-36-239-75.dsl.dynamic.fusionbroadband.com ([70.36.239.75] helo=toshie.bothner.com) by mailfront11.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1aYlQG-0000zd-NL for kawa@sourceware.org; Thu, 25 Feb 2016 03:12:57 +0100 To: Kawa mailing list From: Per Bothner Subject: tab-completion implemented for Kawa Message-ID: <56CE6324.80502@bothner.com> Date: Thu, 25 Feb 2016 02:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-q1/txt/msg00027.txt.bz2 I checked in an implementation of command-completion (tab-completion) for Kawa. This is context-senstive - for example the following works when using the JLine2 input-ediing library: #|Kawa:1|# abs abs absolute-path? #|Kawa:1|# abs # Kawa wills in the 's' and gives you two options; choose "abs". What makes it interesting is that it is content-dependent, and includes bindings in the lexical scope: #|Kawa:2|# (let ((absol 12)) absol absol absolute-path? It works by running the compiler in tentative mode with "(let ((absol 12)) abso" as the input. Here is a special private-use Unicode character that tells the Kawa name-lookup framework to look for names starting with "abso". This "tentative mode" could also be useful for on-the-fly error checking, syntax coloring, use/definition cross-references. But that is for another day. Currently this only works with the JLine2 library. You have to: ./configure --with-jline2=/path/to/jline2.jar However, most of the logic is independent of JLine2, and is in the file gnu/expr/CommandCompleter.java. It should be doable (for-example) to have an Emacs frontend call the CommandCompleter#complete method. -- --Per Bothner per@bothner.com http://per.bothner.com/