Fix func-arity check to handle variadic functions

Handle the case where max arity is 'many' (unlimited) for
variadic functions, in addition to numeric max arity.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-15 15:31:17 +00:00
parent b2fb5e75c5
commit 9957bd89ef

5
tp.el
View File

@ -1321,7 +1321,10 @@ Example:
(text (if (stringp obj)
(substring obj start end)
(buffer-substring start end)))
(new-text (if (>= (cdr arity) 2)
(max-arity (cdr arity))
(can-accept-idx (or (eq max-arity 'many)
(and (numberp max-arity) (>= max-arity 2))))
(new-text (if can-accept-idx
(funcall function text idx)
(funcall function text))))
(setq idx (1+ idx))