emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master d27bdf6 5/7: Add company-next-page and company-previous-pa


From: Dmitry Gutov
Subject: [elpa] master d27bdf6 5/7: Add company-next-page and company-previous-page
Date: Thu, 22 Jan 2015 23:06:53 +0000

branch: master
commit d27bdf6eb8defdec0d975d7c4372e81bd92082ae
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Add company-next-page and company-previous-page
    
    Resolves #283
---
 NEWS.md    |    5 +++++
 company.el |   16 ++++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 70d6a0f..4139186 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,10 @@
 # History of user-visible changes
 
+## 2015-01-23 (0.8.9)
+
+* New commands `company-next-page` and `company-previous-page`, remapping
+  `scroll-up-command` and `scroll-down-command` during completion.
+
 ## 2015-01-13 (0.8.8)
 
 * Pressing `M-n` or `M-p` doesn't quit the search mode.
diff --git a/company.el b/company.el
index 005413b..cd78bd9 100644
--- a/company.el
+++ b/company.el
@@ -614,6 +614,8 @@ asynchronous call into synchronous.")
     (define-key keymap (kbd "M-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)
+    (define-key keymap [remap scroll-down-command] 'company-previous-page)
     (define-key keymap [down-mouse-1] 'ignore)
     (define-key keymap [down-mouse-3] 'ignore)
     (define-key keymap [mouse-1] 'company-complete-mouse)
@@ -1811,6 +1813,20 @@ and invoke the normal binding."
     (company-abort)
     (company--unread-last-input)))
 
+(defun company-next-page ()
+  "Select the candidate one page further."
+  (interactive)
+  (when (company-manual-begin)
+    (company-set-selection (+ company-selection
+                              company-tooltip-limit))))
+
+(defun company-previous-page ()
+  "Select the candidate one page earlier."
+  (interactive)
+  (when (company-manual-begin)
+    (company-set-selection (- company-selection
+                              company-tooltip-limit))))
+
 (defvar company-pseudo-tooltip-overlay)
 
 (defvar company-tooltip-offset)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]