+(defun company-select-mouse (event)
+ "Select the candidate picked by the mouse."
+ (interactive "e")
+ (when (nth 4 (event-start event))
+ (company-set-selection (- (cdr (posn-col-row (event-start event)))
+ (cdr (posn-col-row (posn-at-point)))
+ 1))
+ t))
+
+(defun company-complete-mouse (event)
+ "Complete the candidate picked by the mouse."
+ (interactive "e")
+ (when (company-select-mouse event)
+ (company-complete-selection)))
+