From 04f87b4ab3c7448a78f452cadaaf5d9e7a216d1d Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Tue, 19 Sep 2023 23:46:25 +0200 Subject: [PATCH] transient-{set,save}-and-exit: New commands Actually they are just aliases. The separate entries in `transient-predicate-map' is what makes the different. These are intended for use in, e.g., `magit-diff-refresh' and `magit-log-refresh', which use specialized classes whose `transient-set-value' and `transient-save-value' additionally refresh the buffer containing the diff/log. I.e., there this commands serve as variants of `magit-refresh', and all these commands are expected to exit the transient. Previously these transients instead bound `transient-set-value' to "s" and `transient-save-value' to "w", and explicitly set their `transient' slot to nil, but that was surprising because that also causes the regular "C-x s" and "C-x C-s" bindings to behave that way. --- lisp/transient.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index 26183576..38b044d0 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1626,7 +1626,9 @@ of the corresponding object." "" #'transient--do-stay "" #'transient--do-stay "" #'transient--do-call + "" #'transient--do-exit "" #'transient--do-call + "" #'transient--do-exit "" #'transient--do-call "" #'transient--do-stay "" #'transient--do-stay @@ -2655,15 +2657,21 @@ transient is active." (transient-undefined)))) (defun transient-set () - "Save the value of the active transient for this Emacs session." + "Set active transient's value for this Emacs session." (interactive) (transient-set-value (or transient--prefix transient-current-prefix))) +(defalias 'transient-set-and-exit 'transient-set + "Set active transient's value for this Emacs session and exit.") + (defun transient-save () - "Save the value of the active transient persistenly across Emacs sessions." + "Save active transient's value for this and future Emacs sessions." (interactive) (transient-save-value (or transient--prefix transient-current-prefix))) +(defalias 'transient-save-and-exit 'transient-save + "Save active transient's value for this and future Emacs sessions and exit.") + (defun transient-reset () "Clear the set and saved values of the active transient." (interactive)