I have a weirdly specific way I like to organize my windows when working with C, and where emacs opens the compilation window really bugs me. I try to close it and switch another window to the *compilation* buffer, but for some reason the kill-window command also kills the buffer. Is there a way to avoid this? Or am I just doing this in a really asinine way?

  • 4
    I don't have a kill-window command but try delete-window; it shouldn't kill the buffer.
    – amitp
    Feb 18 '19 at 16:19
  • @amitp no luck, still kills the buffer
    – user189728
    Feb 18 '19 at 16:25
  • Are you using any sticky buffers, like treemacs or sr speedbar?
    – A_P
    Feb 18 '19 at 16:46
  • 1
    also post the result of C-h v ignore-window-parameters
    – A_P
    Feb 18 '19 at 16:47
  • @A_P I just had to reinstall my disto, so the settings are pretty much the same as the defaults. ignore-window-parameters is nil
    – user189728
    Feb 18 '19 at 16:49

Start Emacs using emacs -Q. That ignores your init file.

I think you'll see then that delete-window (bound to C-x 0) does not kill any buffer.

If so then you must be inflicting this pain on yourself. As the good doctor said, "Don't do that." ;-)

Recursively bisect your init file to find the culprit. You can use command comment-region to comment (or, with C-u) uncomment the region. Comment out 1/2 of your init file, then 3/4, 7/8, 15/16,... to narrow and find the problem. This is very quick (it's a binary search), but you will need to restart Emacs each time.

(Another possibility is that the buffer has not been killed but you think it has. Try C-x C-b to see if it's still there.)

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.