From eebcbe306cfd8d4ac5803333a44d83fe456e3e13 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Tue, 17 Dec 2024 21:40:09 +0100 Subject: [PATCH] Support including a top-level group from a variable The first prefixes to use this are `magit-{log,diff}{,-refresh}', which see. --- lisp/transient.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/transient.el b/lisp/transient.el index eec49ce..58dddce 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1206,6 +1206,16 @@ commands are aliases for." (setq level (pop spec))) (when (stringp (car spec)) (setq args (plist-put args :description (pop spec)))) + ;; Merge value of [... GROUP-VARIABLE], if any. + (let ((spec* spec)) + (while (keywordp (car spec*)) + (setq spec* (cddr spec*))) + (when (and (length= spec* 1) (symbolp (car spec*))) + (let ((rest (append (symbol-value (car spec*)) nil)) + (args nil)) + (while (keywordp (car rest)) + (setq args (nconc (list (pop rest) (pop rest)) args))) + (setq spec (nconc args (butlast spec) rest))))) (while (keywordp (car spec)) (let* ((key (pop spec)) (val (if spec (pop spec) (error "No value for `%s'" key))))