branch: externals/transient commit 3e22fdf61120cd4e504c85ecd9171d871cd7d900 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
transient--insert-suffix: Support forcing to keep other bindings Closes #355. --- docs/transient.org | 6 ++++-- docs/transient.texi | 6 ++++-- lisp/transient.el | 11 ++++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/transient.org b/docs/transient.org index cfcf8b92e0..c32822cc13 100644 --- a/docs/transient.org +++ b/docs/transient.org @@ -864,8 +864,10 @@ that tree are not objects but have the form {{{codevar((LEVEL CLASS PLIST))}}}, they are never active at the same time, see [[*Predicate Slots]]. Unfortunately both false-positives and false-negatives are possible. - To deal with the former use non-~nil~ {{{var(KEEP-OTHER.)}}} To deal with the - latter remove the conflicting binding explicitly. + To deal with the former use non-~nil~ {{{var(KEEP-OTHER.)}}} The symbol ~always~ + prevents the removal of a false-positive in some cases where other + non-~nil~ values would fail. To deal with false-negatives remove the + conflicting binding separately, using ~transient-remove-suffix~. - Function: transient-replace-suffix prefix loc suffix :: diff --git a/docs/transient.texi b/docs/transient.texi index 4ecb592547..80dc4511e3 100644 --- a/docs/transient.texi +++ b/docs/transient.texi @@ -1019,8 +1019,10 @@ that multiple suffix commands can be bound to the same key, provided they are never active at the same time, see @ref{Predicate Slots}. Unfortunately both false-positives and false-negatives are possible. -To deal with the former use non-@code{nil} @var{KEEP-OTHER@.} To deal with the -latter remove the conflicting binding explicitly. +To deal with the former use non-@code{nil} @var{KEEP-OTHER@.} The symbol @code{always} +prevents the removal of a false-positive in some cases where other +non-@code{nil} values would fail. To deal with false-negatives remove the +conflicting binding separately, using @code{transient-remove-suffix}. @end defun @defun transient-replace-suffix prefix loc suffix diff --git a/lisp/transient.el b/lisp/transient.el index 4ceef83a22..d368c8b957 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1459,7 +1459,8 @@ Intended for use in a group's `:setup-children' function." suffix prefix loc "suffixes and groups cannot be siblings")) (t - (when-let* ((bindingp (listp suf)) + (when-let* (((not (eq keep-other 'always))) + (bindingp (listp suf)) (key (transient--spec-key suf)) (conflict (car (transient--layout-member key prefix))) (conflictp @@ -1487,7 +1488,9 @@ LOC is a command, a key vector, a key description (a string as returned by `key-description'), or a coordination list (whose last element may also be a command or key). Remove a conflicting binding unless optional KEEP-OTHER is - non-nil. + non-nil. When the conflict appears to be a false-positive, + non-nil KEEP-OTHER may be ignored, which can be prevented + by using `always'. See info node `(transient)Modifying Existing Transients'." (declare (indent defun)) (transient--insert-suffix prefix loc suffix 'insert keep-other)) @@ -1502,7 +1505,9 @@ LOC is a command, a key vector, a key description (a string as returned by `key-description'), or a coordination list (whose last element may also be a command or key). Remove a conflicting binding unless optional KEEP-OTHER is - non-nil. + non-nil. When the conflict appears to be a false-positive, + non-nil KEEP-OTHER may be ignored, which can be prevented + by using `always'. See info node `(transient)Modifying Existing Transients'." (declare (indent defun)) (transient--insert-suffix prefix loc suffix 'append keep-other))