helpful

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

commit 82b890601a05f1ab66e01a414dd3cc2f5f6bc464
parent 5d0662dc1c6c087d0f23621a77b29f48895e73a0
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Thu, 15 Feb 2018 08:51:09 +0000

Only call indirect-function for functions

Otherwise, if SYM is both a function and a variable, we show the
function definition if we can't find the variable definition.

Diffstat:
MCHANGELOG.md | 3+++
Mhelpful.el | 8++++----
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md @@ -3,6 +3,9 @@ Fixed a crash on functions where the last form in their definition is a plain symbol. +Fixed an issue where we would show function source code for variables +where we can't find the variable definition. + # v0.7 Helpful buffers now start with a summary of what you're looking at, diff --git a/helpful.el b/helpful.el @@ -847,13 +847,13 @@ If the source code cannot be found, return the sexp used." 'helpful-pos-is-start t)))) (when (and buf created) (kill-buffer buf)) - (if source - source + (when (and (null source) callable-p) ;; Could not find source -- probably defined interactively, or via ;; a macro, or file has changed. ;; TODO: verify that the source hasn't changed before showing. ;; TODO: offer to download C sources for current version. - (indirect-function sym)))) + (setq source (indirect-function sym))) + source)) (defun helpful--in-manual-p (sym) "Return non-nil if SYM is in an Info manual." @@ -1461,7 +1461,7 @@ state of the current symbol." 'helpful-c-source-directory))) (t (helpful--syntax-highlight - (format ";; Source file is unknown\n"))))) + (format ";; Source file is unknown"))))) (when source (insert (cond