helpful

a fork of Wilfred's helpful
git clone https://git.trogloxene.org/helpful.git
Log | Files | Refs | README

commit 6ecf75d67e6099b6128b00cae7ff06b5190a82a5
parent 5caaf3da75d22daadacf763602e46e288b6de281
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Sat, 22 Jul 2017 13:18:13 +0100

Convenience command for help at point

Diffstat:
Mhelpful.el | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/helpful.el b/helpful.el @@ -31,6 +31,7 @@ ;; * helpful-function ;; * helpful-command ;; * helpful-macro +;; * helpful-at-point ;; ;; For more information and screenshots, see ;; https://github.com/wilfred/helpful @@ -620,6 +621,22 @@ For example, \"(some-func FOO &optional BAR)\"." (switch-to-buffer (helpful--buffer symbol)) (helpful-update)) +;;;###autoload +(defun helpful-at-point () + "Show help for the callable symbol at point." + (interactive) + (let ((symbol (symbol-at-point))) + (cond + ((null symbol) + ;; TODO: suggest looking at value help, or nearby symbols, or + ;; similarly named symbols + (user-error "No symbol found at point")) + ((not (fboundp symbol)) + (user-error "%s is not a function or macro" symbol)) + (t + (switch-to-buffer (helpful--buffer symbol)) + (helpful-update))))) + (define-derived-mode helpful-mode special-mode "Helpful" "Major mode for *Helpful* buffers." (add-hook 'xref-backend-functions #'elisp--xref-backend nil t))