Doom-emacs: Add an easy way to disable smartparens

Created on 22 Jul 2020  Â·  5Comments  Â·  Source: hlissner/doom-emacs

Currently there doesn't seem be a way to disable smartparens globally.

Including this in config.el:

(after! smartparens
  (smartparens-global-mode -1))

Seems to have no real effect (opening new files starts with smartparens mode still).
Also taking the suggestion of one of the users from Discord doesn't work:

(add-hook 'doom-first-buffer-hook
          (cmd!! smartparens-global-mode nil))

or even:

(add-hook 'doom-first-buffer-hook
          (lambda() (smartparens-global-mode nil)))

It would have been nice if there was a well documented way of disabling smartparens globally. It's not for everyone...

Thanks in advance!

question resolved

Most helpful comment

I think what you search is :

(remove-hook 'doom-first-buffer-hook #'smartparens-global-mode)

Also instead of using macros or lambdas, you can use the turn-off-smartparens-mode command

(after! org (add-hook 'org-mode-hook #'turn-off-smartparens-mode))

All 5 comments

I think what you search is :

(remove-hook 'doom-first-buffer-hook #'smartparens-global-mode)

Also instead of using macros or lambdas, you can use the turn-off-smartparens-mode command

(after! org (add-hook 'org-mode-hook #'turn-off-smartparens-mode))

@skaven-gear indeed this solves it! Is there a place in the docs this is described in some way?

No. I looked with ripgred into the doom repository and looked into the functions with describe-function for finding this solution.

But this make me thing there is a documentation about disabling a module in Doom :
Just delete the +smartparens flag from your init.el file under the :config key.
It is cleaner to do so.

@skaven-gear that's the point - I don't have +smaratparens anywhere in my init.el...

Just delete the +smartparens flag from your init.el file under the :config key.
It is cleaner to do so.

This is incorrect and will not do what you want.

The :config default module has a +smartparens flag which controls the _default configuration_ of smartparens. It does not control how or whether or not smartparens-mode is activated.

Was this page helpful?
0 / 5 - 0 ratings