Sunday, March 24, 2019

keyboard - Using Autohotkey for Emacs

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

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...