If I type character a, can completion-at-point be used to show possible matches from this list a ɑ æ ɐ ɑ̃, even without matching a prefix?

  • Does C-h v completion-styles help?
    – Drew
    Dec 28, 2019 at 2:46
  • @phoxd: The answer is "yes". I suspect you want something else, so please make your question more precise.
    – Stefan
    Dec 28, 2019 at 23:20

1 Answer 1


(defconst sample-completions
  '(("a" "a" "ɑ" "æ" "ɐ" "ɑ̃") ("f" "o" "r")))

(defun company-sample-backend (command &optional arg &rest ignored)
  (interactive (list 'interactive))
  (case command
    (interactive (company-begin-backend 'company-sample-backend))
    (prefix (and (eq major-mode 'fundamental-mode)

      (dolist (element sample-completions)
        (let ((head (car element)))
          (message "%s -%s" head arg)
           (if (string= head arg)   
               (return element))))

(add-to-list 'company-backends 'company-sample-backend)

Tweaked from here

Enable M-x company-mode and M-x fundamental-mode, type a or f (the first element of list) and execute company-complete to get completion menu.

How would I enable it only inside quotations?

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.