branch: externals/company
commit 97cfbc3967c195fb4ccb171735b9b1dea97e681a
Merge: dd92593 bea3195
Author: Dmitry Gutov <dgu...@yandex.ru>
Commit: GitHub <nore...@github.com>

    Merge pull request #1033 from edwargix/master
    
    Implement `company-select-first' and `company-select-last'
---
 NEWS.md    |  1 +
 company.el | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/NEWS.md b/NEWS.md
index e89cd59..b91d56a 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
 
 ## Next
 
+* New commands `company-select-first` and `company-select-last`.
 * `company-tng-mode` has been added to replace both
   `company-tng-configure-default` and the manual method of enabling
   `company-tng-frontend` (see also `company-tng-auto-configure`). Also,
diff --git a/company.el b/company.el
index 57cf960..1bffc7a 100644
--- a/company.el
+++ b/company.el
@@ -2098,6 +2098,16 @@ With ARG, move by that many elements."
     (company-abort)
     (company--unread-this-command-keys)))
 
+(defun company-select-first ()
+  "Select the first completion candidate."
+  (interactive)
+  (company-set-selection 0))
+
+(defun company-select-last ()
+  "Select the last completion candidate."
+  (interactive)
+  (company-set-selection (1- company-candidates-length)))
+
 (defun company-next-page ()
   "Select the candidate one page further."
   (interactive)

Reply via email to