Emacs-style PicoLisp Editing
Introduction
(from the tutorial)You can switch the command line editor to an 'emacs' style, if you call the function (em) (i.e. without arguments). A single call is enough. Alternatively, you could invoke PicoLisp at least once with the -em command line option
$ pil -em + :
The style will be remembered in a file "~/.pil/editor", and used in all subsequent PicoLisp sessions.
To switch back to 'vi' style, call (vi), use the -vi command line option, or simply remove "~/.pil/editor".
Documentation for (em)
(from the reference)(em 'sym) -> sym (em 'sym 'cls) -> sym (em '(sym . cls)) -> sym (em) -> NIL (Debug mode only) Opens the "emacs" editor on the function or method definition of sym. A call to ld thereafter will load the modified file. A call without arguments permanently switches the REPL line editor and the edit function to "emacs" mode. See also doc, edit, vi, *Dbg, debug and pp. : (em 'url> '+CuSu) # Edit the method's source code, then exit from 'emacs' -> T
Reference (Cheat Sheet)
Starting PicoLisp with Emacs-style line-editing
| action | comment | |---------------+-----------------------------------| | $ ./pil -em + | 'pil +' with "-em" shell argument | |---------------+-----------------------------------| | $ ./pil + | or simply 'pil +' | | : (em) | and then '(em)' in the REPL |
Files and Directories
| action | keys | |---------------------------------------+-------------| | show pwd | C-M-d | | change directory | C-c C-d | | make directory | C-c + | | list directory files | C-x C-d | | list directory files (with dot-files) | C-u C-x C-d | | dired-like file list | C-x d | | dired-like file list (with dot-files) | C-u C-x d | | find file (emacsclient) | C-x C-f | | find file (zile) | C-x f | | line number(s) of file(s) | C-x l |
Help/Info/Debugging
| action | keys | |-----------------------+-----------| | debug | C-h d | | unbug | C-u C-h d | | file info | C-h i | | symbol doc | C-h f | | show symbol | C-h s | | pretty print (pp) | C-h p p | | pretty print (pretty) | C-h p r | | | |
Quit/Stop/Undo
| action | keys | |---------------+--------------| | abort command | C-g | | undo | C-x u or C-_ | | quit | C-q |
(Incremental) Search
| action | keys | |------------------+------| | goto (find) char | M-g |
Motion
| entitiy to move over | backward | forward | |----------------------+----------+---------| | character | C-b | C-f | | word | M-b | M-f | | line up/down | C-p | C-n | | line beg/end | C-a | C-e | | sexp | C-M-b | C-M-f | The arrow keys can be used for navigation too.
Killing and Deleting
| entitiy | backward | forward | |------------------+-------------+---------| | character | BACKSPACE | C-d | | word | M-BACKSPACE | M-d | | line (to end of) | | C-k | | action | keys | |-------------------+-------| | kill sexp | C-M-k | | yank | C-y | | content kill-ring | C-h r |
Case Change
| action | keys | |------------------+------------| | toggle char case | M-c or M-l |
The Command Line
| action | keys | |------------------------------+-------| | complete word | TAB | | execute | RET | | history search pattern input | C-M-s | | history search forward | M-s | | history search backward | M-r |
Tags
| action | keys | |--------------+------| | find tag | M-. | | pop tag-mark | M-* | works in Emacs after using (em 'fun) for editing PicoLisp sources
Shell
| action | keys | |-----------------------------+--------------| | call shell-command | C-c C-c | | | (or C-c C-!) | | clear screen | C-l | | terminate process | C-q | | interrupt program execution | C-r |
https://picolisp.com/wiki/?emacsstyleled
29nov12 | tj |