[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 08/14: company-complete-number: Make interactive, read the presse
From: |
Dmitry Gutov |
Subject: |
[elpa] 08/14: company-complete-number: Make interactive, read the pressed digit |
Date: |
Sat, 13 Sep 2014 12:19:01 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 500dbaeff25fb5f5db88e86d5c9c29adc2357d2e
Author: Frank Fischer <address@hidden>
Date: Tue Sep 9 04:22:46 2014 +0400
company-complete-number: Make interactive, read the pressed digit
Fixes #177.
---
company.el | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/company.el b/company.el
index f9f4b74..505cc82 100644
--- a/company.el
+++ b/company.el
@@ -627,12 +627,8 @@ asynchronous call into synchronous.")
(define-key keymap "\C-s" 'company-search-candidates)
(define-key keymap "\C-\M-s" 'company-filter-candidates)
(dotimes (i 10)
- (define-key keymap (vector (+ (aref (kbd "M-0") 0) i))
- `(lambda ()
- (interactive)
- (company-complete-number ,(if (zerop i) 10 i)))))
-
- keymap)
+ (define-key keymap (kbd (format "M-%d" i)) 'company-complete-number))
+ keymap)
"Keymap that is enabled during an active completion.")
(defvar company--disabled-backends nil)
@@ -1857,7 +1853,11 @@ inserted."
(defun company-complete-number (n)
"Insert the Nth candidate.
To show the number next to the candidates in some back-ends, enable
-`company-show-numbers'."
+`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)))
+ (if (zerop n) 10 n))))
(when (company-manual-begin)
(and (or (< n 1) (> n company-candidates-length))
(error "No candidate number %d" n))
- [elpa] branch master updated (2ee393e -> 3c14efe), Dmitry Gutov, 2014/09/13
- [elpa] 04/14: Add test for the previous commit, Dmitry Gutov, 2014/09/13
- [elpa] 07/14: Use posn-actual-col-row to calculate the row, Dmitry Gutov, 2014/09/13
- [elpa] 08/14: company-complete-number: Make interactive, read the pressed digit,
Dmitry Gutov <=
- [elpa] 09/14: company-gtags-modes: Turn into defcustom, Dmitry Gutov, 2014/09/13
- [elpa] 10/14: company-with-candidate-inserted: restore buffer modification status, Dmitry Gutov, 2014/09/13
- [elpa] 06/14: Don't use end-of-buffer-workaround, Dmitry Gutov, 2014/09/13
- [elpa] 13/14: Release 0.8.4, Dmitry Gutov, 2014/09/13
- [elpa] 01/14: company-begin-commands: include some cc-mode commands, Dmitry Gutov, 2014/09/13
- [elpa] 12/14: company--posn-col-row: add comment, Dmitry Gutov, 2014/09/13
- [elpa] 05/14: Adjust for debbugs:18384 being fixed now, Dmitry Gutov, 2014/09/13
- [elpa] 11/14: Only use company-ropemacs when ropemacs-mode is on, Dmitry Gutov, 2014/09/13
- [elpa] 14/14: Merge commit '2ef6263c65a109b4d36503e6484fdbf4cb307d0f' from company, Dmitry Gutov, 2014/09/13
- [elpa] 03/14: company--posn-col-row: incf instead of decf for non-nil h-l-f, Dmitry Gutov, 2014/09/13