From 388545b74748447e710df3ff3899fcb1e4044c3b Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 9 Jan 2015 15:51:51 +0300 Subject: [PATCH] Add company-complete-common-or-cycle --- NEWS.md | 2 ++ company.el | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/NEWS.md b/NEWS.md index b615f481e..9d3c1037b 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 217f37bb3..a92f83731 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 -- 2.39.2