4. Internal Editor Help - naver/lispe GitHub Wiki

Command Line

There are many ways to launch a LispE program:

  • Run it: lispe program_file.lisp
  • Edit it: lispe -e program_file.lisp
  • Debug it: lispe -d program_file.lisp -n breakpoint_line

In the case of debugging, the "-n" option is optional.

Here is the full help for the command line:

Different types of operation: 
   
   ; launch the console (interactive mode) 
   lispe 

   ; This help
   lispe -h|-help|--h|--help

   ; dark mode
   lispe -b

   ; execution of 'program' with optional list of arguments
   lispe program arg1 arg2

   ; launch the debugger. '-n' is optional
   lispe -d program -n line_number arg1 arg2

   ; edit 'program' with optional list of arguments
   lispe -e program arg1 arg2
   
   ; The entire pipe is stored in '_args'
   lispe -a:
	- lispe -a: gives back the hand in the console (interactive interpreter)
	- lispe program -a execute 'program' with _args containing the output of the 'pipe'

   ; Execution of 'code' on a pipe output: ls -al | lisp -p '(+ l2 l3)'
   lispe -pb/-pe/-p 'code' arg1 arg2: 
	- '-pb' allows to execute an initial code (must be placed before '-p')
	- '-pe' allows to execute a final code (must be placed before '-p')
	- The lines are automatically cut along the spaces into variables: 
		- accu1, accu2,..., accu9: Nine accumulators (= 0 at startup)
		- ln: is the number of fields
		- ll: is the list of fields
		- l0: is the full line
		- l1, l2, l3...: each variable corresponds to a field in the line split along spaces

   ; Execution of program file on a pipe output: ls -al | lisp -P file
   lispe -P program.lisp arg1 arg2:
		- '-P' has the same variables as '-p'. m_current
		- '-P' 'program.lisp' must contain the function: 
                        (defun runpipe()...) which corresponds to the entry point of the processing. 

   lispe -r 'rgx': Condition (posix regular expressions) must appears right before '-p' or '-P'
   lispe -R 'rgx':Condition (internal regular expressions) must appears right before '-p' or '-P'
   

Note: LispE Regular Expressions

Console and Editor Help

LispE provides its own editor whose help is the following:

Commandes :

   - 1. Programs:
   	- create filename: create a file space with a specific file name
   	- open filename: load a program (use run to execute it)
   	- open: reload the program (use run to execute it)
   	- save filename: save the buffer content in a file
   	- save: save the buffer content with the current filename
   	- run filename: load and run a program filename
   	- run: execute the current content
   	- args v1 v2...vn: set a list of values to the argument list
   	- filename: display the current filename
   	- debug filename: load and debug a program filename
   	- debug: debug the current content
   		- While Debugging:
   			- $: execute the program up to the end
   			- !: stop the execution
   			- %: display all variables
   			- #: toggle between displaying local variables on/off
   			- &: toggle between displaying 'print' operations on/off'
   			- ↓: debug inside a function
   			- ↑: out of a loop or a function
   			- ←: set a breakpoint at the current line
   			- →: jump to the next breakpoint
   			- CR: execute the next line
   			- var: display the content of the variable 'var'
   			- (...): execute some lisp code

   - 2. Console mode (interactive mode):
   	- help: display the help
   	- help n: display one of the help sections (from 1 to 5)
   	- cls: clear screen
   	- history: display the command history
   	- retrieve filename: load the command history from a file
   	- store filename: store the command history in a file
   	- filename: display the current file name
   	- spaces: display all the files stored in memory with their file space id
   	- select space: select a file space
   	- create filename: create a new empty file space
   	- rm: clear the buffer content
   	- rm b:e: remove the lines from b to e (b: or :e is also possible)
   	- list: list the buffer content
   	- list b:e: display the buffer content from line b to e (b: or :e is also possible)
   	- Ctrl-t: up in the code listing
   	- Ctrl-g: down in the code listing
   	- Ctrl-f: force the current line to be appended at the end of the code

   - 3. edit (space): edit mode. You can optionally select also a file space
   	- Ctrl-b: add a breakpoint at the current line
   	- Ctrl-k: delete from cursor up to the end of the line
   	- Ctrl-d: delete a full line
   	- Ctrl-u: undo last modification
   	- Ctrl-r: redo last modification
   	- Ctrl-f: find a string
   	- Ctrl-n: find next
   	- Ctrl-g: move to a specific line, '$' is the end of the code
   	- Ctrl-l: reload file from disk
   	- Ctrl-t: reindent the code
   	- Ctrl-h: local help
   	- Ctrl-w: write file to disk
   	- Ctrl-c: exit the editor

   	- Alt-x: cut mouse selection
   	- Alt-c: copy mouse selection
   	- Alt-v: paste mouse selection
        - Alt-+: indent to the right
        - Alt--: de-indent to the left

   	- Ctrl-x: Combined Commands
                - f: search with LispE internal regular expressions
                - F: search with posix regular expressions 
   		- D: delete a bloc of lines
   		- n: hide/display line numbers
   		- c: copy a bloc of lines
   		- x: cut a bloc of lines
   		- v: paste a bloc of lines
   		- d: debug the code
   		- r: run the code
   		- w: write and quit
   		- l: load a file
   		- h: full help
   		- m: toggle mouse on/off
   		- u: toggle between top and bottom of the screen
                - +: indent current line or selected lines to the right
                - -: de-indent current line or selected lines to the left
   		- q: quit

   - 5. System:
   	- !unix: what follows the '!' will be executed as a Unix command (ex: !ls)
   	- !vs=unix: what follows the '=' will be executed as a Unix command (!vs=ls)
   	- clear (space): clear the current environment or a specifc file space
   	- reinit: clear the buffer content and initialize predeclared variables
   	- Ctrl-d: end the session and exit tamgu
   	- exit: end the session and exit tamgu

Editor

If you launch: lispe -e filename, then LispE will automatically open the editor and load the content of the file. If the file does not exist, it will create an empty space, whose name will be the one provided on the command line.

LispE has two modes:

  • editor mode: ctrl-q or ctrl-c quits editor mode back to the console
  • console mode: you need to write edit in the console to enter editor mode

File Spaces

The internal editor can simultaneously edit many files in memory. Each file is then stored in its own space.

When you launch the editor, the space 0 is automatically created to host the file you want to edit. If you want to load another file, all you need to do is to launch the command:

# filename is the filename you want to load
load filename

This will automatically create a new file space.

To see all file spaces in memory:

# spaces displays all loaded files in memory with their 
# numerical space id
spaces

Space:

File 0: /home/user/lispe/examples/patterns/minizorg.lisp
File 1: /home/user/lispe/examples/patterns/rgx.lisp <<< 

# Note that the active space is denoted with: "<<<"

To switch between spaces, you can either use: select or edit space_id

# You can edit any files by stating their space id:
edit 1

# or select a space
select 1

If you need to create a new file, you can use:

create filename

This will automatically creates a new space for you, whose name is filename, which you can then start to edit and save to disk.