From 0009c7bebfaca362945ce968d3e2fba74ce29d03 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 25 Aug 2018 15:16:28 +0200 Subject: [PATCH] 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. --- modules/completion/company/autoload.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/completion/company/autoload.el b/modules/completion/company/autoload.el index eacaab324..4252aefe0 100644 --- a/modules/completion/company/autoload.el +++ b/modules/completion/company/autoload.el @@ -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)))