How can I go from

((equal arg '(4))
        (setq current-prefix-arg nil)

to here

        (setq current-prefix-arg nil)

(sp-unwrap-sexp) and kill the line?

I would normally go to the ((equal arg '(4)) line and C-k and go down and kill the )

So the thinking is radically different. In this situation, even though if I write down the actual keystrokes, it might be not that inefficient.
But I get an uneasy feeling that I might be doing something that was not intended by the library.

Of course it would be good if someone can point out the most efficient way, but I know that's hard because there are many cases.

Just wondering what's the mode of thinking here (using a new library or using a new way of thinking) that's acceptable and at least mildly efficient.

If I have to guess, and after gaining a bit of more experience using smartparens.

I would go to

(^(equal arg '(4))

and kill the remaining line, then

        (setq current-prefix-arg nil)

Then delete the parenthesis by unwrap not by delete.

Deleting a paren seems to delete the content inside, not sure if this is the default mode. and not sure if there's another way of deleting paren other than unwrap

  • There are probably hundreds of ways to do that, all insignificantly different from each other. What exactly is the point? Are you trying to optimize this particular operation? Why? How many times do you expect to do it? And when you have to do it, will you remember the optimized way or will you need to go back over dozens and dozens of notes to find it? From my POV, you should use whatever works for you at the moment you encounter the problem. Clicking at the appropriate points and pressing DEL (possibly repeatedly) is just as effective as any other method. The rest is just opinion.
    – NickD
    Aug 25, 2023 at 20:03
  • @NickD Well, I can see your point. but for a person who's new to the new mode of thinking (structural editing ?, At the time of asking the question, I didn't even know the term) I was confused I guess. It took me quite a time to find out why DEL delete things that are out of region that I tried to delete. I edited the op to reflect what I found out.
    – eugene
    Aug 26, 2023 at 4:28

1 Answer 1


smartparens has a command precisely for this use-case. Place your cursor before the (setq and run sp-splice-sexp-killing-backward, bound by default to C-M-<backspace>.

Your Answer

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

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