[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 2cca48a 6/6: Merge pull request #1098 from comp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 2cca48a 6/6: Merge pull request #1098 from company-mode/default-bindings-change |
Date: |
Thu, 6 May 2021 19:57:10 -0400 (EDT) |
branch: externals/company
commit 2cca48a061049db737ce7793630c799cfd02b077
Merge: 4ce6c58 7c34ee0
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: GitHub <noreply@github.com>
Merge pull request #1098 from company-mode/default-bindings-change
Change default bindings to use C-n/C-p
---
NEWS.md | 15 +++++++++++++++
company.el | 29 +++++++++++++++++++++++++----
2 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 7d1d9ee..69ebd83 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,21 @@
## Next
+* Default key bindings have been changed, moving `company-select-next` and
+ `company-select-previous` from `M-n` and `M-p` to `C-n` and `C-p`
+ ([#1098](https://github.com/company-mode/company-mode/pull/1098)). The
+ previous bindings still work, but show a warning and will be disabled soon.
To
+ undo that change locally, do:
+
+```el
+(with-eval-after-load 'company
+ (dolist (map (list company-active-map company-search-map))
+ (define-key map (kbd "C-n") nil)
+ (define-key map (kbd "C-p") nil)
+ (define-key map (kbd "M-n") #'company-select-next)
+ (define-key map (kbd "M-p") #'company-select-previous)))
+```
+
* New user option `company-files-chop-trailing-slash`
([#1042](https://github.com/company-mode/company-mode/issues/1042)).
* Improved visual responsiveness with async backends
diff --git a/company.el b/company.el
index 1d5fd62..89b9165 100644
--- a/company.el
+++ b/company.el
@@ -700,8 +700,10 @@ asynchronous call into synchronous.")
(let ((keymap (make-sparse-keymap)))
(define-key keymap "\e\e\e" 'company-abort)
(define-key keymap "\C-g" 'company-abort)
- (define-key keymap (kbd "M-n") 'company-select-next)
- (define-key keymap (kbd "M-p") 'company-select-previous)
+ (define-key keymap (kbd "M-n") 'company--select-next-and-warn)
+ (define-key keymap (kbd "M-p") 'company--select-previous-and-warn)
+ (define-key keymap (kbd "C-n") 'company-select-next)
+ (define-key keymap (kbd "C-p") 'company-select-previous)
(define-key keymap (kbd "<down>") 'company-select-next-or-abort)
(define-key keymap (kbd "<up>") 'company-select-previous-or-abort)
(define-key keymap [remap scroll-up-command] 'company-next-page)
@@ -728,6 +730,23 @@ asynchronous call into synchronous.")
(defvar company--disabled-backends nil)
+(defun company--select-next-and-warn (&optional arg)
+ (interactive "p")
+ (company--warn-changed-binding)
+ (company-select-next arg))
+
+(defun company--select-previous-and-warn (&optional arg)
+ (interactive "p")
+ (company--warn-changed-binding)
+ (company-select-previous arg))
+
+(defun company--warn-changed-binding ()
+ (interactive)
+ (run-with-idle-timer
+ 0.01 nil
+ (lambda ()
+ (message "Warning: default bindings are being changed to C-n and C-p"))))
+
(defun company-init-backend (backend)
(and (symbolp backend)
(not (fboundp backend))
@@ -2245,8 +2264,10 @@ each one wraps a part of the input string."
(define-key keymap (char-to-string meta-prefix-char) meta-map)
(define-key keymap [escape] meta-map))
(define-key keymap (vector meta-prefix-char t) 'company-search-other-char)
- (define-key keymap (kbd "M-n") 'company-select-next)
- (define-key keymap (kbd "M-p") 'company-select-previous)
+ (define-key keymap (kbd "C-n") 'company-select-next)
+ (define-key keymap (kbd "C-p") 'company-select-previous)
+ (define-key keymap (kbd "M-n") 'company--select-next-and-warn)
+ (define-key keymap (kbd "M-p") 'company--select-previous-and-warn)
(define-key keymap (kbd "<down>") 'company-select-next-or-abort)
(define-key keymap (kbd "<up>") 'company-select-previous-or-abort)
(define-key keymap "\e\e\e" 'company-search-other-char)
- [elpa] externals/company updated (4ce6c58 -> 2cca48a), ELPA Syncer, 2021/05/06
- [elpa] externals/company 1116da8 2/6: Merge branch 'master' into default-bindings-change, ELPA Syncer, 2021/05/06
- [elpa] externals/company 71bd73e 3/6: Remove one word for more compact paragraph, ELPA Syncer, 2021/05/06
- [elpa] externals/company 534273d 1/6: Change default bindings to use C-n/C-p, ELPA Syncer, 2021/05/06
- [elpa] externals/company d65ed9a 4/6: Promote hash-quoting, ELPA Syncer, 2021/05/06
- [elpa] externals/company 2cca48a 6/6: Merge pull request #1098 from company-mode/default-bindings-change,
ELPA Syncer <=
- [elpa] externals/company 7c34ee0 5/6: Add a link to PR, ELPA Syncer, 2021/05/06