From: Jonas Bernoulli Date: Sat, 29 Jun 2024 12:06:12 +0000 (+0200) Subject: Update to Transient v0.7.2-4-gf75bc48d X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=10e414eb0409af5baee021c3a13bf2ae91d6a2ab;p=emacs.git Update to Transient v0.7.2-4-gf75bc48d (cherry picked from commit 5f3d964e397edd807c544f42a6db6b068a20c912) --- diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi index 407b55ee017..22db4e82143 100644 --- a/doc/misc/transient.texi +++ b/doc/misc/transient.texi @@ -1208,7 +1208,10 @@ prefix's @code{transient--layout} property, but it is often more convenient to use the same form as understood by @code{transient-define-prefix}, described below. If you use the latter approach, you can use the @code{transient-parse-suffixes} and @code{transient-parse-suffix} functions to -transform them from the convenient to the expected form. +transform them from the convenient to the expected form. Depending +on the used group class, @code{transient-parse-suffixes}'s SUFFIXES must be +a list of group vectors (for @code{transient-columns}) or a list of suffix +lists (for all other group classes). If you explicitly specify children and then transform them using @code{:setup-children}, then the class of the group is determined as usual, @@ -1220,6 +1223,32 @@ For backward compatibility, if you fail to do so, @code{transient-column} is used and a warning is displayed. This warning will eventually be replaced with an error. +@lisp +(transient-define-prefix my-finder-by-keyword () + "Select a keyword and list matching packages." + ;; The real `finder-by-keyword' is more convenient + ;; of course, but that is not the point here. + [:class transient-columns + :setup-children + (lambda (_) + (transient-parse-suffixes + 'my-finder-by-keyword + (let ((char (1- ?A))) + (mapcar ; a list ... + (lambda (partition) + (vconcat ; of group vectors ... + (mapcar (lambda (elt) + (let ((keyword (symbol-name (car elt)))) + ; ... where each suffix is a list + (list (format "%c" (cl-incf char)) + keyword + (lambda () + (interactive) + (finder-list-matches keyword))))) + partition))) + (seq-partition finder-known-keywords 7)))))]) +@end lisp + @item The boolean @code{:pad-keys} argument controls whether keys of all suffixes contained in a group are right padded, effectively aligning the diff --git a/lisp/transient.el b/lisp/transient.el index 805b0acd6f3..312ed540f73 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2550,7 +2550,10 @@ value. Otherwise return CHILDREN as is." (transient--pop-keymap 'transient--redisplay-map) (setq transient--redisplay-map new) (transient--push-keymap 'transient--redisplay-map)) - (transient--redisplay))))))) + (transient--redisplay))))) + (setq transient-current-prefix nil) + (setq transient-current-command nil) + (setq transient-current-suffixes nil))) (defun transient--post-exit (&optional command) (transient--debug 'post-exit) @@ -2573,9 +2576,6 @@ value. Otherwise return CHILDREN as is." (remove-hook 'pre-command-hook #'transient--pre-command) (remove-hook 'post-command-hook #'transient--post-command) (advice-remove 'recursive-edit #'transient--recursive-edit)) - (setq transient-current-prefix nil) - (setq transient-current-command nil) - (setq transient-current-suffixes nil) (let ((resume (and transient--stack (not (memq transient--exitp '(replace suspend)))))) (unless (or resume (eq transient--exitp 'replace))