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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 21 Jul 2025 14:57:10 +0300

> Cc: [email-masked]
> Date: Sun, 20 Jul 2025 22:22:53 -0700
> From: Jim Porter <[email-masked]>
> 
> +If @var{kill} is the special value @code{invert}, or when calling
> +interactively with the prefix argument, then @code{quit-window} inverts
> +the meaning of @code{quit-window-kill-buffer}, so that when it would
> +normally kill the buffer, it buries it instead, and vice versa.

'invert' is a problematic symbol for this purpose, because it doesn't
tell what will happen.  I prefer to use 2 symbols with explicit names,
'kill' and 'bury', instead, and have the prefix argument compute the
value by looking at the value of quit-window-kill-buffer.  This way, a
Lisp program will tell explicitly what it does, and interactive usage
still "inverts" the value of the option.

>  (defun quit-window (&optional kill window)
>    "Quit WINDOW and bury its buffer.
> -WINDOW must be a live window and defaults to the selected one.
> -With prefix argument KILL non-nil, kill the buffer instead of
> -burying it.
> +WINDOW must be a live window and defaults to the selected one.  Kill the
> +buffer instead according to `quit-window-kill-buffer' (which see).
> +
> +If KILL is `invert' (interactively, with the prefix argument), then

When you mention literal symbols in doc strings, please use

  If KILL is the symbol `invert', ....

This prevents Emacs from accidentally creating a false link leading
nowhere relevant.