Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not exactly sure if there is a technical term for this, but is it possible in Emacs to completely swap two sets of keybindings for all modes? I want to make it so that regardless of mode, for example, C-t will do what C-x is supposed to do, and vice versa. If I use the normal way of assigning a function to a keyboard shortcut, such as with global-set-key the binding can be overwritten by any modes that I turn on. I feel like I read about Emacs being able to do this a long time ago, but I don't remember what to search for.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can translate a key or key sequence into another one early on in the input process. For example, here's how to switch C-x and C-t everywhere:

(define-key key-translation-map "\C-t" "\C-x")
(define-key key-translation-map "\C-x" "\C-t")
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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