]> code.delx.au - gnu-emacs-elpa/commitdiff
Add company-next-page and company-previous-page
authorDmitry Gutov <dgutov@yandex.ru>
Thu, 22 Jan 2015 23:01:23 +0000 (01:01 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Thu, 22 Jan 2015 23:01:23 +0000 (01:01 +0200)
Resolves #283

NEWS.md
company.el

diff --git a/NEWS.md b/NEWS.md
index 70d6a0f33ae74944d3b62b9ce79c7e8e0f6cddf4..4139186095e763af57f0b639abbcda1081702566 100644 (file)
--- 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.
index 005413be27526c633325e3815eb5973e7d70ba06..cd78bd930af6c316f2c4195b0dc0b50666c466ec 100644 (file)
@@ -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)