unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* swapping C-x and C-j reliably for ergonomic reasons
@ 2011-02-18 17:57 Le Wang
  2011-02-20 10:44 ` Bernardo
  0 siblings, 1 reply; 5+ messages in thread
From: Le Wang @ 2011-02-18 17:57 UTC (permalink / raw)
  To: GNU Emacs List

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

Hi,

I do this from my .emacs.el:

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


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, has anyone else noticed something similar?

-- 
Le

[-- Attachment #2: Type: text/html, Size: 851 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: swapping C-x and C-j reliably for ergonomic reasons
  2011-02-18 17:57 Le Wang
@ 2011-02-20 10:44 ` Bernardo
  0 siblings, 0 replies; 5+ messages in thread
From: Bernardo @ 2011-02-20 10:44 UTC (permalink / raw)
  To: GNU Emacs List

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)
> 
> 
> 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.
guess the "lossage" (C-h l) doesn't reveal much in such a case?

> 
> 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

i don't use this kind of customisation, but recently when one of my 
ergonomic keyboards wore out i looked for a keyboard where (the right) 
CTRL key is easily reached while my right index finger rests on the J 
key; it turned out that small keyboards were much better in that sense; 
(i'm reasonably happy with "mobile keyboard 6000" but would encourage 
anyone taking this path to do their own testing)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: swapping C-x and C-j reliably for ergonomic reasons
       [not found] <4d611405.0673e50a.0a3b.3a48SMTPIN_ADDED@mx.google.com>
@ 2011-02-20 16:25 ` Aaron Culich
  2011-02-22 15:49   ` Le Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Aaron Culich @ 2011-02-20 16:25 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: swapping C-x and C-j reliably for ergonomic reasons
  2011-02-20 16:25 ` swapping C-x and C-j reliably for ergonomic reasons Aaron Culich
@ 2011-02-22 15:49   ` Le Wang
  2011-02-23 15:14     ` Aaron Culich
  0 siblings, 1 reply; 5+ messages in thread
From: Le Wang @ 2011-02-22 15:49 UTC (permalink / raw)
  To: Aaron Culich; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

On Mon, Feb 21, 2011 at 12:25 AM, Aaron Culich <aculich@gmail.com> wrote:

> > (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


I'm not sure what you mean by this.  It works like a champ most of the time.
 My issue is that C-j registers as the original binding occasionally.  It
gets fixed right away without me doing anything, i.e. C-j registers as C-j,
then C-_C-j registers as C-x.

-- 
Le

[-- Attachment #2: Type: text/html, Size: 812 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: swapping C-x and C-j reliably for ergonomic reasons
  2011-02-22 15:49   ` Le Wang
@ 2011-02-23 15:14     ` Aaron Culich
  0 siblings, 0 replies; 5+ messages in thread
From: Aaron Culich @ 2011-02-23 15:14 UTC (permalink / raw)
  To: Le Wang; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]

On Tue, Feb 22, 2011 at 7:49 AM, Le Wang <l26wang@gmail.com> wrote:

> On Mon, Feb 21, 2011 at 12:25 AM, Aaron Culich <aculich@gmail.com> wrote:
>
>> > (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
>
>
> I'm not sure what you mean by this.  It works like a champ most of the
> time.  My issue is that C-j registers as the original binding occasionally.
>  It gets fixed right away without me doing anything, i.e. C-j registers as
> C-j, then C-_C-j registers as C-x.
>

It seems I messed something up the first time I tried evaling your
keyboard-translate code. When I tried it again just now it worked, so I
don't know what I did wrong before. I'm not sure why the C-j sometimes
registers incorrectly and then fixes itself, but if you can consistently
reproduce the problem, then I would suggest checking the value of
keyboard-translate-table to see if it is getting changed in some way. Maybe
in some situations it gets made into a buffer-local variable and set to nil?
At least that could be one reasonable explanation.

-Aaron


>
>
-- 
> Le
>

[-- Attachment #2: Type: text/html, Size: 2078 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-23 15:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4d611405.0673e50a.0a3b.3a48SMTPIN_ADDED@mx.google.com>
2011-02-20 16:25 ` swapping C-x and C-j reliably for ergonomic reasons Aaron Culich
2011-02-22 15:49   ` Le Wang
2011-02-23 15:14     ` Aaron Culich
2011-02-18 17:57 Le Wang
2011-02-20 10:44 ` Bernardo

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).