After a recent update to my Spacemacs install, I noticed that C-g i.e. keyboard-quit closes *compilation* buffers that result from an M-x recompile. How can I prevent this behavior? I don't want C-g to close *compilation* buffers.

  • Sounds like a Spacemacs bug, if you see the same thing without your init file (emacs -Q). If you think so, consider reporting it to the Spacemacs maintainers. – Drew Feb 25 at 22:37
  • @Drew It's in fact a Spacemacs "feature", not a bug. lol. C-g would rebind to pupo/close-window in spacemacs settings. How to disable this feature/bug still needs some diggings though. Ref – TerryTsao Feb 26 at 2:10
  • @TerryTsao: I see. Maybe that info would help as an answer or part of an answer? (And it still sounds like a bug, in the sense that C-g in Emacs is generally about canceling an action, but not quitting a window - sounds unusual, in any case. – Drew Feb 26 at 5:38
  • @Drew I'm still quite new to Elisp. After a quick scan, I couldn't figure out how to disable this behavior, since I'm not familiar with the relevant packages popwin, window-purpose etc. You are making a valid point: C-g shouldn't do anything but quit. However, I myself enjoy this feature/bug quite a lot. (Another reason I'm not familiar with how it works, since for me, it just works). Maybe edit the tags (popwin?) to attract the right person? – TerryTsao Feb 26 at 5:50
  • @Drew I might have found out how to disable this. Trying on my setting now. – TerryTsao Feb 26 at 6:06

The culprit turned out to be popwin. I fixed it with M-x customize-group RET popwin RET and removing compilation-mode from the "Popwin Special Display Config" list.

  • Much better than my hack. 😂 – TerryTsao Feb 27 at 2:46

Try this:

(defun revert-spacemacs-C-g-doing (func &rest r)
  "Revert rebind of `keyboard-quit' from calling
  (apply func r)
  (global-set-key [remap keyboard-quit] nil))

(advice-add 'pupo/after-display :around 'revert-spacemacs-C-g-doing)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.