Next: , Previous: Evaluation, Up: SLIME mode


3.3 Compilation commands

SLIME has fancy commands for compiling functions, files, and packages. The fancy part is that notes and warnings offered by the Lisp compiler are intercepted and annotated directly onto the corresponding expressions in the Lisp source buffer. (Give it a try to see what this means.)

C-c C-c
M-x slime-compile-defun
Compile the top-level form at point. The region blinks shortly to give some feedback which part was chosen.

With (positive) prefix argument the form is compiled with maximal debug settings (C-u C-c C-c). With negative prefix argument it is compiled for speed (M-- C-c C-c). If a numeric argument is passed set debug or speed settings to it depending on its sign.

The code for the region is executed after compilation. In principle, the command writes the region to a file, compiles that file, and loads the resulting code.

C-c C-k
M-x slime-compile-and-load-file
Compile and load the current buffer's source file. If the compilation step fails, the file is not loaded. It's not always easy to tell whether the compilation failed: occasionally you may end up in the debugger during the load step.

With (positive) prefix argument the file is compiled with maximal debug settings (C-u C-c C-k). With negative prefix argument it is compiled for speed (M-- C-c C-k). If a numeric argument is passed set debug or speed settings to it depending on its sign.

C-c M-k
M-x slime-compile-file
Compile (but don't load) the current buffer's source file.
C-c C-l
M-x slime-load-file
Load a Lisp file. This command uses the Common Lisp LOAD function.
M-x slime-compile-region
Compile the selected region.

The annotations are indicated as underlining on source forms. The compiler message associated with an annotation can be read either by placing the mouse over the text or with the selection commands below.

M-n
M-x slime-next-note
Move the point to the next compiler note and displays the note.
M-p
M-x slime-previous-note
Move the point to the previous compiler note and displays the note.
C-c M-c
M-x slime-remove-notes
Remove all annotations from the buffer.
C-x `
M-x next-error
Visit the next-error message. This is not actually a SLIME command but SLIME creates a hidden buffer so that most of the Compilation mode commands (see Compilation Mode) work similarly for Lisp as for batch compilers.