2
1
I am using emacs in Cygwin and have used Autohotkey to re-map the lefthand 'Alt' key and the lefthand 'Windows' key to be (left)Ctrl and (left)Alt respectively.
This means that an emacs sequence like Ctrl-xCtrl-c is done with my left thumb pressing on the key labelled 'Alt' to produce the Ctrl. Ok.
All seems okay except that I cannot get M-SPC to work, so my question is to ask for help on that.
Here is the Autohotkey script I am using (by the way it is only for theoretical completeness that I re-map the lefthand Ctrl key to be the lefthand Windows button -- I have never actually pressed it when using emacs):
#IfWinActive ahk_class mintty
LWin::LAlt
LAlt::LCtrl
LCtrl::LWin
To be clear, when I say 'all is ok' I mean that within emacs I use the 'describe key sequence' feature (C-h then k) and then try out the key combination I want. For example, all of these show the emacs documentation for the sequence I expected:
- Key labelled 'Alt' + g reports emacs documentation for
C-g
. Good. - Key labelled 'Alt' + SPACE reports the documentation for
C-@
, which emacs says is also mapped toC-SPC
, so that seems okay. Good. - Key labelled 'MSWin Symbol' + x reports documentation for
M-x
. Good. - Key labelled 'MSWin Symbol' + key labelled 'Alt'+ k reports documentation for
C-M-k
. Good.
But:
- Key labelled 'MSWin Symbol' + SPACE shows me the 'right-click' menu for the cygwin window rather than taking me to the documentation for
M-SPC
. Bad. - By the way, I can get to the documentation for
M-SPC
by instead doing ESC followed by SPACE.
Let me add another point which has come up in the process of reacting to comments on this question:
- Key labelled 'MSWin Symbol' + key labelled 'Alt'+ SPACE takes me to the documentation for
C-@
, so I suspect it is being understood by emacs as C-SPC rather than as C-M-SPC as I thought my Autohotkey script would map it to. Bad.
Any ideas on why Autohotkey won't do the M-SPC
as I would expect, or why C-M-SPC is understood by emacs as a C-SPC
(I suspect)?
Thanks
Funnily enough, in another SO question that I am involved in (see the first comment in http://stackoverflow.com/a/15884328/1243435), Thomas mentions that C-M-SPC can be problematic in some terminals and explains that for him it does exactly what I am seeing here -- it produces a right-click menu for the terminal itself.
– Robert – 2013-04-09T14:02:19.283that's quite a weird remapping... Most people who do remap CTRL remap it to CAPS-LOCK. Also quite some expensive keyboards come with CTRL in place of CAPS-LOCK (which is where CTRL was on older keyboards btw), like the Happy Hacking Pro 2 for example. Note that if you're touch typing you'll find CTRL-x quite hard to do correctly, no matter where you put CTRL, so you can use Emacs and ctl-x-map to remap all the "C-x ..." shortcuts to something else (I'm using C-, instead of C-x). – user988052 – 2013-04-10T03:01:02.280
On my MacBook at home the CMD key sits next to the space-bar, ie. exactly where the Alt key is on my PC keyboard. On the MacBook the CMD key is often used in circumstances where Ctrl would be used on a PC. I got to like it. I did try the pinkie remapping of using the PC's CAPS-LOCK as the Ctrl but that hurts! My poor little finger was aching! Rather, with the PC's Alt as Ctrl you just tuck your (stronger) thumb under the arch of your fingers and bingo! there is Ctrl. Nicer, I think. On this one I would claim that Apple got the layout right (let's not discuss their placement of '#'). – Robert – 2013-04-10T08:08:47.473
You're complaining about "Key labelled 'Alt' + SPACE" being misunderstood; but you've made it clear that the Windows logo key is your Meta, so you should amend this to say "Key labelled 'MSWin Symbol' + SPACE". Unless I've really misunderstood something (not hard to do when you're talking about shifting so many keys around!) – echristopherson – 2013-04-11T21:01:24.817
@echristoperson You are right. I am about to correct that. Thank you. – Robert – 2013-04-17T16:31:23.817