Add new emacs-lisp :documentation lookup handler

Made to do-what-I-mean. Uses describe-symbol/helpful-symbol and falls
back to apropos.
This commit is contained in:
Henrik Lissner 2019-03-04 19:51:55 -05:00
parent 27822ef006
commit c7aa41599d
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395
2 changed files with 10 additions and 1 deletions

View File

@ -122,3 +122,12 @@ library/userland functions"
if (file-in-directory-p buffer-file-name dir)
return t)))
(flycheck-mode -1)))
;;;###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))))

View File

@ -18,7 +18,7 @@
(set-eval-handler! 'emacs-lisp-mode #'+emacs-lisp-eval)
(set-lookup-handlers! 'emacs-lisp-mode
:definition #'elisp-def
:documentation #'info-lookup-symbol)
:documentation #'+emacs-lisp-lookup-documentation)
(set-docsets! 'emacs-lisp-mode "Emacs Lisp")
(set-pretty-symbols! 'emacs-lisp-mode :lambda "lambda")
(set-rotate-patterns! 'emacs-lisp-mode