]> code.delx.au - gnu-emacs-elpa/commitdiff
company-complete-number: Handle keypad events
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 8 Nov 2014 21:12:25 +0000 (23:12 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 8 Nov 2014 21:12:25 +0000 (23:12 +0200)
NEWS.md
company.el

diff --git a/NEWS.md b/NEWS.md
index 208ff1f32985d3e07242081cfcfa70fd8ddbe17f..a527c04564b0f8b0f8f2783375ee2316ba3fc340 100644 (file)
--- 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.
 
index cf88ddd30d0bf817e2adf3ef00f5f189c0eec14c..3258f169485a4f30ffca5b4e75b5d8780b0994ce 100644 (file)
@@ -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))