diff options
| author | Wilfred Hughes <me@wilfred.me.uk> | 2021-12-10 22:09:39 -0800 |
|---|---|---|
| committer | Wilfred Hughes <me@wilfred.me.uk> | 2021-12-10 22:10:04 -0800 |
| commit | 55a8ebcd644bedf7330ac6c744ca66a48fea01b1 (patch) | |
| tree | c3c257ada47455f7116a9c406812fb1203a43202 | |
| parent | 217b38398bfa523c48f630b06b21427974d93e1d (diff) | |
Fix crash on lambdas with docstrings
Spotted when debugging #278.
| -rw-r--r-- | helpful.el | 2 | ||||
| -rw-r--r-- | test/helpful-unit-test.el | 7 |
2 files changed, 8 insertions, 1 deletions
@@ -2257,7 +2257,7 @@ state of the current symbol." (insert (helpful--format-docstring docstring))) (when version-info (insert "\n\n" (s-word-wrap 70 version-info))) - (when (helpful--in-manual-p helpful--sym) + (when (and (symbolp helpful--sym) (helpful--in-manual-p helpful--sym)) (insert "\n\n") (insert (helpful--make-manual-button helpful--sym))))) diff --git a/test/helpful-unit-test.el b/test/helpful-unit-test.el index 510396c..0cfef04 100644 --- a/test/helpful-unit-test.el +++ b/test/helpful-unit-test.el @@ -566,6 +566,13 @@ associated a lambda with a keybinding." (with-current-buffer buf (helpful-update)))) +(ert-deftest helpful--unnamed-func-with-docstring () + (let* ((fun (lambda (x) "Foo" x)) + (buf (helpful--buffer fun t))) + ;; Don't crash when we show the buffer. + (with-current-buffer buf + (helpful-update)))) + (ert-deftest helpful--unnamed-compiled-func () "Ensure we handle unnamed byte-compiled functions. |
