branch: master commit 388545b74748447e710df3ff3899fcb1e4044c3b Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
Add company-complete-common-or-cycle --- NEWS.md | 2 ++ company.el | 10 ++++++++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/NEWS.md b/NEWS.md index b615f48..9d3c103 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ ## Next +* New command `company-complete-common-or-cycle`. No default binding, so one + would have to set it up to use it. * `company-search-toggle-filtering` replaced `company-search-kill-others`. * Quitting the search mode resets the filtering. * Pressing `backspace` in the search mode deletes the character at the end of diff --git a/company.el b/company.el index 217f37b..a92f837 100644 --- a/company.el +++ b/company.el @@ -1870,6 +1870,16 @@ and invoke the normal binding." (when company-common (company--insert-candidate company-common))))) +(defun company-complete-common-or-cycle () + "Insert the common part of all candidates, or select the next one." + (interactive) + (when (company-manual-begin) + (let ((tick (buffer-chars-modified-tick))) + (call-interactively 'company-complete-common) + (when (eq tick (buffer-chars-modified-tick)) + (let ((company-selection-wrap-around t)) + (call-interactively 'company-select-next)))))) + (defun company-complete () "Insert the common part of all candidates or the current selection. The first time this is called, the common part is inserted, the second