1

Is there a way to keep auto-completion enabled as a layer, but have it disabled by default in spacemacs?

For example, I want to have the auto-completion layer enabled in dotspacemacs-configuration-layers, but I want auto-completion to start disabled whenever I open up a new buffer.

Currently, whenever I open a buffer, I need to press SPC t a (which calls spacemacs/toggle-auto-completion) to disable auto-completion. I'd like this to be the other way around. I'd like for auto-completion to be disabled by default. I'd like to be able to press SPC t a to enable auto-completion.

I'm a beginner with emacs/spacemacs, so I'm not sure how I would express this, but one thought would be to call spacemacs/toggle-auto-completion-off whenever I open a new buffer. How would you write this in elisp?

1
+50

You could add spacemacs/toggle-auto-completion-off to the buffer-list-update-hook by adding

(add-hook 'buffer-list-update-hook 'spacemacs/toggle-auto-completion-off)

to your .spacemacs-file (in the dotspacemacs/user-config-section). This toggles auto completion off every time the buffer list updates, which happens when you open or close a file or buffer.

  • Thanks, this works well. I ended up going with something like this: (add-hook 'buffer-list-update-hook (lambda () (if (eq 'company auto-completion-front-end) (company-mode -1)))) – illabout Aug 23 '17 at 18:03

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.