0

I use the following snippet to set up company-mode for text files and derived modes. I use a curated word list as the source for company-ispell.

(progn
  (defun sb/company-text-mode ()
    "Add backends for text completion in company mode."
    (setq-local company-minimum-prefix-length 2)
    (set (make-local-variable 'company-backends)
         '(company-files
           ;; FIXME: Delete duplicates
           ;; Give priority to dabbrev completions over ispell
           (:separate
            company-dabbrev
            company-ispell)
           )))

  (dolist (hook '(text-mode-hook)) ; Extends to derived modes like `markdown-mode' and `org-mode'
    (add-hook hook #'sb/company-text-mode)))

How can I avoid duplicates from appearing in company popups in cases where company-dabbrev returns a value? Thanks.

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

1 Answers1

1

You may try out setting company-transformers to delete-dups, as was suggested in one of the Company threads:

(setq-local company-transformers '(delete-dups)
            company-backends '(company-files (:separate company-dabbrev company-ispell)))

It'd be interesting to know if you get any performance implications in case of large ispell backend candidates list.

Y. E.
  • 668
  • 4
  • 8