> my idea is to add an Emacs-like command line to PicoLisp. I thought this
Good idea :)
> 1. move all commands from command-mode to insertion-mode (the only
> 2. eliminate command-mode
> 3. replace the vi 1-key bindings with Emacs keychords (with Control and
> Meta prefix-keys) for all commands that have equal or similar semantics to
> Emacs commands
> 4. eliminate/replace the commands that do not fit into the non-modal Emacs
> 5. write some new commands to give PicoLisp commandline editing the
> authentic Emacs feeling.
Yes. Quite a lot of stuff, though.
> Do the definitions in lib/term.l only work in xterm (X11 session) or in
> a console session (without X11) too?
They should work where 'tput' and 'terminfo' is available.
> >> Would Emacs-like key-chords be possible? E.g. 'C-x u', i.e. type first
> >> '<Ctrl>x' and then 'u', using 'C-x' as a kind of prefix that can be
> >> combined with e.g. [a-zA-Z0-9].
Yes, I think so. By handling sequences of key events, collecting them as
necessary, and then deciding what action to perform.
> Do you have an example of this kind of event-handling in the PicoLisp
As a central entry point the 'fkey' function from "lib/led.l" can be
used. An example usage is in
The flight simulator in "rcsim/main.l" uses it too, defining some
function keys to control the airplane.
But these examples don't handle sequences of multiple-key events. For
those, a given key like Ctrl-X might then wait for a short timeout
period (e.g. with (key 200)) for further keys to arrive.
> > No, they are ASCII values. In general, a control character is the
> > corresponding uppercase character minus 64. For example, Ctrl-A is 1,
> > Ctrl-B is 2, Ctrl-C is 3 and so on.
> But would it be possible to make PicoLisp call 'delete-char' when the
> Ctrl-d ASCII is send, and use another (less common) ASCII value to exit
> the program?
Yes. Exiting upon Ctrl-D is explicitly coded into the line editor. So
any other key (or none at all) might be used.