Alexander Burger <a...@software-lab.de> writes:

Hi Alex,

>> my idea is to add an Emacs-like command line to PicoLisp. I thought this

> Yes. Quite a lot of stuff, though.

I already have a basic emacs commandline version running, the most basic
Emacs 'movement, deletion and paste' commands, just by changing the
keybinding of existing functions to Emacs bindings with <Ctrl>prefix. 

But there are still several things I don't really understand: 

>> >> 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
>> sources?
>
> As a central entry point the 'fkey' function from "lib/led.l" can be
> used. An example usage is in
>
>    http://rosettacode.org/wiki/Keyboard_macros#PicoLisp


in lib/term.l I find: 

,------------------------------------------
| (setq
|    *XtF1    (in '("tput" "kf1") (line T))
|    *XtF2    (in '("tput" "kf2") (line T))
`------------------------------------------

but in the web I still did not find a list of all the keys like "kf1"
and "kf2" that 'tput' knows about - where can I look them up? I would
e.g. need to know how to adress the Alt key - "kalt"? I guess not... 

and what about this notation: 

,------------------------------------------------
| *XtMenu  "^[[29~"                            #?
`------------------------------------------------

where do I find the explanation for "^[[29~"?


In http://rosettacode.org/wiki/Keyboard_macros#PicoLisp I find: 

,------------------------------------------------------
| (load "@lib/term.l")
|  
| (fkey *XtF1
|    (prinl "Initialized value to " (setq *Number 1)) )
|  
| (fkey *XtUp
|    (prinl "Incremented to " (inc '*Number)) )
`------------------------------------------------------

thats easy enough. 

> The flight simulator in "rcsim/main.l" uses it too, defining some
> function keys to control the airplane.

same thing here: 

,--------------------
| (fkey *XtUp
|    (down> *Model) )
`--------------------

> 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.

could you give a little example how this would look like, e.g. if I want
to define the Emacs binding 'C-x u' ('<Ctrl>-x u'), i.e. press C-x first
(as a prefix) and then u?

> Yes. Exiting upon Ctrl-D is explicitly coded into the line editor. So
> any other key (or none at all) might be used.

I redefined <Ctrl>D to <Ctrl>Q, that was easy. 
(What about <Ctrl>C - where is that defined?)



-- 
cheers,
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to