helpful

a fork of Wilfred's helpful
git clone https://git.trogloxene.org/helpful.git
Log | Files | Refs | README

commit 2afbde902742b1aa64daa31a635ba564f14b35ae
parent dd806b8f04bcaca725a481b0b4a9bda384e570a6
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Fri, 10 Dec 2021 23:03:15 -0800

Use lexical-binding in tests and fix crash exposed

argdesc in byte-code function objects may be an integer rather than a
list, so handle that case gracefully.

Diffstat:
Mhelpful.el | 9++++++++-
Mtest/helpful-unit-test.el | 2++
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git 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 @@ -1,3 +1,5 @@ +;;; helpful-unit-test.el -*- lexical-binding: t; -*- + (require 'ert) (require 'edebug) (require 'helpful)