diff options
author | Profpatsch <mail@profpatsch.de> | 2014-09-15 16:49:47 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2014-09-23 03:22:51 +0200 |
commit | 354b09ca1d7e1f830bbe3875f1a0a7fc24b14b4d (patch) | |
tree | f84339197dcfcec9373740b9e0b9db17772cc9ac | |
parent | 270e94ec59594a9ca43d09e4e841528e030129ff (diff) | |
download | geiser-chez-354b09ca1d7e1f830bbe3875f1a0a7fc24b14b4d.tar.gz geiser-chez-354b09ca1d7e1f830bbe3875f1a0a7fc24b14b4d.tar.bz2 |
company: implement --doc-buffer
-rw-r--r-- | elisp/geiser-company.el | 12 | ||||
-rw-r--r-- | elisp/geiser-doc.el | 27 |
2 files changed, 26 insertions, 13 deletions
diff --git a/elisp/geiser-company.el b/elisp/geiser-company.el index 101cbbd..1c4b5f0 100644 --- a/elisp/geiser-company.el +++ b/elisp/geiser-company.el @@ -15,6 +15,7 @@ (require 'geiser-completion) (require 'geiser-edit) (require 'geiser-base) +(require 'geiser-doc) (eval-when-compile (require 'cl)) @@ -40,7 +41,16 @@ (let ((help (geiser-autodoc--autodoc `((,id 0))))) (and help (substring-no-properties help)))))) -(defsubst geiser-company--doc-buffer (id) nil) +(defun geiser-company--doc-buffer (id) + (let* ((impl geiser-impl--implementation) + (module (geiser-doc-module (geiser-eval--get-module) impl)) + (symbol (make-symbol id)) + (ds (geiser-doc--get-docstring symbol module))) + (if (or (not ds) (not (listp ds))) + (message "No documentation available for '%s'" symbol) + (with-current-buffer (get-buffer-create "*company-documentation*") + (geiser-doc-symbol--fill-current-buffer ds symbol module impl) + (current-buffer))))) (defun geiser-company--location (id) (ignore-errors diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el index 9c4eb4f..981a87c 100644 --- a/elisp/geiser-doc.el +++ b/elisp/geiser-doc.el @@ -287,6 +287,20 @@ help (e.g. browse an HTML page) implementing this method.") impl) impl)))) +(defun geiser-doc-symbol--fill-current-buffer (docstring symbol &optional module impl) + (erase-buffer) + (geiser-doc--insert-title + (geiser-autodoc--str* (cdr (assoc "signature" docstring)))) + (newline) + (insert (or (cdr (assoc "docstring" docstring)) "")) + (geiser-doc--buttonize-modules impl) + (setq geiser-doc--buffer-link + (geiser-doc--history-push (geiser-doc--make-link symbol + module + impl))) + (geiser-doc--insert-footer impl) + (goto-char (point-min))) + (defun geiser-doc-symbol (symbol &optional module impl) (let* ((impl (or impl geiser-impl--implementation)) (module (geiser-doc--module (or module (geiser-eval--get-module)) @@ -295,18 +309,7 @@ help (e.g. browse an HTML page) implementing this method.") (if (or (not ds) (not (listp ds))) (message "No documentation available for '%s'" symbol) (geiser-doc--with-buffer - (erase-buffer) - (geiser-doc--insert-title - (geiser-autodoc--str* (cdr (assoc "signature" ds)))) - (newline) - (insert (or (cdr (assoc "docstring" ds)) "")) - (geiser-doc--buttonize-modules impl) - (setq geiser-doc--buffer-link - (geiser-doc--history-push (geiser-doc--make-link symbol - module - impl))) - (geiser-doc--insert-footer impl) - (goto-char (point-min))) + (geiser-doc-symbol--fill-current-buffer ds symbol module impl)) (geiser-doc--pop-to-buffer))))) (defun geiser-doc-symbol-at-point (&optional arg) |