1

I use company when coding. I currently have it set to global. I would like to turn it off for a few major modes.

However, instead of turning it off globally, I only want to deactivate company for 2 or 3 modes.

I know I can use (add-hook 'mode 'somthing)

but, what do I need to put as the second argument to add-hook to turn off company?

Drew
  • 77,472
  • 10
  • 114
  • 243
Vinn
  • 293
  • 2
  • 8
  • Actually, there are several such duplicate questions. It seems this is the oldest one, and the others should be closed as dups of this one: https://emacs.stackexchange.com/a/62777/105 – Drew Dec 02 '22 at 16:59
  • This one is older - it should probably be the one to keep: https://emacs.stackexchange.com/q/50339. – Drew Dec 02 '22 at 17:16

1 Answers1

2

From the documentation of company-mode (C-h f company-mode)

This is a minor mode. If called interactively, toggle the ‘Company mode’ mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

So, we use a hook

  ;; enable company in all prog-mode based modes
  (add-hook 'prog-mode-hook 'company-mode)
  ;; disable company in python-mode
  (add-hook 'python-mode-hook (lambda() (company-mode 0)))
nega
  • 3,221
  • 15
  • 21