Subject: bug#79065: 31.0.50; [PATCH] Allow inverting the meaning of 'quit-window-kill-buffer'

From: Jim Porter <[email-masked]>
Date: Mon, 28 Jul 2025 11:56:26 -0700

On 7/28/2025 12:18 AM, martin rudalics via Bug reports for GNU Emacs, 
the Swiss army knife of text editors wrote:
> The problem with 'quit-window-kill-buffer' is that it also can be a list
> of major modes.  What should 'invert' or 'xor' with or without a prefix
> argument produce in such a case?  Kill the buffer if it is a member of
> that list, kill it if it not a member of that list ...

My reasoning was that the prefix argument means, "Do the opposite of 
what quit-window' would otherwise do." (Hence the name 'invert'.)

However, another way to do this would be a tri-state:

* no prefix: obey 'quit-window-kill-buffer'
* C-u: always kill
* C--: always bury

This avoids the 'invert' symbol entirely, and also avoids the additional 
mental complexity of trying to predict what will happen when using the 
prefix argument while 'quit-window-kill-buffer' is a list. (That 
complexity is still there to a degree even without the prefix arg, but 
it might be clearer for users to have a way of saying, "I want this 
behavior," rather than just, "I want the opposite of the default.")

The above tri-state is something I do fairly often in my own Emacs 
config, though I'm not sure how common it is in Emacs itself. In this 
scheme, C-u means (very roughly) to do something "more" (e.g. more 
strongly), and C-- means the opposite: to do something "less", or in a 
diminished way. Since "C-u quit-window" in Emacs 30 is a stronger form 
of the default (quit the window *and* kill the buffer), "C-- 
quit-window" could mean the weaker form (quit the window and *never* 
kill the buffer).

 From my PoV, I'd be happy with this scheme or the one I originally 
proposed. It would just involve relearning a bit of muscle memory.