[slime-devel] How to erase input lines in REPL?

Harald Hanche-Olsen hanche at math.ntnu.no
Sun May 14 08:06:06 UTC 2006

+ doug arro <doug_arro at yahoo.com>:

| My configuration is slime 2.0 + sbcl 0.9.12.  When I enter something
|   like this at the REPL prompt:
|  CL-USER>line1 to be erased
|                     line 2 to be erased
|  How do I erase the lines without using the backspace key and get
|  back to the REPL prompt?

This seems to me more an emacs question than a slime question.
To ask about general emacs editing commands, an emacs newsgroup or
mailing list seems more appropriate.

The obvious answer is to use the standard emacs editing commands.
For example, mark the text and hit C-w.

Slime does have one or two movement commands that might help.
>From the text you get with C-h m:

C-c C-n		slime-repl-next-prompt
C-c C-p		slime-repl-previous-prompt

So perhaps the easiest in your case, assuming that the cursor is not
alread at the start of the first line, is C-c C-p C-k C-k C-k C-k
(i.e., move to the prompt and kill the two lines).

Many experienced lispers prefer an editing style in which parentheses
are always balanced.  Insert a new pair with M-(, move up or down a
level with C-M-u or C-M-d, mark a whole subexpression with C-M-space,
etc.  So if you have this situation

cl-user> (defun foo ()

with the cursor just after the symbol BAR, C-M-u C-M-u C-M-space C-W
will kill the whole expression.  (Turn on transient-mark-mode to
improve the experience.)  Or, to combine this with my previous tip,
C-C C-p C-M-space C-W is perhaps the quickest way.

- Harald

More information about the slime-devel mailing list