[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: swapping C-x and C-j reliably for ergonomic reasons

From: Aaron Culich
Subject: Re: swapping C-x and C-j reliably for ergonomic reasons
Date: Sun, 20 Feb 2011 08:25:39 -0800
User-agent: Emacs 23.2/Mule 6.0 (HANACHIRUSATO)

Le Wang said the following on 19/02/11 04:57:
> Hi,
> I do this from my .emacs.el:
> (keyboard-translate ?\C-x ?\C-j)
> (keyboard-translate ?\C-j ?\C-x)

The keyboard-translate command doesn't do quite what you expect of it. It
merely sets the keyboard-translate-table variable that represents the ASCII
table, so what happens is that the ASCII character 10 (LF) gets swapped with
the ASCII character 24 (CAN). You can run 'C-h v keyboard-translate-table' to
check that yourself.

To accomplish what you want to do you can use:

(global-set-key "\C-j" ctl-x-map)
(global-set-key "\C-x" 'newline-and-indent)

> This is part of my ongoing effort to use Emacs more ergonomically.  It works
> most of the time, however, ocassionally when I press C-j,
> `newline-and-indent' still runs.  I haven't put my finger on the exact
> sequences of events that cause this.
> My Emace environment is heavily customized, so any number of things could be
> causing this.  It seems from the wiki and blogs that this swap is quite
> common among power users

reply via email to

[Prev in Thread] Current Thread [Next in Thread]