Append space on C-SPC if not at end-of-symbol

Completion rarely works in the middle of (or at the beginning of) a
symbol, so we insert a space in front of the cursor in those cases and
then invoke completion.
This commit is contained in:
Henrik Lissner 2018-08-25 15:16:28 +02:00
parent 7510f5abf0
commit 0009c7bebf
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -103,6 +103,9 @@ To have BACKENDS apply to any mode that is a parent of MODES, set MODES to
"Bring up the completion popup. If only one result, complete it."
(interactive)
(require 'company)
(when (/= (point)
(cdr (bounds-of-thing-at-point 'symbol)))
(save-excursion (insert " ")))
(when (and (company-manual-begin)
(= company-candidates-length 1))
(company-complete-common)))