[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5e107fd 015/173: Accept numeric argument in company-select
From: |
Dmitry Gutov |
Subject: |
[elpa] master 5e107fd 015/173: Accept numeric argument in company-select-next and friends |
Date: |
Thu, 23 Jun 2016 00:28:34 +0000 (UTC) |
branch: master
commit 5e107fd39629c82ef5c29b549852c2fbda578aaa
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Accept numeric argument in company-select-next and friends
Closes #316
---
NEWS.md | 3 +++
company.el | 52 +++++++++++++++++++++++++++++++---------------------
2 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index d4b767d..2f06759 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,9 @@
## Next
+* `company-select-next`, `company-select-previous`,
+ `company-select-next-or-abort`, `company-select-previous-or-abort` and
+ `company-complete-common-or-cycle` accept a numeric argument.
* The documentation buffer window can be scrolled with the mouse wheel.
* New command `company-diag`. Use it in bug reports.
diff --git a/company.el b/company.el
index 28e2cde..93f1dad 100644
--- a/company.el
+++ b/company.el
@@ -1805,33 +1805,40 @@ followed by `company-search-toggle-filtering'."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defun company-select-next ()
- "Select the next candidate in the list."
- (interactive)
- (when (company-manual-begin)
- (company-set-selection (1+ company-selection))))
+(defun company-select-next (&optional arg)
+ "Select the next candidate in the list.
-(defun company-select-previous ()
- "Select the previous candidate in the list."
- (interactive)
+With ARG, move by that many elements."
+ (interactive "p")
(when (company-manual-begin)
- (company-set-selection (1- company-selection))))
+ (company-set-selection (+ (or arg 1) company-selection))))
-(defun company-select-next-or-abort ()
+(defun company-select-previous (&optional arg)
+ "Select the previous candidate in the list.
+
+With ARG, move by that many elements."
+ (interactive "p")
+ (company-select-next (if arg (- arg) -1)))
+
+(defun company-select-next-or-abort (&optional arg)
"Select the next candidate if more than one, else abort
-and invoke the normal binding."
- (interactive)
+and invoke the normal binding.
+
+With ARG, move by that many elements."
+ (interactive "p")
(if (> company-candidates-length 1)
- (company-select-next)
+ (company-select-next arg)
(company-abort)
(company--unread-last-input)))
-(defun company-select-previous-or-abort ()
+(defun company-select-previous-or-abort (&optional arg)
"Select the previous candidate if more than one, else abort
-and invoke the normal binding."
- (interactive)
+and invoke the normal binding.
+
+With ARG, move by that many elements."
+ (interactive "p")
(if (> company-candidates-length 1)
- (company-select-previous)
+ (company-select-previous arg)
(company-abort)
(company--unread-last-input)))
@@ -1919,14 +1926,17 @@ 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)
+(defun company-complete-common-or-cycle (&optional arg)
+ "Insert the common part of all candidates, or select the next one.
+
+With ARG, move by that many elements."
+ (interactive "p")
(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))
+ (let ((company-selection-wrap-around t)
+ (current-prefix-arg arg))
(call-interactively 'company-select-next))))))
(defun company-complete ()
- [elpa] master updated (24149b0 -> 7a2deff), Dmitry Gutov, 2016/06/22
- [elpa] master 448bcd8 007/173: company-show-doc-buffer: Bind other-window-scroll-buffer, Dmitry Gutov, 2016/06/22
- [elpa] master dae79c4 002/173: Merge branch 'search-hl-fix', Dmitry Gutov, 2016/06/22
- [elpa] master 12f55f5 013/173: Buf was unused, Dmitry Gutov, 2016/06/22
- [elpa] master e94f2ec 008/173: company-show-doc-buffer: Still call doc-buffer inside the electric block, Dmitry Gutov, 2016/06/22
- [elpa] master 125a4da 009/173: company-show-location: Mirror the latest change to company-show-doc-buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 7941f6e 010/173: company-diag: Include Emacs and Company versions, Dmitry Gutov, 2016/06/22
- [elpa] master 5733f2b 011/173: company-diag: Fix the annotation call, Dmitry Gutov, 2016/06/22
- [elpa] master af962d4 012/173: company-diag: Call `annotation' in the right buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 5e107fd 015/173: Accept numeric argument in company-select-next and friends,
Dmitry Gutov <=
- [elpa] master 479c676 021/173: Don't use `forward-symbol', apparently it's not in 24.3, Dmitry Gutov, 2016/06/22
- [elpa] master 41f4536 018/173: Add missing require to `company-gtags`, Dmitry Gutov, 2016/06/22
- [elpa] master b0f206a 020/173: Handle function pointers in annotation and template expansion, Dmitry Gutov, 2016/06/22
- [elpa] master d56ddaa 006/173: Allow scrolling the doc window with the mouse wheel, Dmitry Gutov, 2016/06/22
- [elpa] master a7a4ba6 014/173: Merge branch 'release', Dmitry Gutov, 2016/06/22
- [elpa] master 464a458 022/173: company-lighter: dispatch on whether company-candidates is non-nil, Dmitry Gutov, 2016/06/22
- [elpa] master b94b115 025/173: company--insert-candidate: Don't insert an empty string, Dmitry Gutov, 2016/06/22
- [elpa] master decd537 030/173: Add MELPA badge, Dmitry Gutov, 2016/06/22
- [elpa] master 22ecb92 001/173: company-clang--start-process: Disable undo in the output buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 5fe84a2 028/173: Merge pull request #334 from vermiculus/patch-1, Dmitry Gutov, 2016/06/22