- (unless company-mode (error "Company not enabled"))
- (when (company-manual-begin)
- (save-window-excursion
- (let* ((height (window-height))
- (row (cdr (posn-col-row (posn-at-point))))
- (selected (nth company-selection company-candidates))
- (buffer (funcall company-backend 'doc-buffer selected)))
- (if (not buffer)
- (error "No documentation available.")
- (display-buffer buffer)
- (and (< (window-height) height)
- (< (- (window-height) row 2) company-tooltip-limit)
- (recenter (- (window-height) row 2)))
- (while (eq 'scroll-other-window
- (key-binding (vector (list (read-event)))))
- (scroll-other-window))
- (when last-input-event
- (clear-this-command-keys t)
- (setq unread-command-events (list last-input-event))))))))
+ (company-electric
+ (let ((selected (nth company-selection company-candidates)))
+ (display-buffer (or (funcall company-backend 'doc-buffer selected)
+ (error "No documentation available")) t))))