]> code.delx.au - gnu-emacs-elpa/commitdiff
Allow scrolling the doc window with the mouse wheel
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 24 Feb 2015 19:52:30 +0000 (21:52 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 24 Feb 2015 19:52:30 +0000 (21:52 +0200)
Resolves #309

NEWS.md
company.el

diff --git a/NEWS.md b/NEWS.md
index c8dd158eb534112d80d2e1d5737470b169f864c8..d4b767dd7886e3f2c9b10d11f05e811eaf58bcf9 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
 
 ## Next
 
+* The documentation buffer window can be scrolled with the mouse wheel.
 * New command `company-diag`. Use it in bug reports.
 
 ## 2015-02-02 (0.8.10)
index a594f70de785e0cbb34f0edc2b15833131983e66..eae36ef6f74af799f7b9214d1ea30c093d1ba255 100644 (file)
@@ -2015,7 +2015,7 @@ character, stripping the modifiers.  That character must be a digit."
     (current-buffer)))
 
 (defvar company--electric-commands
-  '(scroll-other-window scroll-other-window-down)
+  '(scroll-other-window scroll-other-window-down mwheel-scroll)
   "List of Commands that won't break out of electric commands.")
 
 (defmacro company--electric-do (&rest body)
@@ -2029,9 +2029,12 @@ character, stripping the modifiers.  That character must be a digit."
          (and (< (window-height) height)
               (< (- (window-height) row 2) company-tooltip-limit)
               (recenter (- (window-height) row 2)))
-         (while (memq (setq cmd (key-binding (vector (list (read-event)))))
+         (while (memq (setq cmd (key-binding (read-key-sequence-vector nil)))
                       company--electric-commands)
-           (call-interactively cmd))
+           (condition-case err
+               (call-interactively cmd)
+             ((beginning-of-buffer end-of-buffer)
+              (message (error-message-string err)))))
          (company--unread-last-input)))))
 
 (defun company--unread-last-input ()