For the past several weeks, I've experienced an erratic and hard-to-diagnose behavior: the C-g
key binding sometimes doesn't work. Strangely, this problem doesn't affect alternative bindings of keyboard-quit
. For example, if I bind keyboard-quit
to M-q
, when C-g
doesn't trigger this command, M-q
still triggers it.
Because this happens only sometimes and in ways that are hard to predict, bisecting my config file can be very time-consuming. I will do that as a measure of last resort, but I was wondering if anyone has ideas of what might be going on, so I can explore these first. Thanks.
C-g
still bound tokeyboard-quit
? – NickD Mar 08 '24 at 23:29keyboard-quit
and only one of them is erratic under the same circumstances, then the only explanation I can think of is that your keyboard is flaky. Have you tried another keyboard? – NickD Mar 08 '24 at 23:46Yes,
– Pablo Mar 08 '24 at 23:57C-g
is bound tokeyboard-quit
. But whenC-g
doesn't work, it is not recognized as a key event. For instance,C-h k C-g
does nothing (whereas whenC-g
does work,C-h k C-g
shows thekeyboard-quit
binding). I know this is very weird behavior, but it is what I'm experiencing.transient-quit-one
, which is by default bound toC-g
intransient-base-map
. When this mode is active, e.g. after invokingmagit-status
,C-g
will often fail to triggertransient-quit-one
. But if I re-bind it toM-q
, that key sequence will always work. I don't think I ever experienced such puzzling behavior in Emacs before. – Pablo Mar 09 '24 at 00:15keyboard-quit
withedebug
and see if Emacs stops there every time you pressC-g
orM-q
. At least that will tell you whether you get to the command every time. Do that in a throw-away session: you probably don't want to do that in your working Emacs. – NickD Mar 09 '24 at 17:21C-g
but always when I pressM-q
, in line with the behavior described previously.
– Pablo Mar 09 '24 at 19:04keyboard-quit
seems like a red herring at this point; I think this issue is instead only related to theC-g
key sequence, since it also affectstransient-quit-one
and any other command bound to it. E.g. after evaluating(define-key (current-global-map) (kbd "C-g") #'emacs-version)
the Emacs version is shown only sometimes after pressingC-g
.