emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 388545b 54/66: Add company-complete-common-or-cycle


From: Dmitry Gutov
Subject: [elpa] master 388545b 54/66: Add company-complete-common-or-cycle
Date: Tue, 13 Jan 2015 02:45:04 +0000

branch: master
commit 388545b74748447e710df3ff3899fcb1e4044c3b
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]