2

I have always used C-g (ie keyboard-quit) to break out of commands like M-x and C-x C-f. At some point not too long ago this stopped working. All that happens is that Quit flashes in the minibuffer but I still have the previous command waiting for input there. I now have to do Esc Esc Esc (keyboard-escape-quit) or C-] (abort-recursive-edit) to break out of these minibuffer command.

Has the way keyboard-quit works changed? Or was C-g bound to a different function in past versions? It happens even when I start with emacs -Q so it should not be a problem of my configuration.

I am using graphical emacs-25.1.1 on Ubuntu-MATE 17.04.


update

I have found that C-g still works as expected when running emacs in the console, ie emacs -nw using the same emacs-25.1.1 executable as below that does not work in graphical mode.

Furthermore C-h k C-g brings up help for keyboard-quit in the console but causes a Quit message to appear in the minibuffer (without breaking out of the C-h kcommand) in graphical mode. However, C-h f keyboard-quit brings up the the help page which does say that it is bound to C-g

Daniel Mahler
  • 267
  • 1
  • 12
  • For me C-g is mapped to `keyboard-quit` on Emacs 25.2. If you type counsel-describe-binds and enter C-g, it will show you what command you are executing with that key-stroke. – eflanigan00 Jul 10 '17 at 23:43
  • I've actually noticed this same issue recently and was wondering the same thing – Doctor David Anderson Jul 11 '17 at 05:31
  • Which version of Emacs are you using, and how are you defining "the not too distant past"? – phils Jul 11 '17 at 07:22
  • @phils I am on 25.1.1. I think it C-g used to work in 24 or at least 23. – Daniel Mahler Jul 11 '17 at 18:02
  • FWIW, C-g is working perfectly with -Q and 25.2.1 on a Mac. What OS etc. are you using? Graphical or terminal Emacs? – stevoooo Jul 11 '17 at 18:36
  • @stevoooo Graphical Emacs on Ubuntu-MATE 17.04 – Daniel Mahler Jul 12 '17 at 01:48
  • 1
    Is this with the gtk build? Have you tried the lucid one? https://packages.ubuntu.com/zesty/emacs25-lucid – npostavs Jul 27 '17 at 23:03
  • @npostavsit is the gtk build, specifically `GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)`. What is lucid? – Daniel Mahler Jul 27 '17 at 23:56
  • @npostavsit I can confirm that emacs25-lucid also behaves correctly. I am still interested in understanding the gtk problem, but emacs25-lucid seems to solve the practical side of the problem. – Daniel Mahler Jul 28 '17 at 00:27
  • Did you try hitting C-g multi times? What happens if you toggle debug on quit? – YoungFrog Jul 28 '17 at 10:17
  • @YoungFrog hitting C-g multiple times just causes the Quit msg to reappear. Never actually quits the minibuffer. Have not tried debug-on-quit yet. – Daniel Mahler Jul 28 '17 at 18:38
  • 1
    Looks like https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26289 which was closed as unreproducible. I suggest doing a `M-x report-emacs-bug` to let the maintainers know that this is still a problem and that you are willing to assist in debugging, and perhaps referencing the old bug number. – Peder Klingenberg Jul 28 '17 at 22:30
  • I have 2 experiments for you: 1) Does C-g behavior work when using emacs -Q - 2) Have you tried using daemon, and comparing the exact same running process and comparing the results between terminal and GUI ? – Joafigue Aug 02 '17 at 00:27
  • I've just checked the behaviour of `C-g`on Emacs 25.094.2 for Windows, and it works as expected. The 'quit' message you see with `C-h k C-g` appears to be quitting the help command, rather than completing the command. Do you have anything in your `~/.emacs` file that could possibly be interfering? Try renaming your `~/.emacs` file and see what happens. – Andomonir Aug 02 '17 at 03:34
  • I'm facing the exact same problem in Emacs 24.5.1 and 25.3.2 on Ubuntu 16.04.3 – tfischbach Mar 09 '18 at 09:25
  • @tfischbach switching to emacs-lucid as suggested by npostavs above solved the problem for me. I also find the lucid interface more responsive and generally preferable. Should really be the default IMO. – Daniel Mahler Mar 09 '18 at 09:32
  • @npostavs if you make your emacs-lucid suggestion into an answer I will accept it. – Daniel Mahler Mar 09 '18 at 09:33
  • @DanielMahler thanks for the suggestion, but emacs-lucid appears to have the same problem on my machine. – tfischbach Mar 09 '18 at 12:56

2 Answers2

3

This appears to be some kind of bug related to the GTK graphical toolkit. Switching to the Lucid build reportedly avoids the problem. For more about the difference between those toolkits, see my answer to On Linux why should one choose Lucid over Gtk gui for emacs?.


If someone experiencing this problem could debug it and find out the reason why it happens, that would also be interesting, as currently no Emacs devs are able to reproduce it (even when using the GTK build), cf Bug#26289.

npostavs
  • 9,033
  • 1
  • 21
  • 53
1

I have observed the same thing on ubuntu 16.04.

however I also noticed that ESC ESC ESC does work for quitting the minibuffer.

Toby
  • 11
  • 1