7

As the question suggest, I am trying to set up the auto-complete package for writing papers. I have also installed ac-ispell. So far it seems more or less useless, mostly because it is way too slow. Suggestions take several full seconds to appear.

Here are the relevant lines that I currently have in my init, which are based directly on the recommendations in the documentation for these two packages:

(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-modes '(org-mode text-mode LaTeX-mode))

(custom-set-variables
 '(ac-ispell-requires 4)
 '(ac-ispell-fuzzy-limit 2))

(eval-after-load "auto-complete"
  '(progn
     (ac-ispell-setup)))

(add-hook 'git-commit-mode-hook 'ac-ispell-ac-setup)
(add-hook 'mail-mode-hook 'ac-ispell-ac-setup)
(add-hook 'org-mode-hook 'ac-ispell-ac-setup)
(add-hook 'text-mode-hook 'ac-ispell-ac-setup)
(add-hook 'LaTeX-mode-hook 'ac-ispell-ac-setup)

(global-auto-complete-mode t)

In case this helps, the resulting value for ac-sources is (ac-source-ispell ac-source-ispell-fuzzy ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers).

If you've had better luck with this then I have, please help!

  • I've now opened an issue for company-mode with a very lengthy and detailed version of this question. If I get a good resolution, I will post it as an answer here. – Brian Z Nov 28 '15 at 9:01
2

Predictive-mode claims to be what you're looking for, though I'm not sure how it compares to more modern completion frameworks like company-mode.

  • 1
    I haven't tried them yet, but these look like promising options, thanks! – Brian Z Nov 23 '15 at 12:39
2

suppose you use company-mode and you only want to use it in text-mode. org-mode inherits from text-mode, so you don't need setup for both:

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)

(defun text-mode-hook-setup ()
  ;; make `company-backends' local is critcal
  ;; or else, you will have completion in every major mode, that's very annoying!
  (make-local-variable 'company-backends)

  ;; company-ispell is the plugin to complete words
  (add-to-list 'company-backends 'company-ispell)

  ;; OPTIONAL, if `company-ispell-dictionary' is nil, `ispell-complete-word-dict' is used
  ;;  but I prefer hard code the dictionary path. That's more portable.
  (setq company-ispell-dictionary (file-truename "~/.emacs.d/misc/english-words.txt")))

(add-hook 'text-mode-hook 'text-mode-hook-setup)

"english-words.txt" is just a plain text file where lines sorted alphabetically. Every line is a word. (Plain text dictionary is required by ispell, see https://emacs.stackexchange.com/a/42526/ for technical details).

Here is a sample file: https://github.com/redguardtoo/emacs.d/raw/master/misc/english-words.txt

Tested with Emacs24.3, 24.4, company-mode 0.8.12

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.