diff options
| author | Wilfred Hughes <me@wilfred.me.uk> | 2018-07-24 09:01:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-24 09:01:55 +0100 |
| commit | 598d4acde5f9812cb3a58a4a996889ae611bd7b7 (patch) | |
| tree | 268c6cc066982daf3bc0b9831a0bfd053d6d4939 | |
| parent | b3c7741480e6a6a22d74e76f951f46f5ed2d86b8 (diff) | |
| parent | 73cec38b127876a850269a9dd5f59bcaeaed2c26 (diff) | |
Merge pull request #145 from nickdrozd/lambda-callees
helpful--show-callees choked on anonymous functions
| -rw-r--r-- | helpful.el | 16 | ||||
| -rw-r--r-- | test/unit-test.el | 16 |
2 files changed, 25 insertions, 7 deletions
@@ -610,8 +610,7 @@ overrides that to include previously opened buffers." (erase-buffer) (insert ;; TODO: Macros used, special forms used, global vars used. - (format "Functions called by %s:\n\n" - (symbol-name sym))) + (format "Functions called by %s:\n\n" sym)) (dolist (sym syms) (insert " " (helpful--button @@ -1532,6 +1531,13 @@ OBJ may be a symbol or a compiled function object." 'symbol sym 'callable-p callable-p)) +(defun helpful--make-callees-button (sym source) + (helpful--button + "Find callees" + 'helpful-callees-button + 'symbol sym + 'source source)) + (defun helpful--summary (sym callable-p buf pos) "Return a one sentence summary for SYM." (-let* ((primitive-p (helpful--primitive-p sym callable-p)) @@ -1888,11 +1894,7 @@ state of the current symbol." (when (and helpful--callable-p source (not primitive-p)) (insert " " - (helpful--button - "Find callees" - 'helpful-callees-button - 'symbol helpful--sym - 'source source))) + (helpful--make-callees-button helpful--sym source))) (when (helpful--advised-p helpful--sym) (helpful--insert-section-break) diff --git a/test/unit-test.el b/test/unit-test.el index 8121ffc..b051c06 100644 --- a/test/unit-test.el +++ b/test/unit-test.el @@ -716,3 +716,19 @@ find the source code." (apply #'bar 2))))) (should (memq 'foo result)) (should (memq 'bar result)))) + +(ert-deftest helpful--callees-button--smoke () + (with-temp-buffer + (let ((button (helpful--make-callees-button + 'whatever + '(defun whatever () (something) (test 5))))) + (insert button) + (goto-char (point-min)) + (push-button))) + (with-temp-buffer + (let ((button (helpful--make-callees-button + '(lambda () (interactive) (other-window -1)) + '(lambda () (interactive) (other-window -1))))) + (insert button) + (goto-char (point-min)) + (push-button)))) |
