From 9957bd89efd99d71ba4444035a1c835337ed55d9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:31:17 +0000 Subject: [PATCH] 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> --- tp.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tp.el b/tp.el index b7c9da1..477d94f 100644 --- a/tp.el +++ b/tp.el @@ -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))