Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy/Yank entire Lisp form in Slime

Tags:

emacs

lisp

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).

like image 753
Joel Avatar asked Jan 11 '11 12:01

Joel


2 Answers

  • C-M-SPC (mark-sexp) to put the mark at the end of the sexp, then copy/yank

  • C-M-f (forward-sexp) and C-M-b (backward-sexp) are useful to move forward and backward over a balanced expression

http://www.emacswiki.org/emacs/ParenthesisMatching#toc2

like image 176
koddo Avatar answered Oct 04 '22 01:10

koddo


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.

like image 20
seh Avatar answered Oct 04 '22 03:10

seh