Search code examples
emacslispslime

Copy/Yank entire Lisp form in Slime


Is there a way to copy/yank a whole a form in Slime/Emacs?

For instance, if I have the following function:

(myfunc (lst)
    (myotherfunc lst))

I'd like to yank/copy:

(myotherfunc lst)

by issuing a keyboard shortcut when my cursor is at the opening or closing parenthesis for that form (at the point where Slime/Emacs does parenthesis matching).


Solution

  • In my Emacs, function kill-sexp is bound to C-M-k. That is, assuming the point is just before an opening delimiter of a balanced expression, press Control, Meta, and k at the same time.

    This same command works in various other non-Lisp modes, such as killing brace-delimited blocks in a C-style mode, though the kill-sexp command may not be bound to the same keys.