Improvements to apropos and describe-symbol

Patch the apropos button types so they call helpful instead of the
built-in describe functions.  Also add some bindings to apropos-mode-map
so it behaves like other help modes.

Add `doom/describe-symbol` function, which shows documentation for
callable and variable symbols.  If a symbol is both a variable and a
callable, it dispatches to apropos.  This gives a better workflow than
`helpful-symbol`, which annoyingly prompts the user.

Remap `describe-symbol` to `doom/describe-symbol`, and update
`+emacs-lisp-lookup-documentation` to call it also.
This commit is contained in:
Andrew Whatson 2019-03-12 14:21:41 +10:00
parent 3f282829bf
commit 7b4afa32e4
4 changed files with 45 additions and 8 deletions

View file

@ -126,9 +126,8 @@ library/userland functions"
;;;###autoload
(defun +emacs-lisp-lookup-documentation (thing)
"Lookup THING with `helpful-symbol' if it's a symbol, apropos otherwise."
(cond ((not thing)
(call-interactively #'helpful-symbol))
((if-let* ((sym (intern-soft thing))) (helpful-symbol sym)))
((apropos (format "^%s" thing)))
((apropos thing))))
"Lookup THING with `helpful-variable' if it's a variable, `helpful-callable'
if it's callable, `apropos' otherwise."
(if (not thing)
(call-interactively #'doom/describe-symbol)
(doom/describe-symbol thing)))