@@ -3869,47 +3869,45 @@ a default implementation, which is a noop.")
3869
3869
3870
3870
; ;;; Get
3871
3871
3872
- (defun transient-scope (&optional prefixes )
3872
+ (defun transient-scope (&optional prefixes classes )
3873
3873
" Return the scope of the active or current transient prefix command.
3874
3874
3875
- If optional PREFIXES is nil, return the scope of the prefix currently
3876
- being setup, making this variant useful, e.g., in `:if*' predicates.
3877
- If no prefix is being setup, but the current command was invoked from
3878
- some prefix, return the scope of that.
3875
+ If optional PREFIXES and CLASSES are both nil, return the scope of
3876
+ the prefix currently being setup, making this variation useful, e.g.,
3877
+ in `:if*' predicates. If no prefix is being setup, but the current
3878
+ command was invoked from some prefix, then return the scope of that.
3879
3879
3880
- When this function is called from the body or `interactive' form of a
3881
- suffix command, PREFIXES should be non-nil.
3882
-
3883
- If PREFIXES is non-nil, it must be a prefix command or class, or a list
3884
- of such commands and/or classes. In this case try the following in
3885
- order:
3880
+ If PREFIXES is non-nil, it must be a prefix command or a list of such
3881
+ commands. If CLASSES is non-nil, it must be a prefix class or a list
3882
+ of such classes. When this function is called from the body or the
3883
+ `interactive' form of a suffix command, PREFIXES and/or CLASSES should
3884
+ be non-nil. If either is non-nil, try the following in order:
3886
3885
3887
3886
- If the current suffix command was invoked from a prefix, which
3888
3887
appears in PREFIXES, return the scope of that prefix.
3889
3888
3890
3889
- If the current suffix command was invoked from a prefix, and its
3891
- class derives from one of the classes in PREFIXES , return the scope
3892
- of that prefix.
3890
+ class derives from one of the CLASSES , return the scope of that
3891
+ prefix.
3893
3892
3894
3893
- If a prefix is being setup and it appears in PREFIXES, return its
3895
3894
scope.
3896
3895
3897
3896
- If a prefix is being setup and its class derives from one of the
3898
- classes in PREFIXES , return its scope.
3897
+ CLASSES , return its scope.
3899
3898
3900
- - Finally try to return the default scope of the first element of
3901
- PREFIXES, which must be a command (not a class). This only works
3902
- if that slot is set in the respective class definition or using
3903
- its `transient-init-scope' method.
3899
+ - Finally try to return the default scope of the first command in
3900
+ PREFIXES. This only works if that slot is set in the respective
3901
+ class definition or using its `transient-init-scope' method.
3904
3902
3905
3903
If no prefix matches, return nil."
3906
- (if prefixes
3904
+ (if ( or prefixes classes)
3907
3905
(let* ((prefixes (ensure-list prefixes))
3908
- (classes ( seq-filter # 'class-p prefixes )))
3906
+ (type ( if ( symbolp classes) classes ( cons 'or classes) )))
3909
3907
(if-let* ((obj (cl-flet ((match (obj)
3910
3908
(and obj
3911
3909
(or (memq (oref obj command) prefixes)
3912
- (cl-typep obj ( cons 'or classes) ))
3910
+ (cl-typep obj type ))
3913
3911
obj)))
3914
3912
(or (match transient-current-prefix)
3915
3913
(match transient--prefix)))))
0 commit comments