I'm trying to run M-=
on a region of text, but nothing happens. I think the shortcut is registered (I don't get a message like "M-=
is undefined") but the execution stops for some reason and there is no output.
If I run the command that the shortcut is bound to manually, count-words-region
, it works fine. It also works if I type Esc =
.
I added (global-set-key (kbd "M-=") 'count-words-region)
to my initialization file, just to be sure that it is bound, but no effect. In fact, even if I bind some other function to M-=
, pressing it has no effect.
I suspected that a recent update of the desktop environment might have redefined M-=
(I'm using KDE), but currently nothing seems to be bound to that key.
How to debug this?
Update. If I run M-=
through xev
, I get the following output:
Alt pressed:
KeyPress event, serial 40, synthetic NO, window 0x5800001,
root 0x1c9, subw 0x0, time 3737607, (61,104), root:(1461,133),
state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
= pressed:
FocusOut event, serial 40, synthetic NO, window 0x5800001,
mode NotifyGrab, detail NotifyAncestor
FocusOut event, serial 40, synthetic NO, window 0x5800001,
mode NotifyUngrab, detail NotifyPointer
FocusIn event, serial 40, synthetic NO, window 0x5800001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 40, synthetic NO, window 0x0,
keys: 4294967241 0 32 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
= released:
KeyRelease event, serial 40, synthetic NO, window 0x5800001,
root 0x1c9, subw 0x0, time 3738919, (61,104), root:(1461,133),
state 0x8, keycode 21 (keysym 0x3d, equal), same_screen YES,
XLookupString gives 1 bytes: (3d) "="
XFilterEvent returns: False
Alt released:
KeyRelease event, serial 40, synthetic NO, window 0x5800001,
root 0x1c9, subw 0x0, time 3739829, (61,104), root:(1461,133),
state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Does this mean the shortcut is handled by another process and how to find out which one?
xev
to check what key is actually being sent, plus I'd look very closely at the KDE keyboard shortcut settings to see if the update added a binding for that key(lookup-key global-map (kbd "M-="))
say? But it sounds like something (e.g. your window mgr) is preventing Emacs from seeing that key. Be sure you test starting fromemacs -Q
, to remove other stuff in your init file from the equation.count-words-region
.xev
. See the update.