unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Aaron Culich <aculich@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: swapping C-x and C-j reliably for ergonomic reasons
Date: Sun, 20 Feb 2011 08:25:39 -0800	[thread overview]
Message-ID: <878vxak70c.wl%aaron@danzig> (raw)
In-Reply-To: <4d611405.0673e50a.0a3b.3a48SMTPIN_ADDED@mx.google.com>

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	other threads:[~2011-02-20 16:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4d611405.0673e50a.0a3b.3a48SMTPIN_ADDED@mx.google.com>
2011-02-20 16:25 ` Aaron Culich [this message]
2011-02-22 15:49   ` swapping C-x and C-j reliably for ergonomic reasons Le Wang
2011-02-23 15:14     ` Aaron Culich
2011-02-18 17:57 Le Wang
2011-02-20 10:44 ` Bernardo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878vxak70c.wl%aaron@danzig \
    --to=aculich@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).