branch: externals/transient
commit 6d1d865666c5333b4a342ebfe6de835718410478
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    Give up on determining function arity upfront
    
    `transient--arity-funcall' could deal with advice,
    but not `apply-partially' and probably other cases.
    
    Closes #421.
---
 lisp/transient.el | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index ca28aeb5fa..d782944372 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -4866,7 +4866,9 @@ apply the face `transient-unreachable' to the complete 
string."
 (cl-defmethod transient--get-description ((obj transient-child))
   (cond-let* [[desc (oref obj description)]]
              ((functionp desc)
-              (transient--arity-funcall desc obj))
+              (condition-case nil
+                  (funcall desc obj)
+                (wrong-number-of-arguments (funcall desc))))
              (desc)))
 
 (cl-defmethod transient--get-face ((obj transient-suffix) slot)
@@ -4875,7 +4877,9 @@ apply the face `transient-unreachable' to the complete 
string."
              ((facep face) face)
              ((functionp face)
               (let ((transient--pending-suffix obj))
-                (transient--arity-funcall face obj)))))
+                (condition-case nil
+                    (funcall face obj)
+                  (wrong-number-of-arguments (funcall face)))))))
 
 (defun transient--add-face (string face &optional append beg end)
   (let ((str (copy-sequence string)))
@@ -5382,12 +5386,6 @@ we stop there."
   (face-remap-reset-base 'default)
   (face-remap-add-relative 'default 'fixed-pitch))
 
-(defun transient--arity-funcall (fn &rest args)
-  (let ((max (cdr (func-arity (advice--cd*r (if (symbolp fn)
-                                                (symbol-function fn)
-                                              fn))))))
-    (apply fn (if (eq max 'many) args (seq-take args max)))))
-
 (defun transient--seq-reductions-from (function sequence initial-value)
   (let ((acc (list initial-value)))
     (seq-doseq (elt sequence)

Reply via email to