(append (all-completions arg (company-elisp-parse-let))
(all-completions arg obarray
'company-elisp-predicate))))
- ('meta (company-elisp-doc arg))))
+ ('meta (company-elisp-doc arg))
+ ('doc-buffer (describe-function 'describe-function)
+ (help-buffer))))
(provide 'company-elisp)
;;; company-elisp.el ends here
"\n"))
doc)))
+(defun company-semantic-doc-buffer (tag)
+ (let ((doc (semantic-documentation-for-tag tag)))
+ (when doc
+ (with-current-buffer (company-doc-buffer)
+ (insert (funcall semantic-idle-summary-function tag nil t)
+ "\n"
+ doc)
+ (current-buffer)))))
+
(defsubst company-semantic-completions (prefix)
(ignore-errors
(let ((completion-ignore-case nil)
(mapcar 'semantic-tag-name
(semantic-analyze-find-tags-by-prefix arg))))
('meta (funcall company-semantic-metadata-function
- (semantic-analyze-find-tag arg)))))
+ (semantic-analyze-find-tag arg)))
+ ('doc-buffer (company-semantic-doc-buffer (semantic-analyze-find-tag arg)))
+ ))
(provide 'company-semantic)
;;; company-semantic.el ends here
"^Pseudo tooltip frontend cannot be used twice$")
(add-to-list 'debug-ignored-errors "^Preview frontend cannot be used twice$")
(add-to-list 'debug-ignored-errors "^Echo area cannot be used twice$")
+(add-to-list 'debug-ignored-errors "^No documentation available$")
(defgroup company nil
""
(define-key keymap (kbd "M-p") 'company-select-previous)
(define-key keymap (kbd "M-<return>") 'company-complete-selection)
(define-key keymap "\t" 'company-complete)
+ (define-key keymap (kbd "<f1>") 'company-show-doc-buffer)
keymap))
;;;###autoload
(setq company-point (point)))
(defun company-pre-command ()
- (when company-candidates
- (company-call-frontends 'pre-command)))
+ (unless (eq this-command 'company-show-doc-buffer)
+ (when company-candidates
+ (company-call-frontends 'pre-command))))
(defun company-post-command ()
- (unless (equal (point) company-point)
- (company-begin))
- (when company-candidates
- (company-call-frontends 'post-command)))
+ (unless (eq this-command 'company-show-doc-buffer)
+ (unless (equal (point) company-point)
+ (company-begin))
+ (when company-candidates
+ (company-call-frontends 'post-command))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(cons selected (funcall company-backend 'meta selected))))
(cdr company-last-metadata)))
+(defun company-doc-buffer (&optional string)
+ (with-current-buffer (get-buffer-create "*Company meta-data*")
+ (erase-buffer)
+ (current-buffer)))
+
+(defun company-show-doc-buffer ()
+ (interactive)
+ (when company-candidates
+ (save-window-excursion
+ (let* ((selected (nth company-selection company-candidates))
+ (buffer (funcall company-backend 'doc-buffer selected)))
+ (if (not buffer)
+ (error "No documentation available.")
+ (display-buffer buffer)
+ (read-event)
+ (when last-input-event
+ (clear-this-command-keys t)
+ (setq unread-command-events (list last-input-event))))))))
+
;;; pseudo-tooltip ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar company-pseudo-tooltip-overlay nil)