开发者

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


  • 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


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.


The emacs minor mode ParEdit does this on normal kills 'C-k' by default. I would certainly recommend it to any emacs+slime users.


You can use lispy and then you can press n which runs lispy-new-copy to copy

(myotherfunc lst)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜