0

How do you disable flyspell-mode by default in spacemacs?

I don't see where it is enabled in the first place.

With customize-variable I can track down global-flycheck-mode, but they seem to be unrelated.

Every buffer I open underlines misspellings in red and if I SPC SPC flyspell-mode it reports "disabled" and they go away. This is my basis. I want them gone.

7
  • Check your init file: search for spell. You have probably added spell-checking as a layer. See spacemacs.org/layers/+checkers/spell-checking/README.html (Disclaimer: I know nothing about spacemacs).
    – NickD
    Jan 6 at 22:32
  • Yes, I should have mentioned that, I do have the spell-checking layer, because otherwise I didn't have bindings for doing on-demand spell checks. I guess something about that layer activates flyspell-mode for all buffers, but I can't find which variable it's editing and how to overwrite it. That is the only relevant hit when searching for spell. The other hits are just flyspell packages. Jan 7 at 16:42
  • Isn't each layer implemented through a config file? Have you looked at that config file?
    – NickD
    Jan 7 at 17:25
  • 1
    Okay! In emacs.d/layers/+checkers/spell-checking/config.el the first line sets spell-checking-enable-by-default. I changed that and it worked! Odd that I can't access that variable through customize-variable. Jan 7 at 21:14
  • 1
    No, I just threw out a couple of random suggestions. I'm glad they were helpful, but that does not an answer make. However, you should provide the answer!
    – NickD
    Jan 7 at 22:51

1 Answer 1

1

In emacs.d/layers/+checkers/spell-checking/config.el the first line sets spell-checking-enable-by-default to t. At first I set this to nil, but I don't think setting it here is the most spacematic way of going about it.

What I did instead is add

;; disable flyspell-mode
(setq-default spell-checking-enable-by-default nil)

to the dotspacemacs/user-init function in .spacemacs.


I first tried to add it to dotspacemacs/user-config, but it did not take effect. The fact that it works in user-init is not intuitive to me: since user-init is loaded "before layer configuration", I would think that spell-checking-enable-by-default is set to nil by user-init, then set back to t when config.el is run. It's also confusing because config.el calls defvar, which I understand to mean the variable spell-checking-enable-by-default is created and set in that config.el. If that's true, how can I set it before it's created, in user-init. If anyone can explain this in a comment that'd be great!

Any confirmation that this is the best practice is appreciated.

2
  • 1
    You can set this via the :variables keyword in dotspacemacs-configuration-layers as described in the spell-check layer its documentation. The :variables: can generally be used to set variables for configuring layers (and not only for layer specific variables). Jan 12 at 8:05
  • 1
    As a 'side' comment, you can quickly jump to a layer's configuration file using SPC h SPC. Jan 12 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.