I am using Emacs and Slime to work on Common Lisp code and I would like to know the most efficient way to move the cursor to the beginning of the REPL> assessment.

For instance, modelling the cursor as "I", which keys should I press to move the cursor from this position:

REPL> (defvar lista-history-entries (reverse (mapcar #'url (mapcar #'htree:data 
                                                                   (with-data-unsafe "I" (history (history-path (current-buffer)))
                                                                     (alex:hash-table-keys (htree:entries history)))))))

Into this position:

REPL> "I"(defvar lista-history-entries (reverse (mapcar #'url (mapcar #'htree:data
                                                                   (with-data-unsafe (history (history-path (current-buffer)))
                                                                     (alex:hash-table-keys (htree:entries history)))))))

If I press C-a it brings me to the beginning of the line, which is only useful for my goal if the starting position is on the first line. If I press M-a it brings me to the NIL expression, just above the REPL. It is close and helpful. But I bet there is a way to be exactly at the beginning of the evaluation.

2 Answers 2


The slime REPL buffer is is REPL mode. You can get information about the mode with C-h m. That is useful in that it shows you the keymap for the mode, and among other things, you will see that C-c C-p is bound to slime-repl-previous-prompt. Here is an excerpt from the description:

REPL mode defined in ‘slime-repl.el’:
Major mode for interacting with a superior Lisp.
key             binding
---             -------

C-c     Prefix Command
C-j     slime-repl-newline-and-indent
RET     slime-repl-return
C-x     Prefix Command
ESC     Prefix Command
SPC     slime-space
  (this binding is currently shadowed)
,       slime-handle-repl-shortcut
DEL     backward-delete-char-untabify
C-<down>    slime-repl-forward-input
C-<return>  slime-repl-closing-return
C-<up>      slime-repl-backward-input
<return>    slime-repl-return

C-x C-e     slime-eval-last-expression

C-c C-c     slime-interrupt
C-c C-n     slime-repl-next-prompt
C-c C-o     slime-repl-clear-output
C-c C-p     slime-repl-previous-prompt
C-c C-s     slime-complete-form
C-c C-u     slime-repl-kill-input
C-c C-z     slime-nop
C-c ESC     Prefix Command
C-c I       slime-repl-inspect

M-RET       slime-repl-closing-return
M-n     slime-repl-next-input
M-p     slime-repl-previous-input
M-r     slime-repl-previous-matching-input
M-s     slime-repl-next-matching-input

C-h m is one of the first things I do when exploring an unfamiliar mode.


backward-sexp, bound to C-M-b by default`, would do it. Of course, if you’re nested inside several s–expressions then you would need to press it multiple times.

So perhaps you want beginning-of-defun, bound to C-M-a, instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.