[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. ILISP Commands

Most of these key bindings work in both Lisp Mode and ILISP mode. There are a few additional and-go bindings found in Lisp Mode.

5.1 Eval and compile functions  
5.2 Documentation functions  
5.3 Macroexpansion  
5.4 Tracing functions  
5.5 Package Commands  
5.6 Source Code Commands  Working on several files
5.7 Batch commands  Grouping changes for eval/compile
5.8 Files and directories  
5.9 Switching between interactive and raw keyboard modes  Interactive and raw keyboard modes
5.10 Interrupts, aborts, and errors  
5.11 Interface to Lisp debuggers  
5.12 Command history  
5.13 Completion  
5.14 Miscellany  Indentation, parenthesis balancing, and comment commands.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.1 Eval and compile functions

In Lisp, the major unit of interest is a form, which is anything between two matching parentheses. Some of the commands here also refer to "defun," which is a list that starts at the left margin in a Lisp buffer, or after a prompt in the ILISP buffer. These commands refer to the "defun" that contains the point.

"A call" refers to a reference to a function call for a function or macro, or a reference to a variable. Commands which "insert a call" in the ILISP buffer will bring up the last command which matches it or else will insert a template for a call.

When an eval is done of a single form matching ilisp-defvar-regexp the corresponding symbol will be unbound and the value assigned again.

When you send a form to Lisp, the status light will reflect the progress of the command. In a Lisp mode buffer the light will reflect the status of the currently selected inferior Lisp unless lisp-show-status is nil. The very first inferior Lisp command executed may send some forms to initialize the inferior Lisp. If you want to find out what command is currently running, use the command C-z s (status-lisp). If you call it with a prefix, the pending commands will be displayed as well.

Note that in this table as elsewhere, the key C-z (ilisp-*prefix*) is used as a prefix character for ILISP commands, though this may be changed. For a full list of key-bindings, use M-x describe-mode or M-x describe-bindings while in an ILISP-mode buffer.

The eval/compile commands verify that their expressions are balanced and then send the form to the inferior Lisp. If called with a positive prefix, the result of the operation will be inserted into the buffer after the form that was just sent.

For commands which operate on a region, the result of the compile or eval is the last form in the region.

The `and-go' versions will perform the operation and then immediately switch to the ILISP buffer where you will see the results of executing your form. If eval-defun-and-go-lisp or compile-defun-and-go-lisp is called with a prefix, a call for the form will be inserted as well.

C-z
The prefix-key for most ILISP commands. This can be changed by setting the variable ilisp-*prefix*.

RET (return-ilisp)
In ILISP-mode buffer, sends the current form to lisp if complete, otherwise creates a new line and indents. If you edit old input, the input will be copied to the end of the buffer first and then sent.

C-] (close-and-send-lisp)
Closes the current sexp, indents it, and then sends it to the current inferior Lisp.

LFD (newline-and-indent-lisp)
Insert a new line and then indent to the appropriate level. If called at the end of the inferior Lisp buffer and an sexp, the sexp will be sent to the inferior Lisp without a trailing newline.

C-z e (eval-defun-lisp)
M-C-x (eval-defun-lisp)
C-z C-e (eval-defun-and-go-lisp)
Send the defun to Lisp.

C-z r (eval-region-lisp)
C-z C-r (eval-region-and-go-lisp)

C-z n (eval-next-sexp-lisp)
C-z C-n (eval-next-sexp-and-go-lisp)

C-z c (compile-defun-lisp)
C-z C-c (compile-defun-lisp-and-go)
When compile-defun-lisp is called in an inferior Lisp buffer with no current form, the last form typed to the top-level will be compiled.

C-z w (compile-region-lisp)
C-z C-w (compile-region-and-go-lisp)

If any of the forms contain an interactive command, then the command will never return. To get out of this state, you need to use abort-commands-lisp (C-z g). If lisp-wait-p is t, then EMACS will display the result of the command in the minibuffer or a pop-up window. If lisp-wait-p is nil, (the default) the send is done asynchronously and the results will be brought up only if there is more than one line or there is an error. In this case, you will be given the option of ignoring the error, keeping it in another buffer or keeping it and aborting all pending sends. If there is not a command already running in the inferior Lisp, you can preserve the break loop. If called with a negative prefix, the sense of lisp-wait-p will be inverted for the next command.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2 Documentation functions

describe-lisp, inspect-lisp, arglist-lisp, and documentation-lisp switch whether they prompt for a response or use a default when called with a negative prefix. If they are prompting, there is completion through the inferior Lisp by using TAB or M-TAB. When entering an expression in the minibuffer, all of the normal ILISP commands like arglist-lisp also work.

Commands that work on a function will use the nearest previous function symbol. This is either a symbol after a `#'' or the symbol at the start of the current list.

The fi:clman and fi:clman-apropos commands for accessing the Franz Allegro CL documentation are not enabled by default. See section 1.1 Configuration and compilation.

C-z a (arglist-lisp)
Return the arglist of the current function. With a numeric prefix, the leading paren will be removed and the arglist will be inserted into the buffer.

SPC (ilisp-arglist-message-lisp-space)
Display the value of the argument list of a symbol followed by SPC. To enable this feature you have to set ilisp-*arglist-message-lisp-space-p* to t.

C-z d (documentation-lisp)
Infers whether function or variable documentation is desired. With a negative prefix, you can specify the type of documentation as well. With a positive prefix the documentation of the current function call is inserted into the buffer.

C-z i (describe-lisp)
Describe the previous sexp (it is evaluated). If there is no previous sexp and if called from inside an ILISP buffer, the previous result will be described.

C-z I (inspect-lisp)
Switch to the current inferor Lisp and inspect the previous sexp (it is evaluated). If there is no previous sexp and if called from inside an ILISP buffer, the previous result will be inspected.

C-z H (hyperspec-lookup)
Look up a standard symbol in the Common Lisp HyperSpec and display the relevant section.

C-z L or C-z M-l (cltl2-lookup)
Look up a Common Lisp symbol in the CLtL2 book and display the relevant section.

C-z D (fi:clman)
C-z A (fi:clman-apropos)
If the Franz online Common Lisp manual is available, get information on a specific symbol. fi:clman-apropos will get information apropos a specific string. Some of the documentation is specific to the Allegro dialect, but most of it is for standard Common Lisp.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.3 Macroexpansion

C-z M (macroexpand-lisp)
C-z m (macroexpand-1-lisp)
These commands apply to the next sexp. If called with a positive numeric prefix, the result of the macroexpansion will be inserted into the buffer. With a negative prefix, prompts for expression to expand.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.4 Tracing functions

C-z t (trace-defun-lisp)
traces the current defun. When called with a numeric prefix the function will be untraced. When called with negative prefix, prompts for function to be traced.
C-z C-t (trace-defun-lisp-break)
traces the current defun and enters the debugger whenever that function is invoked. When called with a numeric prefix the function will be untraced. When called with negative prefix, prompts for function to be traced.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.5 Package Commands

The first time an inferior Lisp mode command is executed in a Lisp Mode buffer, the package will be determined by using the regular expression ilisp-hash-form-regexp to find a package sexp and then passing that sexp to the inferior Lisp through ilisp-package-command. For the `common-lisp' dialect, this will find the first (in-package PACKAGE) form in the file. A buffer's package will be displayed in the mode line. If a buffer has no specification, forms will be evaluated in the current inferior Lisp package.

Buffer package caching can be turned off by setting the variable lisp-dont-cache-package to T. This will force ILISP to search for the closest previous "in-package" form corresponding to ilisp-hash-form-regexp in the buffer each time an inferior Lisp mode command is executed.

C-z P (set-package-lisp)
Set the inferior Lisp package to the current buffer's package or with a prefix to a manually entered package.

C-z p (set-buffer-package-lisp)
Set the buffer's package from the buffer. If it is called with a prefix, the package can be set manually.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.6 Source Code Commands

The following commands all deal with finding things in source code. The first time that one of these commands is used, there may be some delay while the source module is loaded. When searching files, the first applicable rule is used:

M-x lisp-directory defines a set of files to be searched by the source code commands. It prompts for a directory and sets the source files to be those in the directory that match entries in auto-mode-alist for modes in lisp-source-modes. With a positive prefix, the files are appended. With a negative prefix, all current buffers that are in one of lisp-source-modes will be searched. This is also what happens by default. Using this command stops using a tags file.

edit-definitions-lisp, who-calls-lisp, and edit-callers-lisp will switch whether they prompt for a response or use a default when called with a negative prefix. If they are prompting, there is completion through the inferior Lisp by using TAB or M-TAB. When entering an expression in the minibuffer, all of the normal ILISP commands like arglist-lisp also work.

edit-definitions-lisp (M-.) will find a particular type of definition for a symbol. It tries to use the rules described above. The files to be searched are listed in the buffer *Edit-Definitions*. If lisp-edit-files is nil, no search will be done if not found through the inferior Lisp. The variable ilisp-locator contains a function that when given the name and type should be able to find the appropriate definition in the file. There is often a flag to cause your Lisp to record source files that you will need to set in the initialization file for your Lisp. The variable is *record-source-files* in both allegro and lucid. Once a definition has been found, next-definition-lisp (M-,) will find the next definition (or the previous definition with a prefix).

edit-callers-lisp (C-z ^) will generate a list of all of the callers of a function in the current inferior Lisp and edit the first caller using edit-definitions-lisp. Each successive call to next-caller-lisp (M-`) will edit the next caller (or the previous caller with a prefix). The list is stored in the buffer *All-Callers*. You can also look at the callers by doing M-x who-calls-lisp.

search-lisp (M-?) will search the current tags files, lisp-directory files or buffers in one of lisp-source-modes for a string or a regular expression when called with a prefix. next-definition-lisp (M-,) will find the next definition (or the previous definition with a prefix).

replace-lisp (M-") will replace a string (or a regexp with a prefix) in the current tags files, lisp-directory files or buffers in one of lisp-source-modes.

Here is a summary of the above commands (behavior when given prefix argument is given in parentheses):

M-x lisp-directory
Define a set of files to be used by the source code commands.

M-. (edit-definitions-lisp)
Find definition of a symbol.

M-, (next-definition-lisp)
Find next (previous) definition.

C-z ^ (edit-callers-lisp)
Find all callers of a function, and edit the first.

M-` (next-caller-lisp)
Edit next (previous) caller of function set by edit-callers-lisp.

M-x who-calls-lisp
List all the callers of a function.

M-? (search-lisp)
Search for string (regular expression) in current tags, lisp-directory files or buffers. Use next-definition-lisp to find next occurence.

M-" (replace-lisp)
Replace a string (regular expression) in files.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.7 Batch commands

The following commands all deal with making a number of changes all at once. The first time one of these commands is used, there may be some delay as the module is loaded. The eval/compile versions of these commands are always executed asynchronously.

mark-change-lisp (C-z SPC) marks the current defun as being changed. A prefix causes it to be unmarked. clear-changes-lisp (C-z * 0) will clear all of the changes. list-changes-lisp (C-z * l) will show the forms currently marked.

eval-changes-lisp (C-z * e), or compile-changes-lisp (C-z * c) will evaluate or compile these changes as appropriate. If called with a positive prefix, the changes will be kept. If there is an error, the process will stop and show the error and all remaining changes will remain in the list. All of the results will be kept in the buffer *Last-Changes*.

Summary:

C-z SPC (mark-change-lisp)
Mark (unmark) current defun as changed.
C-z * e (eval-changes-lisp)
C-z * c (compile-changes-lisp)
Call with a positive prefix to keep changes.
C-z * 0 (clear-changes-lisp)
C-z * l (list-changes-lisp)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.8 Files and directories

File commands in Lisp source-mode buffers keep track of the last used directory and file. If the point is on a string, that will be the default if the file exists. If the buffer is one of lisp-source-modes, the buffer file will be the default. Otherwise, the last file used in a lisp-source-mode will be used.

C-x C-f (find-file-lisp)
will find a file. If it is in a string, that will be used as the default if it matches an existing file. Symbolic links are expanded so that different references to the same file will end up with the same buffer.

C-z l (load-file-lisp)
will load a file into the inferior Lisp. You will be given the opportunity to save the buffer if it has changed and to compile the file if the compiled version is older than the current version. For `<whatever>.system' files, which are used by DEFSYSTEM tools, no compilation or loading of possibly existing `<whatever>.binary-extension' is attempted.

C-z k (compile-file-lisp)
will compile a file in the current inferior Lisp.

C-z ! (default-directory-lisp)
sets the default inferior Lisp directory to the directory of the current buffer. If called in an inferior Lisp buffer, it sets the Emacs default-directory to the Lisp default directory.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.9 Switching between interactive and raw keyboard modes

There are two keyboard modes for interacting with the inferior Lisp, "interactive" and "raw". Normally you are in interactive mode where keys are interpreted as commands to EMACS and nothing is sent to the inferior Lisp unless a specific command does so. In raw mode, all characters are passed directly to the inferior Lisp without any interpretation as EMACS commands. Keys will not be echoed unless ilisp-raw-echo is T.

Raw mode can be turned on interactively by the command raw-keys-ilisp (C-z #) and will continue until you type C-g. Raw mode can also be turned on/off by inferior Lisp functions if the command io-bridge-ilisp (M-x io-bridge-ilisp) has been executed in the inferior Lisp either interactively or on a hook. To turn on raw mode, a function should print ^[1^] and to turn it off should print ^[0^]. An example in Common Lisp would be:

(progn (format t "^[1^]") (print (read-char)) (format t "^[0^]"))


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.10 Interrupts, aborts, and errors

If you want to abort the last command you can use C-g.

If you want to abort all commands, you should use the command abort-commands-lisp (C-z g). Commands that are aborted will be put in the buffer *Aborted Commands* so that you can see what was aborted. If you want to abort the currently running top-level command, use interrupt-subjob-ilisp (C-c C-c). As a last resort, M-x panic-lisp will reset the ILISP state without affecting the inferior Lisp so that you can see what is happening.

delete-char-or-pop-ilisp (C-d) will delete prefix characters unless you are at the end of an ILISP buffer in which case it will pop one level in the break loop.

reset-ilisp, (C-z z) will reset the current inferior Lisp's top-level so that it will no longer be in a break loop.

Summary:

C-c C-c (interrupt-subjob-ilisp)
Send a keyboard interrupt signal to lisp.
C-z g (abort-commands-lisp)
Abort all running or unsent commands.
M-x panic-lisp (panic-lisp)
Reset the ILISP process state.
C-z z (reset-ilisp)
Reset Lisp to top-level.
C-d (delete-char-or-pop-ilisp)
If at end of buffer, pop a level in break loop.

If lisp-wait-p is nil (the default), all sends are done asynchronously and the results will be brought up only if there is more than one line or there is an error. In case, you will be given the option of ignoring the error, keeping it in another buffer or keeping it and aborting all pending sends. If there is not a command already running in the inferior Lisp, you can preserve the break loop. If called with a negative prefix, the sense of lisp-wait-p will be inverted for the next command.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.11 Interface to Lisp debuggers

ILD is an interface to Lisp debuggers, currently the ones of the AKCL, Allegro, CLISP, CMU CL, Corman Lisp and Lucid Common Lisp dialects. It uses a standard set of single-keystroke commands to interface to a variety of different debuggers and is vaguely modelled after the Symbolics debugger. It provides two key advantages: single keystrokes for moving up and down the stack, and a uniform interface to different debuggers.

Not all debugger commands are available in all implementations. Some are, but further work is needed. These are noted in the code (see the dialect definition files). If you know how to fix them please contact the ILISP maintainer.

Here is a list of the available ILD commands:

M-a (ild-abort)
Abort.
M-c (ild-continue)
Continue.
M-C-n (ild-next)
Next stack frame (with numeric argument n, move to the next n-th stack frame).
M-C-p (ild-previous)
Previous stack frame (with numeric argument n, move to the previous n-th stack frame).
C-c < (ild-top)
Top stack frame.
C-c > (ild-bottom)
Bottom stack frame.
M-b (ild-backtrace)
Backtrace.
M-C-d (ild-locals)
Display all local variables.
M-C-l (ild-local)
Display a particular local variable (with numeric argument n, display the n-th local variable).
M-C-s (ild-step)
Step to the next breakpoint.
C-c r (ild-return)
Return.
M-C-r (ild-retry)
Retry.
C-x t (ild-trap-on-exit)
Trap on exit.
C-c L (select-lisp)
Select Lisp interaction buffer.
C-z C-s (slow-lisp)
Set compiler options for maximal debuggability.
C-z C-f (fast-lisp)
Set compiler options for fastest but least debuggable code.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.12 Command history

ILISP mode is built on top of comint-mode, the general command-interpreter-in-a-buffer mode. As such, it inherits many commands and features from this, including a command history mechanism.

Each ILISP buffer has a command history associated with it. Commands that do not match ilisp-filter-regexp and that are longer than ilisp-filter-length and that do not match the immediately prior command will be added to this history.

M-n (comint-next-input)
M-p (comint-previous-input)
Cycle through the input history.

M-s (comint-previous-similar-input)
Cycle through input that has the string typed so far as a prefix.

M-N (comint-psearch-input)
Search forwards for prompt.
M-P (comint-msearch-input)
Search backwards for prompt.

C-c R (comint-msearch-input-matching)
Search backwards for occurrence of prompt followed by string which is prompted for (not a regular expression).

See comint-mode documentation for more information on `comint' commands.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.13 Completion

Commands to reduce number of keystrokes.

M-TAB (complete-lisp)
will try to complete the previous symbol in the current inferior Lisp. Partial completion is supported unless ilisp-*prefix-match* is set to t. (If you set it to t, inferior Lisp completions will be faster.) With partial completion, `p--n' would complete to `position-if-not' in Common Lisp. If the symbol follows a left paren or a `#'', only symbols with function cells will be considered. If the symbol starts with a `*' or you call with a positive prefix all possible completions will be considered. Only external symbols are considered if there is a package qualification with only one colon. The first time you try to complete a string the longest common substring will be inserted and the cursor will be left on the point of ambiguity. If you try to complete again, you can see the possible completions. If you are in a string, then filename completion will be done instead. And if you try to complete a filename twice, you will see a list of possible completions. Filename components are completed individually, so `/u/mi/' could expand to `/usr/misc/'. If you complete with a negative prefix, the most recent completion (symbol or filename) will be undone.

M-RET (complete)
will complete the current symbol to the most recently seen symbol in Emacs that matches what you have typed so far. Executing it repeatedly will cycle through potential matches. This is from the TMC completion package and there may be some delay as it is initially loaded.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.14 Miscellany

Indentation, parenthesis balancing, movement and comment commands.

TAB (indent-line-ilisp)
indents for Lisp. With prefix, shifts rest of expression rigidly with the current line.

M-C-q (indent-sexp-ilisp)
will indent each line in the next sexp.

M-q (reindent-lisp)
will reindent the current paragraph if in a comment or string. Otherwise it will close the containing defun and reindent it.

C-a (bol-ilisp)
will go after the prompt as defined by comint-prompt-regexp or ilisp-other-prompt or to the left margin with a prefix.

DEL (backward-delete-char-untabify)
converts tabs to spaces as it moves back.

C-z ; (comment-region-lisp)
will put prefix copies of comment-start before and comment-end's after the lines in region. To uncomment a region, use a minus prefix.

C-z ) (find-unbalanced-lisp)
will find unbalanced parens in the current buffer. When called with a prefix it will look in the current region.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by XEmacs shared group account on December, 19 2009 using texi2html 1.65.