Variable: transient-substitute-key-function

transient-substitute-key-function is a customizable variable defined in transient.el.

Value

nil

Documentation

Function used to modify key bindings.

This function is called with one argument, the prefix object, and must return a key binding description, either the existing key description it finds in the key slot, or a substitution.

This is intended to let users replace certain prefix keys. It could also be used to make other substitutions, but that is discouraged.

For example, "=" is hard to reach using my custom keyboard layout, so I substitute "(" for that, which is easy to reach using a layout optimized for Lisp.

  (setq transient-substitute-key-function
        (lambda (obj)
          (let ((key (oref obj key)))
            (if (string-match "\\\\`\\\\(=\\\\)[a-zA-Z]" key)
                (replace-match "(" t t key 1)
              key)))))

This variable was added, or its default value changed, in transient version 0.1.0.

Source Code

;; Defined in ~/.emacs.d/elpa/transient-20260414.1009/transient.el
(defcustom transient-substitute-key-function nil
  "Function used to modify key bindings.

This function is called with one argument, the prefix object,
and must return a key binding description, either the existing
key description it finds in the `key' slot, or a substitution.

This is intended to let users replace certain prefix keys.  It
could also be used to make other substitutions, but that is
discouraged.

For example, \"=\" is hard to reach using my custom keyboard
layout, so I substitute \"(\" for that, which is easy to reach
using a layout optimized for Lisp.

  (setq transient-substitute-key-function
        (lambda (obj)
          (let ((key (oref obj key)))
            (if (string-match \"\\\\`\\\\(=\\\\)[a-zA-Z]\" key)
                (replace-match \"(\" t t key 1)
              key)))))"
  :package-version '(transient . "0.1.0")
  :group 'transient
  :type '(choice (const :tag "Transform no keys (nil)" nil) function))