Function: cider--define-deprecated-key

cider--define-deprecated-key is a byte-compiled function defined in cider-util.el.

Signature

(cider--define-deprecated-key MAP KEY COMMAND REPLACEMENT &optional SINCE)

Documentation

In keymap MAP bind KEY to COMMAND, marking it a deprecated alias.

KEY is a kbd string. Triggering it runs COMMAND as usual, but also hints once per session (subject to cider-warn-on-deprecated-keybindings) that REPLACEMENT - a human-readable description of the new binding - should be used instead. SINCE is the CIDER version the deprecation started in.

This is how CIDER retires a binding gradually: the old key keeps working throughout the deprecation window, then is removed in a later release.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-util.el
(defun cider--define-deprecated-key (map key command replacement &optional since)
  "In keymap MAP bind KEY to COMMAND, marking it a deprecated alias.
KEY is a `kbd' string.  Triggering it runs COMMAND as usual, but also hints
once per session (subject to `cider-warn-on-deprecated-keybindings') that
REPLACEMENT - a human-readable description of the new binding - should be used
instead.  SINCE is the CIDER version the deprecation started in.

This is how CIDER retires a binding gradually: the old key keeps working
throughout the deprecation window, then is removed in a later release."
  ;; Keyed by the key-string alone (not the map): the user-facing listing wants
  ;; one entry per key, and today each key is deprecated in a single map.
  (setq cider--deprecated-keybindings
        (cons (list :key key :command command :replacement replacement :since since)
              (seq-remove (lambda (e) (equal (plist-get e :key) key))
                          cider--deprecated-keybindings)))
  (define-key map (kbd key)
    (lambda ()
      (interactive)
      (cider--warn-deprecated-key key replacement)
      ;; Present the wrapped command (not this anonymous alias) as
      ;; `this-command', so commands that inspect it see themselves.
      (setq this-command command)
      (call-interactively command))))