[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 544b3bb864 057/366: Support automatically dis
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 544b3bb864 057/366: Support automatically disabling incompatible arguments |
Date: |
Tue, 25 Jan 2022 18:54:26 -0500 (EST) |
branch: externals/transient
commit 544b3bb864438b23eb0dc7a1af2254f7bf4f200c
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Support automatically disabling incompatible arguments
---
lisp/transient.el | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index a1460c02e4..fe94416078 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -411,7 +411,8 @@ If `transient-save-history' is nil, then do nothing."
(man-page :initarg :man-page :initform nil)
(info-manual :initarg :info-manual :initform nil)
(transient-suffix :initarg :transient-suffix :initform nil)
- (transient-non-suffix :initarg :transient-non-suffix :initform nil))
+ (transient-non-suffix :initarg :transient-non-suffix :initform nil)
+ (incompatible :initarg :incompatible :initform nil))
"Transient prefix command.
Each transient prefix command consists of a command, which is
@@ -2172,6 +2173,8 @@ prompt."
;;;; Set
+(defvar transient--unset-incompatible t)
+
(cl-defgeneric transient-infix-set (obj value)
"Set the value of infix object OBJ to value.")
@@ -2179,9 +2182,25 @@ prompt."
"Set the value of infix object OBJ to value.
This implementation should be suitable for almost all infix
-commands. It simply calls `oset'."
+commands."
(oset obj value value))
+(cl-defmethod transient-infix-set :around ((obj transient-infix) value)
+ "Unset incompatible infix arguments."
+ (if-let ((sic transient--unset-incompatible)
+ (arg (oref obj argument))
+ (spec (oref transient--prefix incompatible))
+ (incomp (remove arg (cl-find-if (lambda (elt) (member arg elt))
spec))))
+ (progn
+ (cl-call-next-method)
+ (dolist (arg incomp)
+ (when-let ((obj (cl-find-if (lambda (obj)
+ (equal (oref obj argument) arg))
+ transient--suffixes)))
+ (let ((transient--unset-incompatible nil))
+ (transient-infix-set obj nil)))))
+ (cl-call-next-method)))
+
(cl-defmethod transient-set-value ((obj transient-prefix))
(oset (oref obj prototype) value (transient-args))
(transient--history-push obj))
- [elpa] externals/transient 7e45a57ec8 030/366: No longer depend on lv to display the transient buffer, (continued)
- [elpa] externals/transient 7e45a57ec8 030/366: No longer depend on lv to display the transient buffer, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 625683c9ea 029/366: transient--pre-exit: Don't reselect original window, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a2dada29c8 034/366: manual: Add a FAQ, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a2222d294c 038/366: transient-base-map: New parent of other shared keymaps, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient b1da0cab5d 040/366: Remove my personal key bindings, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient bbf81297c6 041/366: Prevent infix commands from being added to command-history, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a6295fa7ee 042/366: Declare that prefix and suffix commands are for interactive use only, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2872b4a661 045/366: transient-init-value: Define for transient-prefix, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a47ae9499b 049/366: transient-{set, save}: Support exiting the transient, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9e30038d2d 051/366: transient-set-level: Limit when it is called, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 544b3bb864 057/366: Support automatically disabling incompatible arguments,
Jonas Bernoulli <=
- [elpa] externals/transient 28aac32e82 058/366: Fix previous commit, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4f7ee36899 060/366: transient-infix-set: Bugfixes, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 7a7c3e15b6 065/366: transient-show-popup: Support even suppressing one-line summary, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient d7a1e81440 067/366: transient-show-popup: Update documentation, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 5a360bb206 090/366: Remove conflicting suffix when inserting new suffix, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4ce1868e62 091/366: Fix replacing a suffix with another suffix bound to same key, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 52fb9a6c07 093/366: transient--insert-suffix: Cosmetics, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4adc28538b 069/366: transient--window: Unset when exiting transient, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient af8d725d26 073/366: transient--original-window: New variable, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4ef8229feb 082/366: transient--buffer-name: New variable, Jonas Bernoulli, 2022/01/25