4

Is it possible to add my personal custom list of words to the company database. Kindly guide me in a simple way. I am not a programmer.

Vaibhav
  • 573
  • 3
  • 15

3 Answers3

1

Can't give you an answer regarding Company, but I would assume that it provides that possibility.

Otherwise, the built-in, old but still very useful library completion.el offers that possibility. From the doc (which is only in the file's Commentary section):

;;  SAVING/LOADING COMPLETIONS
;;   Completions are automatically saved from one session to another
;; (unless save-completions-flag or enable-completion is nil).
;; Activating this minor-mode (calling completion-initialize) loads
;; a completions database for a saved completions file
;; (default: ~/.completions).  When you exit, Emacs saves a copy of the
;; completions that you often use.  When you next start, Emacs loads in
;; the saved completion file.
Drew
  • 75,699
  • 9
  • 109
  • 225
1

I suppose you use company's backend company-ispell to input plain words,

Insert below code into your ~/.emacs.d/init.el,

(defvar my-ispell-words
  '("helle1"
    "helle2"
    "word1"
    "word2"))

(defadvice ispell-lookup-words (after ispell-lookup-words-after-hack activate)
  (let* ((word (car (ad-get-args 0)))
         (my-words (all-completions word my-ispell-words) ))
    (when my-words
      (setq ad-return-value (nconc my-words ad-return-value)))))
chen bin
  • 4,781
  • 18
  • 36
1

Yes, it is possible. I use the following.

 (setq company-ispell-available t)
 (setq company-ispell-dictionary "/path/to/your/wordlist/file")
 (add-to-list 'company-backends 'company-ispell)

The other answers are valid alternatives, here we are passing a custom-populated file to company to help auto-complete.

Swarnendu Biswas
  • 1,378
  • 1
  • 11
  • 24