Subject: bug#7261: emacsclient ignores keyboard-translate in .emacs

From: Chong Yidong <[email-masked]>
Date: Wed, 18 Jul 2012 21:27:25 +0800

[email-masked] writes:

> ;; ; Make “C-t” act like “C-x”,
> ;; ; so it's easier to type on Dvorak layout
> (keyboard-translate ?\C-t ?\C-x)
> (keyboard-translate ?\C-x ?\C-t)
>
> If I start emacs normally then the keys are translated. If I start
> emacsclient with 
>
> GDK_NATIVE_WINDOWS=1 emacsclient --alternate-editor="" -c 
>
> Then the keys are not translated on startup, but I can translate them
> by opening my .emacs file and running eval-region

keyboard-translate only acts on the current terminal, since
keyboard-translate-table is a terminal-local variable.  I will update
the docstring to make this clearer.

What you probably want is to do something like

(add-hook 'after-make-frame-functions
	  (lambda (f) (with-selected-frame f
			  (keyboard-translate ?\C-t ?\C-x))))