complete with junk
Closed this issue · 4 comments
using emacs -Q, I seem to detect a bug of helm-company.
(defun helm-company ()
"Select `company-complete' candidates by `helm'.
It is useful to narrow candidates."
(interactive)
(unless company-candidates
(company-complete))
(when company-point
(let ((begin (- company-point (length company-prefix))))
(with-helm-show-completion begin company--point-max
(helm :sources 'helm-source-company
:buffer "*helm company*"
:candidate-number-limit helm-company-candidate-number-limit)))))
suppose you use C-: to complete "(poi" and (company-complete)
is called. After (company-complete)
the buffer will become "(point" because it is the sole prefix. Finally if "point-max" is chosen, the buffer becomes "(popoint-max". It seems that however many company-complete
completes, the same amount of junk will leave ahead.
Temporarily I managed to fix this by replacing the unless
with
(unless company-candidates
(company--begin-new)
(setq company-point (point)
company--point-max (point-max)))
Can you reproduce this problem or figure out why that happens?
Temporarily it should be fixed by the following code (my previous code still has bugs)
(unless company-candidates
(company-manual-begin)
(setq company-point (point)
company--point-max (point-max)))
@scinart Sorry for the delay in replying. Trying to reproduce this issue, I cannot reproduce it.
I'm glad that your issue is solved. :-)