editline support in place (up-arrow recalls history, and more)

10 views
Skip to first unread message

Jason E. Aten

unread,
Dec 23, 2012, 5:12:43 AM12/23/12
to crack-l...@googlegroups.com, Michael Muller, Shannon Weyrick
In a massive step towards more usability, I've added editline
support to the repl.

This means that up-arrow and down-arrow work to scroll through history
as you would expect from other shells.  And emacs-like keybindings
are available: ctrl-a, ctrl-e, ctrl-k, ctrl-y, etc do what you expected (goto
beginning of line, goto end of line, cut to end of line, yank last cut, etc). 

libeditline is a non-gpl (it is bsd licensed) replacement for gnu readline.
http://sourceforge.net/projects/libedit/

These changes are in the latest on the prepurgedanglers branch (37a91a8), but aren't yet
integrated into the the Makefile, because I need some pointers on how
to add a third party C library to the make system. Currently the libedit.so
is built manually, detailed below.  Currently the libeditline files are in
crack-language/wisecrack/libedit.

#
# notes on building the latest prepurgedanglers branch (37a91a8),
#  that incorporates lib editline.
#
git clone https://github.com/glycerine/crack-language.git
cd crack-language
git checkout prepurgedanglers
cd wisecrack/libedit
CFLAGS=-fpic ./configure
make
cp libedit.so ../..

# now we can build crack as usual...
cd ../..  # get to the crack-language/ directory
./bootstrap
LIBS=-ledit ./configure
make


Best,
Jason

Conrad Steenberg

unread,
Dec 23, 2012, 12:29:29 PM12/23/12
to crack-l...@googlegroups.com
Hi Jason,

Firstly, I'm very excited about having a repl, as well as a new
contributor to a project that I cherish :-)

Usually we don't add 3rd party code to the repo, but test for its
presence in the cmake and autotools setup scripts.

I'd be happy to add these to Makefile.am and CMakeLists.txt files if you
want.

Cheers,
Conrad

j.e....@gmail.com

unread,
Dec 23, 2012, 2:14:27 PM12/23/12
to Conrad Steenberg, crack-l...@googlegroups.com
Hi Conrad,

Nice to meet you. This is a great project, isn't it!

That would be lovely if you could add libeditline to the configure & make files.  Send me a pull request, or patch or whatever's easiest for you.

Thanks!

Best,

Jason

Conrad Steenberg

unread,
Dec 23, 2012, 7:05:44 PM12/23/12
to crack-l...@googlegroups.com
Hi Jason,

Patch attached against your prepurgedanglers branch, making libedit
required. If you want to make it optional, hide the code behind an
#ifdef EDITLINE
and I'll make it optional. But as you can see from the diff it's pretty
simple anyway :-)

The repl itself works fine for me just testing it lightly.

Cheers,
Conrad
findlibedit.diff

j.e....@gmail.com

unread,
Dec 23, 2012, 7:24:53 PM12/23/12
to Conrad Steenberg, crack-l...@googlegroups.com
Terrific!

Jason E. Aten

unread,
Dec 24, 2012, 4:16:42 AM12/24/12
to crack-l...@googlegroups.com
On Sun, Dec 23, 2012 at 6:05 PM, Conrad Steenberg <conrad.s...@gmail.com> wrote:
Patch attached against your prepurgedanglers branch, making libedit
required. If you want to make it optional, hide the code behind an
#ifdef EDITLINE
and I'll make it optional. But as you can see from the diff it's pretty
simple anyway :-)

I applied the patches on this branch "editlinebuild", and put #ifdefs around stuff in wisecrack/editor.h and editor.cc so that it automatically falls back to using the non-editline simple alternative if EDITLINE is not defined.

https://github.com/glycerine/crack-language/tree/editlinebuild

It seems to work via cmake, but not via configure (the editline library doesn't seem to be detected via configure, or at least the same #defines aren't in place?)

- J

Jason E. Aten

unread,
Dec 24, 2012, 4:18:39 AM12/24/12
to crack-l...@googlegroups.com

Ideally I would imagine we should make editline optional, but definitely use it if available.

Reply all
Reply to author
Forward
0 new messages