[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 91fc865 07/78: Unread whole command instead of last input
From: |
Dmitry Gutov |
Subject: |
[elpa] master 91fc865 07/78: Unread whole command instead of last input |
Date: |
Sun, 18 Feb 2018 07:40:11 -0500 (EST) |
branch: master
commit 91fc865360d783d26fe5f486ef691ebd2d63f9dc
Author: Nikita Leshenko <address@hidden>
Commit: Nikita Leshenko <address@hidden>
Unread whole command instead of last input
The intent of `company--unread-last-input' was to push the current command
keys
back to `unread-command-events' in order to evaluate them again on the next
iteration of the Emacs command loop.
This function didn't work for multi-keys commands because `last-input-event'
contains the last terminal input event read and not the entire command
keys. For
example, for the command C-x C-e `last-input-event' would contain C-e.
Pushing
C-e back to `unread-command-events' would result a different command
invoked.
Use `(this-command-keys)' instead of `last-input-event' to push the entire
key
sequence that invoked this command.
Also rename the function to make it's intent clearer after this change.
---
company.el | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/company.el b/company.el
index 1cb02ab..9c9fb13 100644
--- a/company.el
+++ b/company.el
@@ -1840,7 +1840,7 @@ each one wraps a part of the input string."
(interactive)
(company--search-assert-enabled)
(company-search-mode 0)
- (company--unread-last-input))
+ (company--unread-this-command-keys))
(defun company-search-delete-char ()
(interactive)
@@ -1984,7 +1984,7 @@ With ARG, move by that many elements."
(if (> company-candidates-length 1)
(company-select-next arg)
(company-abort)
- (company--unread-last-input)))
+ (company--unread-this-command-keys)))
(defun company-select-previous-or-abort (&optional arg)
"Select the previous candidate if more than one, else abort
@@ -1995,7 +1995,7 @@ With ARG, move by that many elements."
(if (> company-candidates-length 1)
(company-select-previous arg)
(company-abort)
- (company--unread-last-input)))
+ (company--unread-this-command-keys)))
(defun company-next-page ()
"Select the candidate one page further."
@@ -2063,7 +2063,7 @@ With ARG, move by that many elements."
0)))
t)
(company-abort)
- (company--unread-last-input)
+ (company--unread-this-command-keys)
nil)))
(defun company-complete-mouse (event)
@@ -2240,10 +2240,12 @@ character, stripping the modifiers. That character
must be a digit."
(< (- (window-height) row 2) company-tooltip-limit)
(recenter (- (window-height) row 2))))))
-(defun company--unread-last-input ()
- (when last-input-event
- (clear-this-command-keys t)
- (setq unread-command-events (list last-input-event))))
+(defun company--unread-this-command-keys ()
+ (when (> (length (this-command-keys)) 0)
+ (setq unread-command-events (nconc
+ (listify-key-sequence (this-command-keys))
+ unread-command-events))
+ (clear-this-command-keys t)))
(defun company-show-doc-buffer ()
"Temporarily show the documentation buffer for the selection."
- [elpa] master updated (32f6323 -> e65aa3f), Dmitry Gutov, 2018/02/18
- [elpa] master c280e64 01/78: company-safe-substring: Honor the current buffer-invisibility-spec, Dmitry Gutov, 2018/02/18
- [elpa] master ff295e8 02/78: add golang keywords, Dmitry Gutov, 2018/02/18
- [elpa] master ab2937a 04/78: Fix the warnings, Dmitry Gutov, 2018/02/18
- [elpa] master aefac09 05/78: Force the prefix call to synchronous everywhere, Dmitry Gutov, 2018/02/18
- [elpa] master 191fc01 03/78: Merge pull request #694 from ycz0926/master, Dmitry Gutov, 2018/02/18
- [elpa] master 5df6abf 12/78: company-tng: Usage instructions, Dmitry Gutov, 2018/02/18
- [elpa] master ec1e879 10/78: company-tng: Don't highlight tooltip when unselected, Dmitry Gutov, 2018/02/18
- [elpa] master 91fc865 07/78: Unread whole command instead of last input,
Dmitry Gutov <=
- [elpa] master c0098af 06/78: Introduce company-tooltip-maximum-width, Dmitry Gutov, 2018/02/18
- [elpa] master fe20376 11/78: company-tng: Function to give sensible default configuration, Dmitry Gutov, 2018/02/18
- [elpa] master e27f0f4 13/78: NEWS: Entry for company-tng, Dmitry Gutov, 2018/02/18
- [elpa] master 0295c8f 20/78: And more, Dmitry Gutov, 2018/02/18
- [elpa] master b07eaf9 17/78: Move the entry up, Dmitry Gutov, 2018/02/18
- [elpa] master 74d85d1 09/78: company-tng: Advice company-select-next to allow unselected state, Dmitry Gutov, 2018/02/18
- [elpa] master 4240367 08/78: company-tng: Implement visualisation and completion, Dmitry Gutov, 2018/02/18
- [elpa] master 1a9f0b8 14/78: company-tng: Kill local overlay variable after completion is done, Dmitry Gutov, 2018/02/18
- [elpa] master a528433 21/78: Fix the link text, Dmitry Gutov, 2018/02/18
- [elpa] master 66a9e65 15/78: company-tng: Use 'after-string when the prefix is empty, Dmitry Gutov, 2018/02/18