vindarel / cl-readline-example

Using readline in Common Lisp.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Readline example in Common Lisp

Example from cl-readline's documentation: https://vindarel.github.io/cl-readline/

It showcases custom completion and keybindings. Type a command (with TAB-completion), and type arguments (with TAB-completion of the choices).

To run the example:

sbcl --script example.lisp

or build an executable:

make build  # and then ./clreadline

(we added handling of a C-c).

See the custom completion: first, type and complete a verb (eat, throw,…). Later words are completed as fruits (orange, banana,…). Type "o" and see the completion to "orange" (no dropdown list).

Also type C-o to insert a predefined custom text,

and type an opening paren "(" to insert two parens and move the cursor in-between (using rl:insert-text and rl:backward-char).

Some command line apps using cl-readline:

  • cl-repl - an SBCL repl.
  • cl-torrents - searching and downloading torrents from popular trackers.
  • replic - a library to quickly build a readline app from a lisp library.
  • sbcli - a simple wrapper around the bare-bones SBCL REPL with completion of Lisp symbols, syntax highlighting, no interactive debugger by default.
  • cl-repl - an advanced terminal Lisp REPL for the terminal: interactive debugger, syntax highlighting, code editing with a text editor…
  • OpenBookStore - a book management software, with web and readline interfaces.
  • shtookovina - a language learning app (unmaintained).

Please add yours here and/or in readline's wiki!

Changelog

We added:

  • Nov, 2023: bind "(" to "( )" and move the cursor in-between.
  • Nov, 2022: handle a C-d (NIL input), output something to show using the text variable.
  • july, 2019: rewrote without curry, removed the dependency on Alexandria, added a dependency on cl-str.
  • asdf system declaration
  • make build to build a binary
  • catch a C-c (and others) and quit gracefully (in executable only).

About

Using readline in Common Lisp.


Languages

Language:Common Lisp 97.5%Language:Makefile 2.5%