I am using paredit. Sometimes I accidentely wrap something in curly braces or I have a situation where I want unwrap something for some other reason? What ist the right command to use when undo does not work?

I am looking for a command which turns something like this:

(hello) world

into this:

hello world

while the cursor is at the front.

2 Answers 2


I think paredit-splice, M-s, will do that. Point may need to be inside the expression you want to 'unwrap'.


I have the following function bound to M-D. Hitting M-D RET makes a pair of brackets disappear.

(defun yf/replace-or-delete-pair (open)
  "Replace pair at point by OPEN and its corresponding closing character.
The closing character is lookup in the syntax table or asked to
the user if not found."
     (format "Replacing pair %c%c by (or hit RET to delete pair):"
               (forward-sexp 1)
  (if (memq open '(?\n ?\r))
    (let ((close (cdr (aref (syntax-table) open))))
      (when (not close)
        (setq close
               (format "Don't know how to close character %s (#%d) ; please provide a closing character: "
                       (single-key-description open 'no-angles)
      (yf/replace-pair open close))))

(defun yf/replace-pair (open close)
  "Replace pair at point by respective chars OPEN and CLOSE.
If CLOSE is nil, lookup the syntax table. If that fails, signal
an error."
  (let ((close (or close
                   (cdr-safe (aref (syntax-table) open))
                   (error "No matching closing char for character %s (#%d)"
                          (single-key-description open t)
    (insert-pair 1 open close))
  (backward-char 1))

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.