Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Paredit to wrap existing expression

I'm using Emacs in Paredit mode for Lisp code.

I'm trying to wrap a function call in println:

(square 5)
(println (square 5))

What ends up happening in paredit is this:

(square 5)
(println) (square 5)

There is no way i can delete closing paren of println and move it to the end.

The way i'm doing it now is to: 1. delete function call and yank it within println 2. write println without paren, visually select code and enclose in parens

(square 5)
println (square 5)
=> select block of code and type (
(println (square 5))

Both of these approaches are tedious. This seems to be a common problem anytime i write code inside out in Paredit. Any help would be appreciated

like image 990
Sathish Avatar asked Jan 05 '13 09:01

Sathish


1 Answers

paredit-wrap-round command may help (bound to M-( in the paredit version I use).

like image 64
Anton Kovalenko Avatar answered Sep 28 '22 21:09

Anton Kovalenko