4

I am trying to bind C-c u and C-c r to winner-mode's undo and redo in my ~/.emacs:

(global-set-key (kbd "C-c u") 'winner-undo)
(global-set-key (kbd "C-c r") 'winner-redo)

However, this doesn't work without (winner-mode 1), which sets up some keybindings. And I don't want any of winner-mode's default keybindings. How can I make my winner-undo and winner-redo work without binding any other keys, preferably without installing other packages?

1 Answer 1

7

How about (setq winner-dont-bind-my-keys t)? The doc-string for that variable states "Non-nil means do not bind keys in Winner mode."

2
  • Works perfectly. Used it just above (winner-mode 1).
    – Xilexio
    Commented Feb 11, 2018 at 23:33
  • 5
    I found this answer with: M-x find-library RET winner RET and i-searching for mode-map, which is a common naming convention for key-binding maps. In this case, it brought me to the winner-mode-map definition and I saw the variable winner-dont-bind-my-keys, and then I just went to the doc-string for that variable. If the library had been loaded beforehand, I could have typed M-x describe-variable or M-x find-variable to inspect the doc-string. If there was no such animal, then we could have unbound each key-binding that was undesired, or set the winner-mode-map to nil; or....
    – lawlist
    Commented Feb 11, 2018 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.