summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG3
-rw-r--r--lisp/transient.el20
2 files changed, 20 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 8db0f34..575580e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,9 @@
- Added documentation for ~inapt-if*~ slots to manual. 179545a6
+- ~transient-args~ and ~transient-scope~ now both take a prefix command or
+ a list of prefix commands as argument.
+
Bug fixes:
- Fixes some menu navigation edge-cases.
diff --git a/lisp/transient.el b/lisp/transient.el
index 87b83dc..4d6a841 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -3664,9 +3664,23 @@ implementation, which is a noop.")
;;;; Get
-(defun transient-scope ()
- "Return the value of the `scope' slot of the current prefix."
- (oref (transient-prefix-object) scope))
+(defun transient-scope (&optional prefix)
+ "Return the value of the `scope' slot of the current prefix.
+
+If the current command wasn't invoked from a prefix, return nil.
+
+If PREFIX is non-nil, it must a single prefix or a list of prefixes.
+If the current prefix is one of these prefixes, return its scope,
+otherwise return nil.
+
+If PREFIX is nil (for backward compatibility it may also be omitted)
+then return the scope of the current prefix, whatever that is. This
+usage is rarely appropriate; it is better to be explicit."
+ (declare (advertised-calling-convention (prefix) "0.8.0"))
+ (and transient-current-command
+ (or (not prefix)
+ (memq transient-current-command (ensure-list prefix)))
+ (oref (transient-prefix-object) scope)))
;;; History