[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient e2fee19879 204/366: Support using variables i
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient e2fee19879 204/366: Support using variables in group and suffix specifications |
Date: |
Tue, 25 Jan 2022 18:54:41 -0500 (EST) |
branch: externals/transient
commit e2fee1987902fb9963c85a62fa680082a878d460
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Support using variables in group and suffix specifications
Re #101.
---
docs/transient.org | 8 ++++++++
lisp/transient.el | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/docs/transient.org b/docs/transient.org
index 404b97b645..cf4ffe3fa2 100644
--- a/docs/transient.org
+++ b/docs/transient.org
@@ -857,6 +857,14 @@ that specify commands and strings. Strings are inserted
verbatim.
The empty string can be used to insert gaps between suffixes, which is
particularly useful if the suffixes are outlined as a table.
+Variables are supported inside group specifications. For example in
+place of a direct subgroup specification, a variable can be used whose
+value is a vector that qualifies as a group specification. Likewise a
+variable can be used where a suffix specification is expected. Lists
+of group or suffix specifications are also supported. Indirect
+specifications are resolved when the transient prefix is being
+defined.
+
The form of suffix specifications is documented in the next node.
*** Suffix Specifications
diff --git a/lisp/transient.el b/lisp/transient.el
index 9ed968e937..f6ff888297 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -889,7 +889,9 @@ example, sets a variable use `transient-define-infix'
instead.
(setq class v)
(push k keys)
(push v keys))))
- (while (vectorp (car args))
+ (while (let ((arg (car args)))
+ (or (vectorp arg)
+ (and arg (symbolp arg))))
(push (pop args) suffixes))
(list (if (eq (car-safe class) 'quote)
(cadr class)
@@ -901,6 +903,12 @@ example, sets a variable use `transient-define-infix'
instead.
(defun transient--parse-child (prefix spec)
(cl-etypecase spec
+ (symbol (let ((value (symbol-value spec)))
+ (if (and (listp value)
+ (or (listp (car value))
+ (vectorp (car value))))
+ (cl-mapcan (lambda (s) (transient--parse-child prefix s))
value)
+ (transient--parse-child prefix value))))
(vector (when-let ((c (transient--parse-group prefix spec))) (list c)))
(list (when-let ((c (transient--parse-suffix prefix spec))) (list c)))
(string (list spec))))
- [elpa] externals/transient 09c911e621 299/366: transient--show-manual: New function, (continued)
- [elpa] externals/transient 09c911e621 299/366: transient--show-manual: New function, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 222637523a 302/366: transient-show-help: Refactor and improve, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient c9ab648e5b 304/366: transient--show-help: Update doc-strings, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 349116159f 308/366: manual: Use Org macros, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient e57d1e176b 313/366: make: Cosmetics, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient daa22e7632 317/366: manual: Downcase keywords, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 1cdadfddf8 340/366: manual: Use source block, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient c2875e705a 362/366: transient--delay-post-command: Add debug statement, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient e0b57679f7 359/366: transient--debug: Re-align output, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 73694be44a 179/366: transient-infix-read: Support use by regular commands, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient e2fee19879 204/366: Support using variables in group and suffix specifications,
Jonas Bernoulli <=
- [elpa] externals/transient 9b17afb9a0 214/366: transient-infix-set: Remove outdated claim from doc-string, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient cbc078d84c 215/366: transient--with-emergency-exit: Re-signal errors directly, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient d555d26004 221/366: transient-format-description(lisp-variable): Return string, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9a1d62699f 222/366: transient-force-fixed-pitch: Fix doc-string, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient d85eb790e8 235/366: transient-read-directory: Pass read value through file-local-name, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 48238bf580 236/366: Allow invoking arbitrary prefixes as non-suffixes, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a3b442243b 241/366: transient-read-{, existing-}file: New functions, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient c4bf4af655 020/366: transient--show-manpage: Fix jumping to argument, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient e4ffb97a68 018/366: transient--layout-member: Match indirect key bindings, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2d8ceff408 185/366: transient-setup: Add emergency exit, Jonas Bernoulli, 2022/01/25