Autocomplete and company completes the word . But is there any package which helps predict the next word expected in the sentence.
You can use
company-ngram for this.
Do mind that you'll need to
(setq-local company-auto-complete t) and
(setq-local company-auto-complete-chars '(? )) to trigger completion after (inserting) a space, not only in the middle of a word and specially after a whitespace.
NOTE: the image is from the repo and is actually licensed under GPLv3.
EDIT: sample code to get it working with
(with-eval-after-load 'company-ngram ;; ~/data/ngram/*.txt are used as data (setq company-ngram-data-dir "~/data/ngram") ;; company-ngram supports python 3 or newer (setq company-ngram-python "pypy3") (company-ngram-init) ;; or use `M-x turn-on-company-ngram' and ;; `M-x turn-off-company-ngram' on individual buffers ;; ;; save the cache of candidates (run-with-idle-timer 7200 t (lambda () (company-ngram-command "save_cache") )) ) (require 'company-ngram nil t) ;; to make it work with markdown-mode (require 'markdown-mode) (add-hook 'markdown-mode-hook 'company-mode) (add-hook 'markdown-mode-hook (lambda () (add-to-list 'company-backends 'company-ngram-backend) (setq-local company-auto-complete t) (setq-local company-auto-complete-chars '(? ))))
dabbrev solves this and is part of the standard Emacs distribution. Suppose that you have already typed "lower abdominal pain" either in the file you are editing or else in an open buffer. If you now type "lower " and then press
"M-/", Emacs will insert "abdominal", if you now add a space and press
"M-/" again it will insert "pain". If you find that Emacs inserts a thing you do not want (for example you may have typed "lower the boom" and Emacs finds this first so inserts "the"), you simply press
"M-/" again and it replaces the thing you do not want by the next possibility it finds.
It is possible to set up dabbrev so that it looks in files that are not open but at this moment I do not remember how this goes; it is just a question of looking this up in the info file for Emacs.