helpful

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

commit ec47b5f7b15d630c9fcf018f9cef8f27deb47f46
parent 1e5ce8b2cc91dad27fa460c4b473ed44fb36771a
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Thu,  5 Oct 2017 21:10:47 +0100

Merge pull request #44 from Alexander-Miller/var-at-point

Also handle variables in helpful-at-point.
Diffstat:
Mhelpful.el | 27+++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/helpful.el b/helpful.el @@ -584,7 +584,7 @@ state of the current symbol." (insert (helpful--heading "\n\nKey Bindings\n") (helpful--format-keys helpful--sym))) - + (insert (helpful--heading "\n\nReferences\n") (cond @@ -606,7 +606,7 @@ state of the current symbol." (insert (helpful--heading "\n\nSymbol Properties\n") formatted-props)) - + (when (helpful--advised-p helpful--sym) (insert (helpful--heading "\n\nAdvice\n") @@ -621,7 +621,7 @@ state of the current symbol." (helpful--disassemble-button) " ")) (helpful--forget-button helpful--sym helpful--callable-p) - + (helpful--heading "\n\nSource Code\n") (cond (source-path @@ -686,12 +686,12 @@ For example, \"(some-func FOO &optional BAR)\"." (format "(%s %s)" sym (s-join " " formatted-args)) (format "(%s)" sym)))) - + ;; If the docstring ends with (fn FOO BAR), extract that. (-when-let (docstring (documentation sym)) (-when-let (docstring-with-usage (help-split-fundoc docstring sym)) (setq docstring-sig (car docstring-with-usage)))) - + (or docstring-sig source-sig))) ;; TODO: Info mentions, e.g. `define-derived-mode' or `defface'. @@ -814,22 +814,13 @@ See also `helpful-callable' and `helpful-variable'." (pop-to-buffer (helpful--buffer symbol nil)) (helpful-update)) -;; TODO: offer variable/function choice ;;;###autoload (defun helpful-at-point () - "Show help for the callable symbol at point." + "Show help for the symbol 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 - (pop-to-buffer (helpful--buffer symbol t)) - (helpful-update))))) + (-if-let (symbol (symbol-at-point)) + (helpful-symbol symbol) + (user-error "There is no symbol at point."))) (define-derived-mode helpful-mode special-mode "Helpful" "Major mode for *Helpful* buffers."