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:
parent
3f282829bf
commit
7b4afa32e4
4 changed files with 45 additions and 8 deletions
|
@ -296,6 +296,21 @@ If prefix arg is prsent, refresh the cache."
|
|||
(insert "\n" indent))
|
||||
(delete-char -1)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/describe-symbol (symbol)
|
||||
"Show help for SYMBOL, a variable, function or macro."
|
||||
(interactive
|
||||
(list (helpful--read-symbol "Symbol: " #'helpful--bound-p)))
|
||||
(let* ((sym (intern-soft symbol))
|
||||
(bound (boundp sym))
|
||||
(fbound (fboundp sym)))
|
||||
(cond ((and sym bound (not fbound))
|
||||
(helpful-variable sym))
|
||||
((and sym fbound (not bound))
|
||||
(helpful-callable sym))
|
||||
((apropos (format "^%s\$" symbol)))
|
||||
((apropos (format "%s" symbol))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/what-face (arg &optional pos)
|
||||
"Shows all faces and overlay faces at point.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue