branch: externals/transient commit 9183fe1ed2688fe41db2a367896b5375dbba2cd9 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Do not use cl-typep, which is broken for objects on Emacs 25 The issue we are avoiding is that `cl-typep' returns nil when it should return t, because the VAL does in fact derive from the class TYPE. To avoid this issue we have to resort to using `CLASS--eieio-childp' predicates, which--as the name suggests--we are not supposed to use. `cl-typep' only appears to be broken when using byte-compiled code and some other factor also appears to play a role. I was not able to reproduce this issue when using Borg instead of Package. On Emacs 26 `cl-typep' works as expected (though because it has no doc-string, we don't know whether the expectation changed between those two Emacs releases). Also don't use `cl-etypecase' when objects are involved because that uses `cl-typep'. Fixes https://github.com/magit/magit/issues/3732. --- lisp/transient.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index c06f24fbfb..de02a9361e 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1000,7 +1000,7 @@ command; explicitly defined infix arguments continue to polute the command namespace. It would be better if all this were made unnecessary by a `execute-extended-command-ignore' symbol property but unfortunately that does not exist (yet?)." - (if (cl-typep arg 'transient-suffix) + (if (transient-suffix--eieio-childp arg) (let ((sym (oref arg command))) (if (commandp sym) sym @@ -1274,12 +1274,14 @@ EDIT may be non-nil." 'transient--layout))))))) (setq transient--suffixes (cl-labels ((s (def) - (cl-etypecase def - (integer nil) - (string nil) - (list (cl-mapcan #'s def)) - (transient-group (cl-mapcan #'s (oref def suffixes))) - (transient-suffix (list def))))) + (cond + ((integerp def) nil) + ((stringp def) nil) + ((listp def) (cl-mapcan #'s def)) + ((transient-group--eieio-childp def) + (cl-mapcan #'s (oref def suffixes))) + ((transient-suffix--eieio-childp def) + (list def))))) (cl-mapcan #'s transient--layout)))) (defun transient--init-child (levels spec) @@ -1328,7 +1330,7 @@ EDIT may be non-nil." (error "No key for %s" (oref obj command)))) (cl-defmethod transient--init-suffix-key ((obj transient-argument)) - (if (cl-typep obj 'transient-switches) + (if (transient-switches--eieio-childp obj) (cl-call-next-method obj) (unless (slot-boundp obj 'shortarg) (when-let ((shortarg (transient--derive-shortarg (oref obj argument)))) @@ -1801,7 +1803,7 @@ For transients that are used to pass arguments to a subprosess separates non-positional arguments from positional arguments. The value of Magit's file argument for example looks like this: \(\"--\" file...)." - (let ((val (if (and (cl-typep prefix 'transient-prefix)) + (let ((val (if (and (transient-prefix--eieio-childp prefix)) (delq nil (mapcar 'transient-infix-value transient--suffixes)) (and (or (not prefix)