[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 66ed6df 13/31: make numbers after candidates customizable
From: |
Dmitry Gutov |
Subject: |
[elpa] master 66ed6df 13/31: make numbers after candidates customizable |
Date: |
Sun, 14 Apr 2019 22:06:17 -0400 (EDT) |
branch: master
commit 66ed6df293ae4d98f385b19eff8ca15917c81ac9
Author: yqrashawn <address@hidden>
Commit: yqrashawn <address@hidden>
make numbers after candidates customizable
---
NEWS.md | 2 ++
company.el | 13 ++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/NEWS.md b/NEWS.md
index 8d252bc..aedac18 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
## Next
+* Add custom variable `company-show-numbers-function` to make numbers of
+ candidates customizable.
* When a symbol is already typed in full, calling `M-x company-complete` will
now run its post-completion action (e.g. inserting method parameters
template). Calling `M-x company-manual-begin` or invoking a backend command
diff --git a/company.el b/company.el
index 3c13b7b..6f8feb8 100644
--- a/company.el
+++ b/company.el
@@ -632,6 +632,14 @@ commands in the `company-' namespace, abort completion."
:type '(choice (const :tag "off" nil)
(const :tag "on" t)))
+(defcustom company-show-numbers-function #'company--show-numbers
+ "Function called to get custom quick-access numbers for the first then
candidates.
+
+If nil falls back to default function that generates 1...8, 9, 0. The function
get
+the number of candidates (from 1 to 10 means 1st to 10th candidate) and should
+return a string prefixed with one space."
+ :type 'function)
+
(defcustom company-selection-wrap-around nil
"If enabled, selecting item before first or after last wraps around."
:type '(choice (const :tag "off" nil)
@@ -2635,6 +2643,9 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
new
(company-safe-substring old (+ offset (length new)))))
+(defun company--show-numbers (numbered)
+ (format " %d" (mod numbered 10)))
+
(defsubst company--window-height ()
(if (fboundp 'window-screen-lines)
(floor (window-screen-lines))
@@ -2787,7 +2798,7 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(when (< numbered 10)
(cl-decf width 2)
(cl-incf numbered)
- (setq right (concat (format " %d" (mod numbered 10)) right)))
+ (setq right (concat (funcall company-show-numbers-function
numbered) right)))
(push (concat
(company-fill-propertize str annotation
width (equal i selection)
- [elpa] master e5408b5 07/31: Add a clarifying message, (continued)
- [elpa] master e5408b5 07/31: Add a clarifying message, Dmitry Gutov, 2019/04/14
- [elpa] master 8576100 08/31: Add a NEWS entry, Dmitry Gutov, 2019/04/14
- [elpa] master 5d3e689 03/31: Update the remaining callers of company-calculate-candidates, Dmitry Gutov, 2019/04/14
- [elpa] master f53327b 12/31: Merge pull request #858 from nikital/tng-fix-lookup-key, Dmitry Gutov, 2019/04/14
- [elpa] master 3873c4a 05/31: Remove outdated comment, Dmitry Gutov, 2019/04/14
- [elpa] master 04b8171 09/31: Fix a typo, Dmitry Gutov, 2019/04/14
- [elpa] master ebf1301 04/31: Merge branch 'master' into forced-completion-for-unique-match, Dmitry Gutov, 2019/04/14
- [elpa] master 3d4e87c 11/31: company: company--company-command-p: Fix lookup-key, Dmitry Gutov, 2019/04/14
- [elpa] master b696b39 10/31: Don't run company-completed-started-hook unnecessarily, Dmitry Gutov, 2019/04/14
- [elpa] master a7c689a 14/31: Merge pull request #859 from yqrashawn/customizable-numbers, Dmitry Gutov, 2019/04/14
- [elpa] master 66ed6df 13/31: make numbers after candidates customizable,
Dmitry Gutov <=
- [elpa] master 2b671ec 15/31: Move inhibit-redisplay higher, Dmitry Gutov, 2019/04/14
- [elpa] master 5bd5745 24/31: Merge pull request #883 from nikital/tng-document-no-post-completion, Dmitry Gutov, 2019/04/14
- [elpa] master 03fa690 27/31: Merge pull request #886 from cburn11/update-company-clang--completetion-pattern, Dmitry Gutov, 2019/04/14
- [elpa] master 23136d3 28/31: Update copyright years, Dmitry Gutov, 2019/04/14
- [elpa] master 87509b1 19/31: company-complete: Don't change last-command if completion exited, Dmitry Gutov, 2019/04/14
- [elpa] master edbb3c5 16/31: Merge branch 'master' of github.com:company-mode/company-mode, Dmitry Gutov, 2019/04/14
- [elpa] master ebc4fce 17/31: Make company-idle-delay support predicate function, Dmitry Gutov, 2019/04/14
- [elpa] master 20fe015 18/31: Merge pull request #874 from amosbird/master, Dmitry Gutov, 2019/04/14
- [elpa] master f965786 20/31: company-complete: Ensure last command was really the same, Dmitry Gutov, 2019/04/14
- [elpa] master 1974d83 21/31: Make tests resilient to arbitrary text properties in completions, Dmitry Gutov, 2019/04/14