aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2021-12-10 23:03:15 -0800
committerWilfred Hughes <me@wilfred.me.uk>2021-12-10 23:03:15 -0800
commit2afbde902742b1aa64daa31a635ba564f14b35ae (patch)
treef22d5ae7c223729213f030d36eedd59f8da93a60
parentdd806b8f04bcaca725a481b0b4a9bda384e570a6 (diff)
Use lexical-binding in tests and fix crash exposed0.19
argdesc in byte-code function objects may be an integer rather than a list, so handle that case gracefully.
-rw-r--r--helpful.el9
-rw-r--r--test/helpful-unit-test.el2
2 files changed, 10 insertions, 1 deletions
diff --git a/helpful.el b/helpful.el
index 3ec6ed9..c4cdd28 100644
--- a/helpful.el
+++ b/helpful.el
@@ -2470,7 +2470,14 @@ For example, \"(some-func FOO &optional BAR)\"."
((symbolp sym)
(help-function-arglist sym))
((byte-code-function-p sym)
- (aref sym 0))
+ ;; argdesc can be a list of arguments or an integer
+ ;; encoding the min/max number of arguments. See
+ ;; Byte-Code Function Objects in the elisp manual.
+ (let ((argdesc (aref sym 0)))
+ (if (consp argdesc)
+ argdesc
+ ;; TODO: properly handle argdesc values.
+ nil)))
(t
;; Interpreted function (lambda ...)
(cadr sym))))
diff --git a/test/helpful-unit-test.el b/test/helpful-unit-test.el
index 4e87efe..a07aa8e 100644
--- a/test/helpful-unit-test.el
+++ b/test/helpful-unit-test.el
@@ -1,3 +1,5 @@
+;;; helpful-unit-test.el -*- lexical-binding: t; -*-
+
(require 'ert)
(require 'edebug)
(require 'helpful)