7
votes

I've installed auto-complete-mode, and I'm using org-mode. When I hit TAB to auto-complete words, it instead tries to indent the line. Sometimes it indents the whole paragraph, sometimes it does nothing.

I tried customizing the variable (setq tab-always-indent 'complete) and changing it to nil, but now when I hit TAB, it just inserts tab spaces across the screen.

I know it's possible to successfully use org-mode with yasnippet and auto-complete both working correctly, because with Emacs Live it works out of the box.

3
Did you try this: (ac-flyspell-workaround) - pippo

3 Answers

10
votes

Auto-complete uses the variable ac-modes to decide whether to enable auto-completion in a particular mode, by default org-mode is not present in this list. So to enable auto-completion in org-mode simply add it to the ac-modes something like this should work

(add-to-list 'ac-modes 'org-mode)

Also to complete using tab you will need to set ac-trigger-key to tab like so (link to the manual)

(ac-set-trigger-key "TAB")
1
votes

For me the solution was to install org-ac from melpa-stable. This caused Emacs to show the completed word after the cursor, as if I had already typed it, but in a different color. Using Tab accepts that completion.

(Emacs: GNU Emacs 24.5.1)

0
votes

The only robust solution I found was to disable flyspell mode M-xflyspell-mode when I want to use auto-completion in org-mode: Emacs 26.1, GTK+ 3.22.30, Org mode version 9.1.14, Spacemacs 0.200.13. The suggestion (add-to-list 'ac-modes 'org-mode) did not work and I was unable to find ac-flyspell-workaround. Because completion in org-mode is more valuable to me than is flyspell mode, I turn off flyspell much of the time.