GNU bug report logs -
#76248
[Feature Request] user-option for killing buffer in `quit-window'.
Previous Next
Full log
View this message in rfc822 format
> I attach a patch that could simplify that.
Thanks.
> +(defcustom quit-window-kill-buffer-modes nil
> + "List of major modes telling `quit-window' to kill WINDOW's buffer.
> +If non-nil, this should be a list of major modes. `quit-window' will
> +kill the buffer of its WINDOW argument when that buffer's major mode is
> +a member of this list regardless of the value of the KILL argument."
> + :type '(repeat (symbol :tag "Major mode"))
> + :version "31.1"
> + :group 'windows)
It would be nice to support the value t as a shortcut that means all modes.
Then the name could be just 'quit-window-kill-buffer' for symmetry with
'kill-buffer-quit-windows'.
> + (let (kill-from-mode)
> + (with-current-buffer (window-buffer (window-normalize-window window))
> + (run-hooks 'quit-window-hook)
> +
> + (setq kill-from-mode (memq major-mode quit-window-kill-buffer-modes)))
> +
> + (quit-restore-window
> + window (if (or kill kill-from-mode) 'kill 'bury))))
Wouldn't it be better to check for derived modes with 'derived-mode-p'?
Then it's possible to detect all modes inheriting from special-mode,
e.g. (derived-mode-p '(special-mode)).
> Maybe its handling should go to 'quit-restore-window' itself.
> Or we should have 'quit-windows-on' handle it too.
> Then what about 'delete-windows-on'?
Not sure about other functions.
This bug report was last modified 208 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.