Skip to content

Commit

Permalink
transient--parse-suffix: Ensure generated names are unique
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tarsius committed Aug 30, 2024
1 parent 2312c37 commit b54af9e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lisp/transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b54af9e

Please sign in to comment.