I wrote a backend for COMPANY.
;;----------------COMPANY BACKEND----------------------------- (defvar oef-mode-completions '() "The content of this variable is generated automatically for COMPANY completion." ) (setq oef-mode-completions (append oef-answers-options oef-definitions-commands oef-commands oef-definitions-special-commands oef-doc-commands oef-storage-types oef-menu-exo-init-types oef-menu-doc-init-types oef-defined-variables oef-comparison-operators oef-language-reserved-words oef-definitions-wims-functions oef-wims-functions oef-definitions-slib-scripts oef-slib-scripts oef-pari-functions oef-maths-functions oef-random-functions oef-canvasdraw-commands)) (defun company-oef-mode-backend (command &optional arg &rest ignored) (interactive (list 'interactive)) (case command (interactive (company-begin-backend 'company-oef-mode-backend)) (prefix (and (eq major-mode 'oef-mode) (company-grab-word)) ) (candidates (remove-if-not (lambda (c) (string-prefix-p arg c)) oef-mode-completions)) ;; (meta (format "This value is named %s" arg)) ) ) (add-to-list 'company-backends 'company-oef-mode-backend)
It's working but it doesn't give the control to the next backend.
If I look at the documentation
C-h v company-backends I read :
‘prefix’: The backend should return the text to be completed. It must be text immediately before point. Returning nil from this command passes control to the next backend.
Until now my code return the word or an empty string that's why the next backend is ignored.