public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Andrea Bernardini <andrebask@gmail.com>
To: kawa@sourceware.org
Subject: Re: tab-completion implemented for Kawa
Date: Thu, 25 Feb 2016 23:33:00 -0000	[thread overview]
Message-ID: <CAPFJfsuKUjZSkKCZLTFUMybXpp6N4SMXqGerduNEsrhfnJ=J2g@mail.gmail.com> (raw)
In-Reply-To: <CAPFJfsvV+Lnrko6Bj008DLA7007of_1a-XOM0oAYH5JTXrFRpA@mail.gmail.com>

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 <andrebask@gmail.com> 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 <andrebask@gmail.com> 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 <per@bothner.com> 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|# ab<TAB>s
>>> abs              absolute-path?
>>> #|Kawa:1|# abs<ENTER>
>>> #<procedure abs>
>>>
>>> Kawa wills in the 's' and gives you two options; <ENTER> choose "abs".
>>>
>>> What makes it interesting is that it is content-dependent,
>>> and includes bindings in the lexical scope:
>>>
>>> #|Kawa:2|# (let ((absol 12)) abso<TAB>l
>>> absol            absolute-path?
>>>
>>> It works by running the compiler in tentative mode
>>> with "(let ((absol 12)) abso<COMPLETE>" as the input.
>>> Here <COMPLETE> 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/
>>
>>
>

  parent reply	other threads:[~2016-02-25 23:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25  2:13 Per Bothner
     [not found] ` <CAPFJfsva4VPt_RQ5NrNzY8n7oyZB0EGL7VuFAzsEcGS8ruDqbA@mail.gmail.com>
     [not found]   ` <CAPFJfsvV+Lnrko6Bj008DLA7007of_1a-XOM0oAYH5JTXrFRpA@mail.gmail.com>
2016-02-25 23:33     ` Andrea Bernardini [this message]
2016-02-25 23:51       ` Per Bothner
2016-02-26  0:48         ` Andrea Bernardini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPFJfsuKUjZSkKCZLTFUMybXpp6N4SMXqGerduNEsrhfnJ=J2g@mail.gmail.com' \
    --to=andrebask@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).