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:
parent
b2fb5e75c5
commit
9957bd89ef
5
tp.el
5
tp.el
@ -1321,7 +1321,10 @@ Example:
|
|||||||
(text (if (stringp obj)
|
(text (if (stringp obj)
|
||||||
(substring obj start end)
|
(substring obj start end)
|
||||||
(buffer-substring 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 idx)
|
||||||
(funcall function text))))
|
(funcall function text))))
|
||||||
(setq idx (1+ idx))
|
(setq idx (1+ idx))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user