branch: externals/transient
commit 91dd7bb33ee5cd2cd914ab85a5e23b6cbc6827e7
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    transient--func-arity: New function
    
    Advising a function (e.g., using elp) changes its arity (to (0 . many)).
    We really need to know the "actual" arity, so we have no choice but to
    peal the advice to get to the adviced function.
---
 lisp/transient.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 396b513be4..5e9d533bcb 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -3910,7 +3910,7 @@ called inside the correct buffer (see 
`transient--insert-group')
 and its value is returned to the caller."
   (and-let* ((desc (oref obj description))
              (desc (if (functionp desc)
-                       (if (= (car (func-arity desc)) 1)
+                       (if (= (car (transient--func-arity desc)) 1)
                            (funcall desc obj)
                          (funcall desc))
                      desc)))
@@ -4010,7 +4010,7 @@ If the OBJ's `key' is currently unreachable, then apply 
the face
     (if (and (not (facep face))
              (functionp face))
         (let ((transient--pending-suffix obj))
-          (if (= (car (func-arity face)) 1)
+          (if (= (car (transient--func-arity face)) 1)
               (funcall face obj)
             (funcall face)))
       face)))
@@ -4401,6 +4401,9 @@ we stop there."
   (face-remap-reset-base 'default)
   (face-remap-add-relative 'default 'fixed-pitch))
 
+(defun transient--func-arity (fn)
+  (func-arity (advice--cd*r (if (symbolp fn) (symbol-function fn) fn))))
+
 (defun transient--seq-reductions-from (function sequence initial-value)
   (let ((acc (list initial-value)))
     (seq-doseq (elt sequence)

Reply via email to