Disable spell checking in org mode

What happened?

First off: I’m new! But I’m LOVING Doom Emacs! Thanks to everyone involved. Here’s my issue:

#1 I want to disable spell checking in org mode but I keep getting the spelling popups.

Here’s what I put in config.el:

(setq company-backends (delete 'company-ispell company-backends))

(add-hook! 'org-mode-hook (setq-local flyspell-mode nil))

I don’t want any of the “intellisense” popups, since it auto-inserts wrong words when I type fast, it’s quite annoying but I can’t seem to get rid of it. image

#2 Followup/side question: What I would like though, is a way to enable Thesaurus/dictionary for the word I’m on. With some kind of command or leader key combination (no popups while typing).

Any help would be massively appreciated!

Hi! As far as I know, Doom Emacs sets company backends per-mode. Have a look at doomemacs/README.org at 042fe0c43831c8575abfdec4196ebd7305fa16ac · doomemacs/doomemacs · GitHub and SPC h f set-company-backend!.

I’m sorry, I don’t understand this stuff at all. I’m super new to Doom and to Emacs.

I just want to disable the spell checking, but obviously I do not want to disable all LSP intellisense. As far as I understand this is the “same thing” and something called company takes care of it?

  • I have no clue what packages are responsible for what
  • I don’t know when to “unload”, when to “unhook” and when to set which variable, and for what
  • Reading the documentation within Emacs really doesn’t help me at all. How do I know what to search for? For example: how do I know that I should search for ‘set-company-backend’ and not something with ‘ispell’ or ‘flycheck’ or the other stuff that’s included? How do I know to search for help-function rather than help-variable or help-packages? I’m super lost.

With everything I could find, I have all this in my config, and it still doesn’t work:

;; Disable spell check & autocomplete in org mode
(after! org
  (set-company-backend! 'org-mode nil))

(setq company-backends (delete 'company-ispell company-backends))

(set-company-backend! 'org-mode
  'company-ispell nil)

(add-hook! 'org-mode-hook
  (setq-local flyspell-mode nil))




Well, in the beginning it can feel a bit overwhelming. In a few weeks, you will be fine :-).

Company mode handles completions.

Flycheck mode does syntax checking on the fly (after typing, when you are idle).

What you want is probably Flyspell mode, which does spell checking on the fly (after typing, when you are idle).

I suggest reading about these modes, and about Emacs in general. For example,

  • SPC h f company-mode or http://company-mode.github.io/;
  • SPC h f flyspell-mode;
  • there is an awesome Emacs Lisp tutorial accessible via SPC h i /Emacs Lisp Intro.

I’ve gone through the motions of sucessfully disabling spellcheck multiple times, but at a certain point it keeps coming back! It’s like magic. And quite annoying, unfortunately.

Is it possible that it has something to do with something called “Buffer Local” Variables? And if so, where would they come from?

Any way to figure out which settings actually work, and which are placebo?

Update…

Currently I’ve got something semi-reproducable:

;; Disable spell check & autocomplete in org mode
;; (set-company-backend! 'org-mode nil) ; doesn't work
(use-package! company
  :config
  (setq +company-backend-alist (assq-delete-all 'text-mode +company-backend-alist))
  (add-to-list '+company-backend-alist '(text-mode (:separate company-dabbrev company-yasnippet))))

This usually works. I got the idea here

Now it seems that when my computer (macOS) comes out of sleep mode, the thing is reset. Some kind of local buffer variable overrides my config. I get the spelling popups.

When I hit doom reload (spc h r r) it reloads my config and the spelling intellisense disappears again as intended.

I do not understand what’s happening at all, been through tons of documentation and have reinstalled Emacs completely as well.

Hi!

I am still a bit confused. If you want to disable spellcheck, have a look at flyspell. Company mode is about code/text completions.

With respect to your problem with completions using company, I have dug around a bit. The completion backends are stored in +company-backend-alist, which is changed using set-company-backend, as you do. The backends are then set whenever the major mode is changed. The respective hook is initialized here:

  (add-hook 'after-change-major-mode-hook #'+company-init-backends-h 'append)

Not sure if this helps, but maybe we should clarify if you want to disable spellcheck or code completions first :slightly_smiling_face:.

Hi there, thanks a lot for your replies!

In the first post I made here, I added a little screenshot. There you can see that there’s some kind of popup which is auto-correcting my words at times.

I don’t know if it’s spell check or something else. It looks like it analyzes my buffer to suggest words, and I believe it’s company doing this.

Yesterday I was reading some more about doom configuration and it seems that the use-package! I was using is a common anti-pattern. I believe that this is why I had to reload my config before it works.

At the moment, I’ve got this in my config:

(setq company-global-modes '(not text-mode org-mode))

and it seems to do the trick! Hopefully I’ve got it solved for once and for all now :smiley:

2 Likes

Thank you for this! Not sure why this had to be so hard, it’s a very simple question. I don’t want to stop using company altogether, it’s great for helping me code, I just don’t want it telling me what words I should use when I’m writing in my own language :) I know better than you, computer!

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.