From 08b27a62c4772ede8d5c012b18f1e8c20d384c5b Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Fri, 18 Oct 2024 19:40:41 +0200 Subject: [PATCH] transient--init-transient: New function --- lisp/transient.el | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index 38f817a..686ef62 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2074,8 +2074,7 @@ EDIT may be non-nil." (edit ;; Returning from help to edit. (setq transient--editp t))) - (transient--init-objects name layout params) - (transient--init-keymaps) + (transient--init-transient name layout params) (transient--history-init transient--prefix) (setq transient--original-window (selected-window)) (setq transient--original-buffer (current-buffer)) @@ -2093,6 +2092,18 @@ value. Otherwise return CHILDREN as is." (funcall (oref group setup-children) children) children)) +(defun transient--init-transient (&optional name layout params) + (unless name + ;; Re-init. + (if (eq transient--refreshp 'updated-value) + ;; Preserve the prefix value this once, because the + ;; invoked suffix indicates that it has updated that. + (setq transient--refreshp (oref transient--prefix refresh-suffixes)) + ;; Otherwise update the prefix value from suffix values. + (oset transient--prefix value (transient-get-value)))) + (transient--init-objects name layout params) + (transient--init-keymaps)) + (defun transient--init-keymaps () (setq transient--predicate-map (transient--make-predicate-map)) (setq transient--transient-map (transient--make-transient-map)) @@ -2306,14 +2317,7 @@ value. Otherwise return CHILDREN as is." (transient--pop-keymap 'transient--predicate-map) (transient--pop-keymap 'transient--transient-map) (transient--pop-keymap 'transient--redisplay-map) - (if (eq transient--refreshp 'updated-value) - ;; Preserve the prefix value this once, because the - ;; invoked suffix indicates that it has updated that. - (setq transient--refreshp (oref transient--prefix refresh-suffixes)) - ;; Otherwise update the prefix value from suffix values. - (oset transient--prefix value (transient-get-value))) - (transient--init-objects) - (transient--init-keymaps) + (transient--init-transient) (transient--push-keymap 'transient--transient-map) (transient--push-keymap 'transient--redisplay-map) (transient--redisplay))