Grupy dyskusyjne Google nie obsługują już nowych postów ani subskrypcji z Usenetu. Treści historyczne nadal będą dostępne.

how to change C-x prefix to C-k in a clean way?

5 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

Xah Lee

nieprzeczytany,
6 mar 2009, 22:27:556.03.2009
do
is there a way to remap all the C-x key to another, say C-k?

I've been using this
(keyboard-translate ?\C-t ?\C-x)
for over 2 years (on dvorak. Dvorak t is qwerty k.)

However, that does not stop C-x from working, and any keypress of C-k,
regardless if it is the start of combination, will be remapped to C-x.

What i really want is to remap C-x prefix to C-k, as if they are
defined that way. (so that i can map Cut (kill-region) to C-x and not
have to load the complex cua-mode)

besides modifying every elisp file, is it possible to do this as a
wrapper? Perhaps by modifying the global-map entry of C-x?

Xah
http://xahlee.org/


Teemu Likonen

nieprzeczytany,
7 mar 2009, 00:21:387.03.2009
do
On 2009-03-06 19:27 (-0800), Xah Lee wrote:

> is there a way to remap all the C-x key to another, say C-k?

I think it's simply

(global-set-key (kbd "C-k") ctl-x-map)

See (info "(elisp) Prefix Keys")

Xah Lee

nieprzeczytany,
7 mar 2009, 18:19:167.03.2009
do

that doesn't seems to work though.

I was excited for a moment, then it turns out not working.
When you do C-h v, it still consider C-x a prefix even if you set it
to nil...

Xah
http://xahlee.org/


Michael Heerdegen

nieprzeczytany,
8 mar 2009, 11:05:438.03.2009
do
Xah Lee <xah...@gmail.com> writes:

Is that what you want?

(keyboard-translate ?\C-k ?\C-x)
(global-set-key [my-C-x] 'ignore) ;bind like any other key
(keyboard-translate ?\C-x 'my-C-x)

Alan Mackenzie

nieprzeczytany,
10 mar 2009, 09:02:5510.03.2009
do
In comp.emacs Xah Lee <xah...@gmail.com> wrote:

> On Mar 6, 9:21?pm, Teemu Likonen <tliko...@iki.fi> wrote:
>> On 2009-03-06 19:27 (-0800), Xah Lee wrote:

>> > is there a way to remap all the C-x key to another, say C-k?

>> I think it's simply

>> ? ? (global-set-key (kbd "C-k") ctl-x-map)

>> See (info "(elisp) Prefix Keys")

> that doesn't seems to work though.

> I was excited for a moment, then it turns out not working.
> When you do C-h v, it still consider C-x a prefix even if you set it
> to nil...

After that, bind C-x to whatever you want in the global map. Repeat
for all other existing keymaps (mapatoms and keymap-p are your friends).

Then you want to transform keybindings starting "\C-x.." in libraries
you'll load later into "\C-k..". The best way here would be to add
advice to `define-key', but this routine's written in C. Maybe the way
to go here would be to change the name string "define-key" in keymap.c
into, say, "xl-define-key", then write a "(defun define-key ...)" as a
wrapper around it.

And after that, remember to use `xl-define-key' for your own bindings.

Whether you want this badly enough to go through all this hassle is
another matter altogether. ;-)

> Xah

--
Alan Mackenzie (Nuremberg, Germany).

Johan Bockgård

nieprzeczytany,
10 mar 2009, 14:42:1910.03.2009
do
Alan Mackenzie <a...@muc.de> writes:

> Then you want to transform keybindings starting "\C-x.." in libraries
> you'll load later into "\C-k..". The best way here would be to add
> advice to `define-key', but this routine's written in C.

That's not a problem.

Raoul Gough

nieprzeczytany,
10 mar 2009, 18:50:4310.03.2009
do
Alan Mackenzie <a...@muc.de> writes:

> In comp.emacs Xah Lee <xah...@gmail.com> wrote:
>> On Mar 6, 9:21?pm, Teemu Likonen <tliko...@iki.fi> wrote:
>>> On 2009-03-06 19:27 (-0800), Xah Lee wrote:
>
>>> > is there a way to remap all the C-x key to another, say C-k?
>
>>> I think it's simply
>
>>> ? ? (global-set-key (kbd "C-k") ctl-x-map)
>
>>> See (info "(elisp) Prefix Keys")
>
>> that doesn't seems to work though.
>
>> I was excited for a moment, then it turns out not working.
>> When you do C-h v, it still consider C-x a prefix even if you set it
>> to nil...
>
> After that, bind C-x to whatever you want in the global map. Repeat
> for all other existing keymaps (mapatoms and keymap-p are your friends).

I started off down that path once, because I wanted C-j to work like
C-x in all modes. However, I now do it like this instead:

(keyboard-translate ?\C-j ?\C-x) ;; Make C-j do C-x for easier typing

To get the kill-region bound to C-x in all cases, I think you'd just
have to do this:

(keyboard-translate ?\C-x ?\M-w)

In my case, choosing C-j was actually a little unfortunate, because in
some modes the original meaning of C-j is useful (mainly when it has a
meaning distinct from ENTER). I probably should have gone with C-k,
but now I'm used to C-j I don't want to change :-)

[followups set to comp.emacs only]

--
Raoul Gough.

rustom

nieprzeczytany,
11 mar 2009, 11:36:3511.03.2009
do
On Mar 7, 8:27 am, Xah Lee <xah...@gmail.com> wrote:
> is there a way to remap all the C-x key to another, say C-k?
>
> I've been using this
> (keyboard-translate ?\C-t ?\C-x)
> for over 2 years (on dvorak. Dvorak t is qwerty k.)

Just curious Xah -- Do you use Dvorak primarily for speed or for RSI
related problems?

Xah Lee

nieprzeczytany,
11 mar 2009, 17:31:3111.03.2009
do

i learned dvorak in 1992 or 1993. More or less due to my nerdiness
towards better design. I don't have typing speed problem nor RSI in
anyway.

In 1991 or 1992 i was employed as a secretary or data entry clerk,
typing qwerty about 75 wpm (test result from hiring agency). I took a
month to learn dvorak during a job break, but by happenstance have
never worked as a secretary since. My typing speed never improved
much. In fact, slower, maybe 60wpm for the next 5 or so years, because
i didn't have a need to type intensively as a job as before. The
significantly noticeable thing is the comfort. I didn't realize it
until in late 1990s, when sometimes i had to go back to qwerty as a
sys admin, and the first thing to note is that the fingers jump
wildly.

first use of emacs is maybe 1998, and in a month or so become daily
user. (so, my emacs experience is all dvorak) First 6 years of emacs
using is exclusively terminal based. In fact resisted installing X11
when a colleague seems to want it to run emacs. Didn't start to use
GUI emacs till 2005.

did pick up some qwerty touch typing again somewhat again in 2002. My
qwerty touch typing speed is probably less than 30wpm, and maybe up to
50wpm if given 1 hour daily practice over a week. Current dvorak
speed, according to websites, is anywhere from 80 to over 100wpm.

i read extensively on dvorak. In the early 1990s, it'ss books in
library (notably Mavis Beacon Teaches Typing). Since late 1990s,
online info. I don't think there is a notable site about dvorak,
keyboard, keyboard layouts, RSI, alternative input devices, that i
have not read.

Xah
http://xahlee.org/

Rustom Mody

nieprzeczytany,
12 mar 2009, 09:40:1412.03.2009
do help-gn...@gnu.org
<Xah wrote>

> i learned dvorak in 1992 or 1993. More or less due to my
> nerdiness towards better design. I don't have typing speed
> problem nor RSI in anyway.

I guess anyone using/working with/working on emacs has to be almost by
definition a productivity-junkie starting with rms, going on to the
fancy modes for programming and sysad support of the last couple of
decades and today's hot stuff like org, icicles etc.

I toyed with the idea of trying dvorak for a while but then somehow
came to the conclusion that it does not go far enough. You see dvorak
was invented in the age of mechanical typewriters which had two
fundamental assumptions (or invariants in programmerese)
1. The typist can type only 1 key at a time
2. One (key)stroke generates exactly 1 letter

Obviously neither of these is a necessary assumption today though both
are universally assumed.

Well 1. has the exceptions like Ctrl/Alt/Shift but these are very
minor exceptions if you compare them with the possibilities of
full-scale chording which you may appreciate as a pianist! A
simplistic estimate of this being: 10 fingers -> 26 letters means
(partial) functions from a 10 element set to a 26 element set, which
is 27 raised to 10 (thats a number in trillions!) This is way more
chords than any reasonable sized dictionary and hence every word could
be in principle 1 single chord, ie keystroke. Even if this set is
pruned many billions of times for eliminating inconvenient/impossible
chords. Nevertheless the hundred most frequent words of English (
http://en.wikipedia.org/wiki/Most_common_words_in_English ) could
easily be assigned one unique chord and that would mean 1-stroke
1-word (strangely comes back to Chinese by a back door).

Ive not gone into this more because even simple keyboard hackery like
flipping Ctrl and CapsLock causes so many problems in practice that
full scale converting of a qwerty keyboard into a 'piano' is a little
technically daunting.

So let me go on to point 2 which (I hope!) is more feasible and
productive -- in a word abbrevs. Evidently even adding a few dozen
abrevs for the most commonly used words that we use in some context
would significantly reduce typing.

But trying to explore this further Ive started studying the alphabetic
shorthand called keyscript [ http://www.freewebs.com/cassyjanek ]
It has a whole system of shorthanding English into ASCII with some
fair amount of 'logic'.
Here is a taste (though not the logic) :

One letter abbrevs for the most common words
b = but
c = with
d = had
e = this
f = of
g = that
h = the
j = which
n = and
...etc etc upto
z = was

then common phrases
able to = cb
had been = dn
do not = dx
did not = ex
does not = dsx
etc

and a few dozen other abbrevs like

become = bc
better = bee
before = bf
being = bg
below = bl
consequences = csqa
unfortunately = nxf
same = sa
said = sd
such = sc
statement = ztx
sufficient = sfj


> The significantly noticeable thing is the comfort. I didn't realize
> it until in late 1990s, when sometimes i had to go back to qwerty
> as a sys admin, and the first thing to note is that the fingers
> jump wildly.

I am sure you can see that the 'wild jumping' you describe as reducing
from QWERTY to dvorak would reduce very significantly with such a
system -- dont you think?

The only problem is that -- as a confirmed productivity junkie -- I
realise that working very hard to become more productive is a surefire
way of doing no real work!! Ive spent about 3 weeks on this and I am
really sweating!


prad

nieprzeczytany,
12 mar 2009, 13:45:4612.03.2009
do help-gn...@gnu.org
On Wed, 11 Mar 2009 14:31:31 -0700 (PDT)
Xah Lee <xah...@gmail.com> wrote:

> i learned dvorak in 1992 or 1993. More or less due to my nerdiness
> towards better design.
>

dvorak is excellent! (so's xah's site btw)
i decided to learn dvorak just when i found i was getting good at
qwerty (after several years of chicken pecking with 2 fingers).
conceptually, it makes far more sense than qwerty and it only takes a
bit of time to adapt - after which you are 'literally flying'!

--
In friendship,
prad

... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's


B. T. Raven

nieprzeczytany,
16 mar 2009, 01:18:5116.03.2009
do

Your modest proposal is brilliant in some as yet to be specified way.
The only problem I see with it is if it has to be read aloud. For
example, nxf e dsx bc bee if read out loud should probably be spelled
out in full. So, since so much time and space is saved by abbreviating
words, there will be a concomitant opportunity to actually expand the
individual letters, as in areeeayeellellwye
essdoubleyoueeayeteeeyeengee! The only thing I am not sure of is whether
that 26^10 (~141 trillion)is even close to being equal to c(26,1) +
C(26,2)+ .... C(26,10). But it doesn't matter. The few hundred key
combos in the repertoir of even the most accomplished power user is a
tiny fraction of those potentially available by combining modifiers
(Shift, Control, Meta, Alt, Super, Hyper) with the other fifty-some keys
within easy reach. For instance, I just queried the binding of C-H-M-s-^
and found that it was undefined. Surprise, surprise.

Still Xah is right about Dvorak. It's about 10% faster and 30% less
taxing. (Numbers grabbed out of the air that seem about right.)

rustom

nieprzeczytany,
16 mar 2009, 09:17:0516.03.2009
do
> Your modest proposal is brilliant in some as yet to be specified way.
> The only problem I see with it is if it has to be read aloud. For
> example, nxf e dsx bc bee if read out loud should probably be spelled
> out in full.
Well in normal English we are used to ough having 10s of
pronunciations see
http://en.wikipedia.org/wiki/Ough_(combination)

> So, since so much time and space is saved by abbreviating
> words, there will be a concomitant opportunity to actually expand the
> individual letters, as in areeeayeellellwye
> essdoubleyoueeayeteeeyeengee!
Heh Heh!

> The only thing I am not sure of is whether
> that 26^10 (~141 trillion)is even close to being equal to c(26,1) +
> C(26,2)+ .... C(26,10). But it doesn't matter. The few hundred key
> combos in the repertoir of even the most accomplished power user is a
> tiny fraction of those potentially available by combining modifiers
> (Shift, Control, Meta, Alt, Super, Hyper) with the other fifty-some keys
> within easy reach. For instance, I just queried the binding of C-H-M-s-^
> and found that it was undefined. Surprise, surprise.

I dont get this point. Running English uses no C/Meta/Alt/Super/Hyper
and their use is hardly claimed to be very efficient for typing. (vi
may be less general/customizable etc but is more ergonomic than emacs)
And as someone said (is it Xah?) typing perl is not at all correlated
to typing English


>
> Still Xah is right about Dvorak. It's about 10% faster and 30% less
> taxing. (Numbers grabbed out of the air that seem about right.)

My specific (personal) problem is this:
It is certain that the amortized benefit of learning dvorak will beat
qwerty and keyscript correspondingly improves over dvorak.

But to reap that amortized benefit one needs to assume an infinite
life to offset the time (and essdoubleyoueeayetee !)

Xah Lee

nieprzeczytany,
20 mar 2009, 00:07:3320.03.2009
do
On Mar 16, 6:17 am, rustom <rustompm...@gmail.com> wrote:
> > Your modest proposal is brilliant in some as yet to be specified way.
> > The only problem I see with it is if it has to be read aloud. For
> > example, nxf e dsx bc bee if read out loud should probably be spelled
> > out in full.
>
> Well in normal English we are used to ough having 10s of
> pronunciations seehttp://en.wikipedia.org/wiki/Ough_(combination)


Hi Rustom,

Some sort of shorthand writing can indeed improve one's typing of
natural language by a lot. I haven't studied any particular shorthand
system, my impression is that there are quite a few.

( indeed, Wikipedia lists about 40.http://en.wikipedia.org/wiki/
Shorthand )

shorthand systems are designed for professional dictation clerk or
similar. Shorthand system has little offer specific to emacs for
improving speed of writing natural lang or programing. (abbrev system
and templates (e.g. yasnippet) are much more useful)

also, there are several chording systems or chording keyboards over
the past decades. In general, they are not practical. Some of them are
envisioned to replace the standard keyboard, but they have their own
problems. The first adoption problem is that chording system requires
learning to use, while keyboard doesn't. For vast majority of
computer users, hunt & peck works well because they don't have a need
to type much. Note that Wikipedia also has a few articles on the
various chording keyboards.http://en.wikipedia.org/wiki/
Chorded_keyboard

from a research point of view, one could imagine a input device that's
radical and so well designed, so that it takes ergonomics from the
ground up, where the hardware naturally fits the shape and movement of
human hand, and uses perhaps chording chord chording. And perhaps
comes with a fancy integrated pointing device. And perhaps uses a
software layout (of the chording) based on a shorthand systems, and
for various programing languages too... often, radical general
solution as innovation without a immediate, concrete, specific problem
it solves, is not likely to become adopted anytime soon.

(PS thanks Rustom for the email notice. Sorry for the delay in
replying. Also, thanks Alan Mackenzie et al. I haven't yet studied
your advices in detail. )

Xah
http://xahlee.org/


Rustom Mody

nieprzeczytany,
20 mar 2009, 03:49:0220.03.2009
do help-gn...@gnu.org

Hi Xah.
I guess my own post was a bit rambling so my point was a bit lost and some other stuff got emphasised.
I was saying more or less what you are saying -- viz
chording systems are (probably) fantastic research ideas but too impractical.

yasnippet (templates in general) are useful for programming languages.

And for plain text abbrevs are probably best.

My suggestion is for an *alphabetic shorthand system*  viz abbrevs.

Well here is a small suggestion (request?) for you
Youve done a lot of analysis of emacs keystrokes and you have a huge site of stuff.
Would you try running the McIllroy classic on your site?
http://www.unix.com/unix-dummies-questions-answers/42789-searching-displaying-most-commonly-used-words.html
This will do for words the same analysis that you've already done for keystrokes.

I think -- just guesses -- you will get figures like this:

Top frequency 24 words (or 26 since I expect 'I' and 'a' to occur there) -- 30 %
Next 100 words    -- 35 %
Next 500 words -- 30 %

Assuming you do get something like this, setting up 125 abbrevs and taking say 2 weeks to learn them, will it not make your typing almost halved. [I am assuming that the average length of even common English words is about 3.5 chars whereas the average length of these abbrevs will be about 1.5 (1.25 if you take weighted averages, 1.1 if you add common phrases).

On Mar 16, 10:18 am, "B. T. Raven" <ni...@nihilo.net> wrote:
> Your modest proposal is brilliant in some as yet to be specified way.

Yes it is brilliant. (I of course did not invent it, its from   http://www.freewebs.com/cassyjanek )
My 'specified way' of analyzing this brilliance is thusly:

Compression (as in gzip LZ jpeg etc) has some key ideas
a. Huffmann coding
b. Length encoding
c. Right amt of lossiness

This lady (without evidently any background in CS!! ) has taken these ideas and made a system that migrates these ideas from the digital 2-it (aka bit) world to the 26-it biological box atop our shoulders.

Now what I am trying to do is burn some new firmware (and sweating with the heat!!)

Rupert Swarbrick

nieprzeczytany,
20 mar 2009, 06:53:0120.03.2009
do
rustom <rusto...@gmail.com> writes:
>
> My specific (personal) problem is this:
> It is certain that the amortized benefit of learning dvorak will beat
> qwerty and keyscript correspondingly improves over dvorak.
>
> But to reap that amortized benefit one needs to assume an infinite
> life to offset the time (and essdoubleyoueeayetee !)

Well, I dunno. I reckon it was a month or so until I was faster typing
dvorak than qwerty. I switched to "learn to type properly": I'd worked
out touch typing on my own with qwerty and, although it was quick, I was
heavily favouring my left hand and was having RSI problems.

If you do decide to switch, I recommend printing out a paper "fake
keyboard" to rest somewhere in view of the screen and to avoid looking
at the keyboard at all. This seems to be the quickest way to get
competent. However, an unexpected side-effect has been that I still
don't actually know where any dvorak characters are without pretending
to put my fingers on the home row...

As far as using qwerty keyboards afterwards goes, I don't have any
problem typing (once I realise that what I was trying to do is producing
gibberish!), but keyboard shortcuts take some more thought. I wouldn't
want to use qwerty emacs nowadays!


Rupert

Nowe wiadomości: 0