From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78779 invoked by alias); 25 Feb 2016 23:33:18 -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 78762 invoked by uid 89); 25 Feb 2016 23:33:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,SPF_PASS autolearn=ham version=3.3.2 spammy=Andrea, andrea X-HELO: mail-vk0-f41.google.com Received: from mail-vk0-f41.google.com (HELO mail-vk0-f41.google.com) (209.85.213.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 25 Feb 2016 23:33:16 +0000 Received: by mail-vk0-f41.google.com with SMTP id c3so62792972vkb.3 for ; Thu, 25 Feb 2016 15:33:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=ONDdUuhvVhbtv2qWKhkjJxSB68Otd9qhuj1plF2VdoU=; b=Nv+MsGhCc3booYc+QcMiH4Dy//c3oQVi1vQK8uUxCmsDLe09Z+fp7PitF9fk3IIYAR QWQRq+lrd2Sk/iui8HbC+AZ6jMpEtJapDbmXWGRDYetO7trz8SXdZVKgquIAFvi+ZOuz 1qIMvlsnGJTTXQEfFy1vA1WQk6X4PRyt2SNkTcBy73VcVN4cQgU3rT+tNiw0GAq9zhf9 0HhSmuDzAdHkNs4Mya9lWi19PqaDnn1DJzN+EOonmLwB3QeL069x9kOXVp4RkElvzXmh OmCLwzwa4+30k4hmiNLdctmDPgpkQqFydChTwyYYZbCJhCynCkoz4HrgS7PrV8bO/2E4 zGFw== X-Gm-Message-State: AG10YOQSOa2rtX+U6shgqbndukfGxoV3rfUPa4tYdlfNW22KLO5qwNSeCLmIXVR2R/VW3VrCDw1aGPzKwzUstQ== MIME-Version: 1.0 X-Received: by 10.31.21.146 with SMTP id 140mr39072552vkv.134.1456443193767; Thu, 25 Feb 2016 15:33:13 -0800 (PST) Received: by 10.176.0.182 with HTTP; Thu, 25 Feb 2016 15:33:13 -0800 (PST) In-Reply-To: References: <56CE6324.80502@bothner.com> Date: Thu, 25 Feb 2016 23:33:00 -0000 Message-ID: Subject: Re: tab-completion implemented for Kawa From: Andrea Bernardini To: kawa@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-q1/txt/msg00028.txt.bz2 Hi Per, This is a very nice feature! BTW, something I miss in the Kawa REPL is some kind of history. I'm used to the bash shell, where you can use the up arrow key to get the previous executed commands. Currently pressing the arrow key in Kawa inserts a weird sequence of characters. I know that other languages' REPLs have the same problem (like Racket), however there are some that support this feature (Python, Haskell). Do you think that could be doable for Kawa? All the best Andrea (Sorry for the double mail, Per) On 25 February 2016 at 23:31, Andrea Bernardini wrote: > Hi Per, > This is a very nice feature! > > BTW, something I miss in the Kawa REPL is some kind of history. I'm used to > the bash shell, where you can use the up arrow key to get the previous > executed commands. Currently pressing the arrow key in Kawa inserts a weird > sequence of characters. I know that other languages' REPLs have the same > problem (like Racket), however there are some that support this feature > (Python, Haskell). Do you think that could be doable for Kawa? > > All the best > > Andrea > > (Sorry for the double mail, Per) > > > On 25 February 2016 at 23:27, Andrea Bernardini wrote: >> >> Hi Per, >> This is a very nice feature! >> >> BTW, something I miss in the Kawa REPL is some kind of history. I'm used >> to the bash shell, where you can use the up arrow key to get the previous >> executed commands. Currently pressing the arrow key in Kawa inserts a weird >> sequence of characters. I know that other languages' REPLs have the same >> problem (like Racket), however there are some that support this feature >> (Python, Haskell). Do you think that could be doable for Kawa? >> >> All the best >> >> Andrea >> >> On 25 February 2016 at 02:12, Per Bothner wrote: >>> >>> 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/ >> >> >