diff options
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | helpful.el | 4 | ||||
| -rw-r--r-- | test/unit-test.el | 10 |
3 files changed, 15 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 55bb4da..2a32deb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.8 -No changes yet. +Fixed a crash on functions where the last form in their definition is +a plain symbol. # v0.7 @@ -320,7 +320,9 @@ source code to primitives." ;; `edebug-enter', `edebug-after' etc interleaved. This means the ;; function is interpreted, so `indirect-function' returns a list. (when (and (consp fn-def) (consp (cdr fn-def))) - (eq (car (-last-item fn-def)) 'edebug-enter)))) + (-let [fn-end (-last-item fn-def)] + (and (consp fn-end) + (eq (car fn-end) 'edebug-enter)))))) (defun helpful--can-edebug-p (sym callable-p) "Can we use edebug with SYM?" diff --git a/test/unit-test.el b/test/unit-test.el index 55945f9..ef8612b 100644 --- a/test/unit-test.el +++ b/test/unit-test.el @@ -88,6 +88,16 @@ (eval (eval-sexp-add-defvars (edebug-read-top-level-form)) t)))) (helpful-function #'test-foo-edebug)) +(defun test-foo-return-arg (s) + "blah blah." + s) + +(ert-deftest helpful--edebug-p () + "Ensure that we don't crash on a function whose body ends with +symbol (not a form)." + (should + (not (helpful--edebug-p #'test-foo-return-arg)))) + (defun test-foo-usage-docstring () "\n\n(fn &rest ARGS)" nil) |
