Skip to content

Commit

Permalink
; Revert parts of "Use string-replace instead of replace-regexp-in-st…
Browse files Browse the repository at this point in the history
…ring"

"transient.el" is also distributed as a separate package, which
supports Emacs versions as old as 25.1 (see "Package-Requires").
  • Loading branch information
tarsius committed Oct 25, 2021
1 parent 214c2e2 commit 40400e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lisp/transient.el
Expand Up @@ -3064,18 +3064,18 @@ Optional support for popup buttons is also implemented here."
((equal (seq-take seq len) transient--redisplay-key)
(let ((pre (key-description (vconcat (seq-take seq len))))
(suf (key-description (vconcat (seq-drop seq len)))))
(setq pre (string-replace "RET" "C-m" pre))
(setq pre (string-replace "TAB" "C-i" pre))
(setq suf (string-replace "RET" "C-m" suf))
(setq suf (string-replace "TAB" "C-i" suf))
(setq pre (replace-regexp-in-string "RET" "C-m" pre t))
(setq pre (replace-regexp-in-string "TAB" "C-i" pre t))
(setq suf (replace-regexp-in-string "RET" "C-m" suf t))
(setq suf (replace-regexp-in-string "TAB" "C-i" suf t))
;; We use e.g. "-k" instead of the more correct "- k",
;; because the former is prettier. If we did that in
;; the definition, then we want to drop the space that
;; is reinserted above. False-positives are possible
;; for silly bindings like "-C-c C-c".
(unless (string-match-p " " key)
(setq pre (string-replace " " "" pre))
(setq suf (string-replace " " "" suf)))
(setq pre (replace-regexp-in-string " " "" pre))
(setq suf (replace-regexp-in-string " " "" suf)))
(concat (propertize pre 'face 'default)
(and (string-prefix-p (concat pre " ") key) " ")
(transient--colorize-key suf cmd)
Expand Down

0 comments on commit 40400e6

Please sign in to comment.