commit c5a5965017606fa703cdfabdac1441483ad72e9c
parent c2870c3ee72c9be65d627639f2371ffc4f094e15
Author: Wilfred Hughes <me@wilfred.me.uk>
Date: Sun, 18 Feb 2018 10:07:20 +0000
Ensure we still show the source code of the function
This was broken for symbol in the previous commit.
Diffstat:
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/helpful.el b/helpful.el
@@ -835,7 +835,7 @@ hooks.")
"Return the source code of SYM.
If the source code cannot be found, return the sexp used."
(catch 'source
- (when (functionp sym)
+ (unless (symbolp sym)
(throw 'source sym))
(-let (((buf start-pos created) (helpful--definition sym callable-p))
diff --git a/test/unit-test.el b/test/unit-test.el
@@ -361,3 +361,8 @@ associated a lambda with a keybinding."
'(([3 27 1] backward-char)
([17] forward-line)
([97] forward-char))))))
+
+(ert-deftest helpful--source ()
+ (let* ((source (helpful--source #'helpful--source t)))
+ (should
+ (s-starts-with-p "(defun " source))))