4

I find smartparens awkward. It's easier for me to type the matching paren/quote than to arrow over or C-f over. I want to turn off smartparens everywhere. I'm using prelude though and I can see that prelude turns on smartparens for a variety of the language specific packages that it uses.

Is there a way to globally turn off smartparens? I'm assuming that it goes somewhere in my personal/ directory in one of my custom init files.

2
  • Not an answer, but smart parens is supposed to be "smart", in particular, typing the matching closing paren should usually skip over it as if you had used C-f.
    – T. Verron
    Commented Nov 21, 2014 at 13:32
  • I don't use it, but I'm guessing from the smartparens installation page that you can put something like (smartparens-global-mode -1) in your init file (if -1 doesn't work, try 0 and nil). Also, it looks like you can turn it off on a buffer-by-buffer basis with (turn-off-smartparens-mode).
    – Dan
    Commented Nov 21, 2014 at 13:36

3 Answers 3

4

I don't see an option in prelude to disable smartparens globally -- looks like it is enabled in a prog-mode-hook and a few other places.

You could advise smartparens-mode (and perhaps smartparens-strict-modeas well) to prevent them from enabling the mode. Assuming you are on Emacs 24.4, try this:

(advice-add #'smartparens-mode :before-until (lambda (&rest args) t))

This effectively makes smartparens-mode return t and do nothing.

1

This worked for me:

M-x customize-group RET smartparens RET

Then use the Easy Customization interface to toggle Smartparens Global Mode to "off" (nil), then choose to apply and save your changes. (The setting started in the "off" state for me, but smartparens was active anyway. I had to toggle it "on" and back "off" to disable it successfully.)

EDIT: I take it back; it worked temporarily. Smartparens is activated again upon starting a new session. Maybe this is an issue with Prelude?

0

What worked for me:

(defun disable-smartparens ()
  (smartparens-mode -1))

(add-hook 'smartparens-enabled-hook 'disable-smartparens t)

It appears that the smartparens-enabled-hook is called when smartparens is enabled. So, essentially, whenever smartparens turns on, we immediately turn it off.

If you just want to rebind some of the keys within there, you can change the function to:

(defun rebind-keys ()
  (global-set-key example 'command))

And customize as appropriate from https://www.gnu.org/software/emacs/manual/html_node/emacs/Rebinding.html

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.