From 5a41cd581e051fb5acf0444b02b926070073b89f Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Sat, 10 Aug 2024 11:36:16 -0700 Subject: [PATCH] transient-active-prefix: Accept symbol or list of symbols --- CHANGELOG | 5 +++++ docs/transient.org | 6 +++--- docs/transient.texi | 6 +++--- lisp/transient.el | 8 ++++---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ae5379d..3d6eff4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,9 @@ # -*- mode: org -*- +* v0.7.6 UNRELEASED + +- ~transient-active-prefix~ now accepts a single prefix symbol, in place + of a list of such symbols. #307 + * v0.7.5 2024-09-01 - Updated tooling. diff --git a/docs/transient.org b/docs/transient.org index 3de1775..c00ca6b 100644 --- a/docs/transient.org +++ b/docs/transient.org @@ -1308,9 +1308,9 @@ function, which for infix arguments serves about the same purpose as is current, this function is also suitable for use in asynchronous code, such as timers and callbacks (this function's main use-case). - If optional PREFIXES is non-~nil~, it must be a list of prefix command - symbols, in which case the active transient object is only returned - if it matches one of the PREFIXES. + If optional PREFIXES is non-~nil~, it must be a prefix command symbol + or a list of symbols, in which case the active transient object is + only returned if it matches one of the PREFIXES. ** Transient State #+cindex: transient state diff --git a/docs/transient.texi b/docs/transient.texi index 02ff00f..a69e8d0 100644 --- a/docs/transient.texi +++ b/docs/transient.texi @@ -1510,9 +1510,9 @@ that is run directly by a command that is invoked while a transient is current, this function is also suitable for use in asynchronous code, such as timers and callbacks (this function's main use-case). -If optional PREFIXES is non-@code{nil}, it must be a list of prefix command -symbols, in which case the active transient object is only returned -if it matches one of the PREFIXES@. +If optional PREFIXES is non-@code{nil}, it must be a prefix command symbol +or a list of symbols, in which case the active transient object is +only returned if it matches one of the PREFIXES@. @end defun @node Transient State diff --git a/lisp/transient.el b/lisp/transient.el index 787f15a..8be07d0 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1593,13 +1593,13 @@ that is run directly by a command that is invoked while a transient is current, this function is also suitable for use in asynchronous code, such as timers and callbacks (this function's main use-case). -If optional PREFIXES is non-nil, it must be a list of prefix command -symbols, in which case the active transient object is only returned -if it matches one of the PREFIXES." +If optional PREFIXES is non-nil, it must be a prefix command symbol +or a list of symbols, in which case the active transient object is +only returned if it matches one of PREFIXES." (and transient--showp transient--prefix (or (not prefixes) - (memq (oref transient--prefix command) prefixes)) + (memq (oref transient--prefix command) (ensure-list prefixes))) (or (memq 'transient--pre-command pre-command-hook) (and (memq t pre-command-hook) (memq 'transient--pre-command