When I yank code into a smartparens-mode
buffer and encounter an issue where a closing parenthesis is missing, I can manually turn off smartparens-mode
, add the closing parenthesis, and then re-enable smartparens-mode
.
While this approach works, it’s a bit inconvenient. There is a simpler way to correct unbalanced parenthesis. According to this StackOverflow answer quote-insert
(bound by default to C-q) is unaffected by paredit-mode
(and also smartparens-mode
). Simply place your cursor at the point that you want to insert parenthesis, press C-q, then enter the missing closing parenthesis.