I asked a question about an Autohotkey script I am using for emacs (in Cygwin) to remap the Ctrl and Alt keys. Here is the question: https://stackoverflow.com/q/15899963/1243435.
One way I have been testing my script is to open up emacs and use the C-h k
feature which shows documentation for a key sequence. It allows me to confirm whether Autohotkey is doing what I expect.
However it seems that there are some complications, for instance it may be that the Cygwin terminal does not allow the sequence C-M-SPC
to 'get through' to emacs, so emacs actually only receives C-SPC
instead.
My question is thus: does Autohotkey have its own test facility which shows you what Autohotkey is receiving and sending when you press a few key combinations on your keyboard? If yes I would be able to confirm that my script is working fine or not, and then decide whether it is some other issue that is causing me problems in getting key sequences through to emacs.
Update based on answer suggested by Armin
On the suggestion from Armin, below is what I see in the AHK view screen after doing the following:
- mouse-click in the Cygwin window to activate it (I already have emacs running in there),
- press LeftAlt+h then k which I know AHK will convert into
C-h k
, this being the 'tell me what the next keyboard sequence means' in emacs, - at the emacs help prompt press Left Win+Left Alt+SPACE,
- see that emacs shows me the documentation for
C-M-@
(which is also bound to the key sequenceC-M-SPC
by the way), - mouse-click back in the AHK view window and refresh with F5.
Here is the relevant section of the output in the AHK window (modulo a bit of shortening of the longer lines to stop word-wrapping here):
VK SC Type Up/Dn Elapsed Key Window
----------------------------------------------------------
A4 038 h d 4.18 LAlt /cygdrive/c/...
A4 038 i u 0.00 LAlt
A2 01D i d 0.00 LControl
48 023 d 0.09 H
48 023 u 0.09 H
A4 038 h u 0.05 LAlt
A2 01D i u 0.00 LControl
4B 025 d 1.22 K
4B 025 u 0.06 K
A4 038 h d 1.12 LAlt
A4 038 i u 0.00 LAlt
A2 01D i d 0.00 LControl
5B 15B h d 0.02 LWin
A4 038 i d 0.00 LAlt
20 039 d 0.19 Space
20 039 u 0.06 Space
5B 15B h u 0.16 LWin
A4 038 i u 0.00 LAlt
A4 038 h u 0.00 LAlt
A2 01D i u 0.01 LControl
74 03F d 1.90 F5 C:\...\AutoHotkey.ahk ...
It shows a lot of things going on.
My understanding is that this proves that AHK is correctly converting my Left Alt+Left Win+SPACE to C-M-SPC
.
Below is an explanation of why I think the proof is done.
Here is me pressing LAlt down, and it being converted into a down of LCtrl
:
A4 038 h d 4.18 LAlt /cygdrive/c/...
A4 038 i u 0.00 LAlt
A2 01D i d 0.00 LControl
(but I am not sure what that u
of LAlt
is in the middle -- AHK explains that 'i=Ignored because it was generated by an AHK script').
Next is me pressing and releasing h:
48 023 d 0.09 H
48 023 u 0.09 H
so at this point emacs has received C-h
.
Next I release LAlt, then press and release k.
A4 038 h u 0.05 LAlt
A2 01D i u 0.00 LControl
4B 025 d 1.22 K
4B 025 u 0.06 K
Emacs now goes into the help prompt for 'describe key sequence'.
Then I next press down on LAlt
and we see that AHK sends d
signals for LCtrl
(and again there is that 'ignored' u
of LAlt
on the second line which I wouldn't have expected), then I press down on LWin and AHK sends a d
of LAlt
and then I press down on SPACE:
A4 038 h d 1.12 LAlt
A4 038 i u 0.00 LAlt
A2 01D i d 0.00 LControl
5B 15B h d 0.02 LWin
A4 038 i d 0.00 LAlt
20 039 d 0.19 Space
Finally comes the sequence where I release all those LAlt+LWin+SPACE and we see that AHK sends u
signals for Space
and LAlt
and LCtrl
:
20 039 u 0.06 Space
5B 15B h u 0.16 LWin
A4 038 i u 0.00 LAlt
A4 038 h u 0.00 LAlt
A2 01D i u 0.01 LControl
Last is when I refresh the data in the AHK view window after having mouse-clicked to activate it:
74 03F d 1.90 F5 C:\...\AutoHotkey.ahk ...
That seems to prove that my AHK script has done what I hoped.
Only remaining issue is that mysterious u
of an LAlt
that cropped up twice.
Any ideas?