4

Is there a package to get a popup of the documentation for the thing at the point?

Here's an example that flycheck uses.

emacs

Joe
  • 1,312
  • 1
  • 8
  • 19
  • 1
    Check out [clippy](https://github.com/Fuco1/clippy.el). It's easy to modify the code to remove the Clippy character if you don't want it. – Tianxiang Xiong Jan 03 '16 at 22:27

1 Answers1

2

Don't know what kind of documentation you want, I use the following to display a short summary of elisp function/variable's docstring with popup:

(defun chunyang-elisp-function-or-variable-quickhelp (symbol)
  "Display summary of function or variable at point.

Adapted from `describe-function-or-variable'."
  (interactive
   (let* ((v-or-f (variable-at-point))
          (found (symbolp v-or-f))
          (v-or-f (if found v-or-f (function-called-at-point))))
     (list v-or-f)))
  (if (not (and symbol (symbolp symbol)))
      (message "You didn't specify a function or variable")
    (let* ((fdoc (when (fboundp symbol)
                   (or (documentation symbol t) "Not documented.")))
           (fdoc-short (and (stringp fdoc)
                            (substring fdoc 0 (string-match "\n" fdoc))))
           (vdoc (when  (boundp symbol)
                   (or (documentation-property symbol 'variable-documentation t)
                       "Not documented as a variable.")))
           (vdoc-short (and (stringp vdoc)
                            (substring vdoc 0 (string-match "\n" vdoc)))))
      (and (require 'popup nil 'no-error)
           (popup-tip
            (or
             (and fdoc-short vdoc-short
                  (concat fdoc-short "\n\n"
                          (make-string 30 ?-) "\n" (symbol-name symbol)
                          " is also a " "variable." "\n\n"
                          vdoc-short))
             fdoc-short
             vdoc-short)
            :margin t)))))

Here is what it looks like:

Screenshot of chunyang-elisp-function-or-variable-quickhelp

xuchunyang
  • 14,302
  • 1
  • 18
  • 39
  • `company-quickhelp` works for more than Elisp. What would it take to create a more general solution that takes into account the major-mode, and maybe other factors? – Tianxiang Xiong Dec 31 '15 at 23:10