Emacs: Get the full function docs / comments with C-c C-d


#1

Currently this gives you the first line comment in the mini buffer. Is it possible to open a side window with the full docs for the function. Does anyone know how to go about doing something like this?

Thanks.


#2

It would be possible (Tern does save the full comment, and you can get it with a docFormat: "full" query option), but it’d require you to implement this option in the Emacs mode.


#3

Here is a command for this

(defun tern-describe ()
  (interactive)
  (tern-run-query
   (lambda (data)
     ;; url, doc, type, origin
     (let-alist data
       (with-current-buffer (get-buffer-create "*Tern Describe*")
         (let ((inhibit-read-only t))
           (erase-buffer)
           (when .doc
             (insert .doc)
             (fill-region (point-min) (point-max)))
           (when .url
             (and .doc (insert "\n\n"))
             (insert .url))
           (goto-char (point-min))
           (display-buffer (current-buffer))))))
   '((type . "documentation") (docFormat . "full"))
   (point)))