Update to Transient v0.7.2-4-gf75bc48d

This commit is contained in:
Jonas Bernoulli 2024-06-29 14:06:12 +02:00
parent 2d8881d526
commit 5f3d964e39
No known key found for this signature in database
GPG key ID: 230C2EFBB326D927
2 changed files with 34 additions and 5 deletions

View file

@ -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}, to use the same form as understood by @code{transient-define-prefix},
described below. If you use the latter approach, you can use the described below. If you use the latter approach, you can use the
@code{transient-parse-suffixes} and @code{transient-parse-suffix} functions to @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 If you explicitly specify children and then transform them using
@code{:setup-children}, then the class of the group is determined as usual, @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 is used and a warning is displayed. This warning will eventually
be replaced with an error. 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 @item
The boolean @code{:pad-keys} argument controls whether keys of all suffixes The boolean @code{:pad-keys} argument controls whether keys of all suffixes
contained in a group are right padded, effectively aligning the contained in a group are right padded, effectively aligning the

View file

@ -2550,7 +2550,10 @@ value. Otherwise return CHILDREN as is."
(transient--pop-keymap 'transient--redisplay-map) (transient--pop-keymap 'transient--redisplay-map)
(setq transient--redisplay-map new) (setq transient--redisplay-map new)
(transient--push-keymap 'transient--redisplay-map)) (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) (defun transient--post-exit (&optional command)
(transient--debug 'post-exit) (transient--debug 'post-exit)
@ -2573,9 +2576,6 @@ value. Otherwise return CHILDREN as is."
(remove-hook 'pre-command-hook #'transient--pre-command) (remove-hook 'pre-command-hook #'transient--pre-command)
(remove-hook 'post-command-hook #'transient--post-command) (remove-hook 'post-command-hook #'transient--post-command)
(advice-remove 'recursive-edit #'transient--recursive-edit)) (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 (let ((resume (and transient--stack
(not (memq transient--exitp '(replace suspend)))))) (not (memq transient--exitp '(replace suspend))))))
(unless (or resume (eq transient--exitp 'replace)) (unless (or resume (eq transient--exitp 'replace))