If you enjoyed this site, please consider donating $3. Any amount is appreciated. Thanks!

Emacs, Dvorak, C-x

Xah Lee, 2009-08-05

if you use dvorak with emacs, you may want to change the “Ctrl+x” binding to something else, such as “Ctrl+t” where the t is right under your right hand's middle finger.

There are 2 common solutions offered:

; Make “C-t” act like “C-x”,
; so it's easier to type on Dvorak layout
(keyboard-translate ?\C-t ?\C-x)
; or
(global-set-key (kbd "C-t") ctl-x-map)

Both solutions are not perfect.

Using keyboard-translate means, ALL your “Ctrl+t” keys becomes “Ctrl+x”. This means you lost any keybindings that has a “Ctrl+t” in it.

For example, in outline-mode, “Ctrl+c Ctrl+t” runs hide-body. But now, when you type that, you get “Ctrl+c Ctrl+x” instead.

Solution with ctl-x-map has its own problems.

I often do “Ctrl+x r l” (bookmark-bmenu-list) to get my bookmark list. But if you are in dired, that no longer works. “Ctrl+t r” invokes image-dired-delete-tag.

Also, with cua-mode on, and when you have a text selection, you need to press “Ctrl+x” twice quickly to invoke the traditional “Ctrl+x” role. So, that means you press “Ctrl+t” twice quickly.

One example i'll need to do this many times per day is “Ctrl+t r t” (string-rectangle) and “Ctrl+t r k” for kill-rectangle, where you do need a selection on first.

But now “Ctrl+t Ctrl+t r t” no longer works. It invokes transpose-lines before you finish your key sequence.

Between these 2 solution, i'm not sure in practice which is better. I've been using the keyboard-translate for some 4 years, and didn't really notice any problem. Probably because if there's some binding involving “Ctrl+t” in the middle, it's probably a command rarely used.

With the ctl-x-map solution, within a day i noticed the problem with it in dired and calling rectangle commands. So, i presume keyboard-translate is a more practical solution.

With the above info, perhaps a even better solution is jus to make some function key to do “Ctrl+x”.

So, i'll try

(global-set-key (kbd "<f8>") ctl-x-map)

This solution does not have any of the problems mentioned above, it also does away the cua-mode's problem of needing to type “Ctrl+x” twice quickly. It is probably a good thing for reducing too many complex key presses that starts with “Ctrl+x”.

PS: All these extra personalized fixes creates a lot complications. If emacs developers made the decision to update emacs UI to a modern one, with ZXCV keys for undo/cut/copy/paste, then complications like the above will be much reduced, as compared to individualistic customization that tried to achieves the same thing. This is because when emacs has something out of the box, the implementation is more thoroughly examed at some lower level, i.e. creating much more robustness than individual hacks. The cua-mode itself is a complex hack layed on top of emacs.


2009-08-06

Nicolas Goaziou suggested that the following actually works well:

(keyboard-translate ?\C-t ?\C-x)
(keyboard-translate ?\C-x ?\C-t)

Related essays:

2009-08
© 2009 by Xah Lee.