I have just got ternjs up and running with js2-mode & company-mode in emacs and getting quite excited. The C-c C-d function to get the docs for a function from tern brings back quite a limited subset of information. I would love to learn lisp but find it confusing everytime I look at it.
Instead of showing the first line of a functions' comment block in the mini buffer what I would like to do is show the full document block in a split window that auto closes when exiting or on key press.
This is the function that gets the docs from tern
(defvar tern-last-docs-url nil)
(defun tern-get-docs ()
(interactive)
(if (and tern-last-docs-url (eq last-command 'tern-get-docs))
(progn
(browse-url tern-last-docs-url)
(setf tern-last-docs-url nil))
(tern-run-query (lambda (data)
(let ((url (cdr (assq 'url data))) (doc (cdr (assq 'doc data))))
(cond (doc
(setf tern-last-docs-url url)
(tern-message doc))
(url
(browse-url url))
(t (tern-message "Not found")))))
"documentation"
(point))))
But I dont have a clue where to start. I would like to debug and see what the url is - and test this outside of emacs to see firstly if tern actually returns the full docs.
If it does then I would like to open a split buffer and load the docs, and kill on keypress.
Anyone up for a mini lisp tutorial - breaking down how this works and perhaps instructions on how to do the above?
Actually I can see that all the full comment of the function is shown - I guess the only part I am seeking help with is how to open in a split window - and also I would like to include the additional jsDoc annotations such as @param {string} etc...