If I type character a
, can completion-at-point
be used to show possible matches from this list a ɑ æ ɐ ɑ̃
, even without matching a prefix?
(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)
(company-grab-symbol)))
(candidates
(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?
C-h v completion-styles
help? – Drew Dec 28 '19 at 2:46