I want to enable and disable company-mode
. Would I have to reset setup variables, everytime I want to enable company-mode
? Should I call company-setup
before calling company-enable
. Is the placement of (add-hook 'after-init-hook 'global-company-mode)
correct as part of setup?
(defun company-setup ()
"Text completion-at-point drop-down framework displaying
possible candidates at cursor point as one types."
(interactive)
(setq company-minimum-prefix-length 2)
(setq company-backends '(company-dabbrev company-dabbrev-code))
(setq company-dabbrev-other-buffers 'all)
(setq company-dabbrev-ignore-case 'keep-prefix)
(setq company-dabbrev-code-other-buffers 'all)
(setq company-dabbrev-code-ignore-case t)
(setq company-dabbrev-code-everywhere t)
(add-hook 'after-init-hook 'global-company-mode))
(defun company-enable ()
"Disables company completion"
(interactive)
(company-mode 1))
company-setup
is enablingcompany-mode
globally, unlikecompany-enable
, ignoring the other customizations. They have different implications. What do you want to do? If your goal is to call the functions interactively, then you can avoid the hook and directly call(global-company-mode 1)
.dabbrev
settings. What doescompany-mode
do that conflicts withglobal-company-mode
?