diff options
| author | Wilfred Hughes <me@wilfred.me.uk> | 2018-03-31 19:25:37 +0100 |
|---|---|---|
| committer | Wilfred Hughes <me@wilfred.me.uk> | 2018-03-31 19:26:39 +0100 |
| commit | 5681a5df8e157d0dae9c99df5455755353a68c8b (patch) | |
| tree | ad9e602761ce3ac4b9c3215282b06bde02050498 | |
| parent | f06fe10b07c8011290488db92653beb910e7cfac (diff) | |
Ensure we can find the definitions of interactively defined functions
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | helpful.el | 8 | ||||
| -rw-r--r-- | test/unit-test.el | 9 |
3 files changed, 16 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 41ba480..2b76a24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ Wording polish for finding references of primitives. Fixed some corner cases in references to info manual sections not being linkified. +Fixed an issue where the definition of interactively defined functions +wasn't shown. + # v0.8 Added setting `helpful-switch-buffer-function` to allow users to @@ -895,10 +895,10 @@ If the source code cannot be found, return the sexp used." (setq source (propertize source 'helpful-path (buffer-file-name buf) 'helpful-pos start-pos - 'helpful-pos-is-start t)))) - (when (and buf created) - (kill-buffer buf)) - (throw 'source source)) + 'helpful-pos-is-start t))) + (when (and buf created) + (kill-buffer buf)) + (throw 'source source))) (when callable-p ;; Could not find source -- probably defined interactively, or via diff --git a/test/unit-test.el b/test/unit-test.el index 669fedb..f232569 100644 --- a/test/unit-test.el +++ b/test/unit-test.el @@ -420,6 +420,15 @@ associated a lambda with a keybinding." (should (s-starts-with-p "(defun " source)))) +(ert-deftest helpful--source--interactively-defined-fn () + "We should return the raw sexp for functions where we can't +find the source code." + (eval '(defun test-foo-defined-interactively () 42)) + (should + (not + (null + (helpful--source #'test-foo-defined-interactively t))))) + (ert-deftest helpful--outer-sexp () ;; If point is in the middle of a form, we should return its position. (with-temp-buffer |
