branch: master commit 43756857c8d9e713a2f978b052ba2cf7521ab08a Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
company-complete-number: Handle keypad events --- NEWS.md | 2 ++ company.el | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/NEWS.md b/NEWS.md index 208ff1f..a527c04 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ ## Next +* `company-complete-number` can be bound to keypad numbers directly, with or + without modifiers. * `company-cmake` supports expansion of `<LANG>` and `<CONFIG>` placeholders inside of variable names. diff --git a/company.el b/company.el index cf88ddd..3258f16 100644 --- a/company.el +++ b/company.el @@ -1862,7 +1862,13 @@ To show the number next to the candidates in some back-ends, enable `company-show-numbers'. When called interactively, uses the last typed character, stripping the modifiers. That character must be a digit." (interactive - (list (let ((n (- (event-basic-type last-command-event) ?0))) + (list (let* ((type (event-basic-type last-command-event)) + (char (if (characterp type) + ;; Number on the main row. + type + ;; Keypad number, if bound directly. + (car (last (string-to-list (symbol-name type)))))) + (n (- char ?0))) (if (zerop n) 10 n)))) (when (company-manual-begin) (and (or (< n 1) (> n company-candidates-length))