Both autopair and smartparens provide functionality for inserting matching pairs of delimiters automatically.

How do they differ from each other in practice (if at all)? What are some use cases that are covered by one of these packages but not by the other?

  • 2
    If smartparens is anything like paredit (and from what I understand, it is), then it's about a lot more than just inserting matching pairs. In fact, if all you want is matching pairs, smartparens might be overkill.
    – Malabarba
    Oct 10, 2014 at 11:44

2 Answers 2


smartparens has a superset of the functionality provided by autopair. Apart from providing pair insertion (which is what autopair does) , it supports manipulating what it calls "hybrid sexps" or sexps in non-lisp modes. It provides commands for navigating, marking, joining, splitting, absorbing and more for sexps among other things.

I personally use smartparens and found that it provides some overlapping functionality with

  • yasnippet - ability to trigger pair insertion using a string
  • change-inner - select expression within matched pair
  • and paredit of course
  • Interesting! How large is the overlap with change-inner? Based on your own experience, would you say that smartparens could be used as a replacement for change-inner?
    – itsjeyd
    Oct 10, 2014 at 18:26
  • 1
    Isp-kill-sexp is somewhat of a dwim version of change-outer with a slight difference in where point has to be placed. C-u C-u M-x sp-kill-hybrid-sexp is a dwim version of change-inner. I use both packages for Auctex which is my primary emacs usage.
    – Vamsi
    Oct 10, 2014 at 23:21
  • 1
    If you are willing to write some custom elisp using smartparens I would say change-inner can be replaced. But change-inneris way more convenient and does not strain the working memory (only 2 functions/keybinds to remember) as much as smartparens equivalents would.
    – Vamsi
    Oct 10, 2014 at 23:24
  • Thanks! I played around a bit with the commands you mentioned and from what I can tell C-u C-u M-x sp-kill-sexp looks like a decent replacement for change-outer.
    – itsjeyd
    Oct 11, 2014 at 8:08
  • @Vamsi In what way is sp-kill-hybrid-sexp better than change inner? I'm wondering if I should switch. Nov 6, 2015 at 6:58

One basic difference is that smartparens can match escaped pairs and non-punctuation mark, like if and fi; you can also customize your pairs. smartparens is really great when working regex where there are lots of escaped pairs like \(...\), since it has its own highlighting for such pairs, making working with sed, awk... much more pleasant.

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.