[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient f43aee1a5e 08/41: transient--suffix-prototype
|
From: |
Jonas Bernoulli |
|
Subject: |
[elpa] externals/transient f43aee1a5e 08/41: transient--suffix-prototype: New function |
|
Date: |
Sun, 12 Nov 2023 20:04:07 -0500 (EST) |
branch: externals/transient
commit f43aee1a5e5fe618b3e3c808ba5a0e2b26a96c20
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient--suffix-prototype: New function
This makes it possible to use aliases as suffixes but still share the
settings from the suffix object. Using an alias is necessary when we
want to use the same command to different keys and independently
change only some of the slots inside the prefix definition.
---
lisp/transient.el | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index c7246ee612..d0cdd8ae01 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1364,7 +1364,7 @@ See info node `(transient)Modifying Existing Transients'."
(plist-get plist :command)))))
(defun transient--command-key (cmd)
- (and-let* ((obj (get cmd 'transient--suffix)))
+ (and-let* ((obj (transient--suffix-prototype cmd)))
(cond ((slot-boundp obj 'key)
(oref obj key))
((slot-exists-p obj 'shortarg)
@@ -1523,13 +1523,18 @@ probably use this instead:
(listify-key-sequence (this-command-keys))))
suffixes))
(car suffixes)))
- (and-let* ((obj (get (or command this-command) 'transient--suffix))
+ (and-let* ((obj (transient--suffix-prototype (or command this-command)))
(obj (clone obj)))
(progn ; work around debbugs#31840
(transient-init-scope obj)
(transient-init-value obj)
obj))))
+(defun transient--suffix-prototype (command)
+ (or (get command 'transient--suffix)
+ (seq-some (lambda (cmd) (get cmd 'transient--suffix))
+ (function-alias-p command))))
+
;;; Keymaps
(defvar-keymap transient-base-map
@@ -1945,7 +1950,7 @@ value. Otherwise return CHILDREN as is."
(apply class :level level args)
(unless (and cmd (symbolp cmd))
(error "BUG: Non-symbolic suffix command: %s" cmd))
- (if-let ((proto (and cmd (get cmd 'transient--suffix))))
+ (if-let ((proto (and cmd (transient--suffix-prototype
cmd))))
(apply #'clone proto :level level args)
(apply class :command cmd :level level args)))))
(cond ((not cmd))
@@ -3071,7 +3076,7 @@ The last value is \"don't use any of these switches\"."
Use this if you want to share an infix's history with a regular
stand-alone command."
(cl-letf (((symbol-function #'transient--show) #'ignore))
- (transient-infix-read (get command 'transient--suffix))))
+ (transient-infix-read (transient--suffix-prototype command))))
;;;; Readers
- [elpa] externals/transient updated (a8829875b2 -> 3cd1de1695), Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient f769486803 02/41: Tweak some docstrings, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 59d602a2e8 05/41: transient--refreshp: New variable, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 92572454b5 06/41: transient-toggle-level-limit: New command, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 8098d17518 13/41: transient--make-predicate-map: Fix handling of transient-suffix, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 10d590dc55 07/41: transient-echo-arguments: Also echo command keys, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient f43aee1a5e 08/41: transient--suffix-prototype: New function,
Jonas Bernoulli <=
- [elpa] externals/transient 9a7eb0d9a3 09/41: transient--make-predicate-map: Use define-key exclusively, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 67671e1ac0 12/41: transient--make-predicate-map: Rearrange pcase cases, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 5e841bb24b 19/41: transient-infix-set(argument): Replace :around with :after method, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient c6e3891537 21/41: transient-infix-set(argument): Cosmetics, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 425003a44b 22/41: transient-infix-set(argument): Limit to other arguments, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 8d8df0f038 20/41: transient-infix-set(argument): Cosmetics, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 9d9e931996 25/41: transient--shadowed-buffer: Renamed from transient--current-buffer, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 8e15a29b59 31/41: transient-format-description: Support function as value of face slot, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 533578b6b2 32/41: transient-information: Use a space as the fake key, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 59d8c0342a 18/41: transient--unset-incompatible: Remove unnecessary variable, Jonas Bernoulli, 2023/11/12