branch: externals/transient
commit b54af9e4c40c5fea6781d0279b99ed788c9d8edd
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    transient--parse-suffix: Ensure generated names are unique
    
    Two suffixes may share a common description.  They may even share the
    description and the key binding, without also sharing the definition
    (though that only makes sense if they don't also share the predicate).
    
    To ensure the names are unique, include `gensym-counter' in the name.
    
    A drawback of that is, that if the prefix definition is evaluated
    multiple times, we also get multiple definitions for each suffix that
    gets such a generated name.
    
    Give up on including the description in the name and remove whitespace
    from the key before including it in the name.
---
 lisp/transient.el | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index baf49a500f..c7358f99a8 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1191,13 +1191,9 @@ commands are aliases for."
              (not (stringp car)))
         (let ((cmd pop)
               (sym (intern
-                    (format "transient:%s:%s"
-                            prefix
-                            (let ((desc (plist-get args :description)))
-                              (if (and (stringp desc)
-                                       (length< desc 16))
-                                  desc
-                                (plist-get args :key)))))))
+                    (format "transient:%s:%s:%d" prefix
+                            (replace-in-string (plist-get args :key) " " "")
+                            (prog1 gensym-counter (cl-incf gensym-counter))))))
           (setq args (plist-put
                       args :command
                       `(prog1 ',sym

Reply via email to