Delete buffers when frame is closed

This commit is contained in:
Alexander Bantyev 2022-01-23 19:39:11 +03:00
parent 1fc803a736
commit 8c9ae75829
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5

View File

@ -228,6 +228,18 @@ nothing happens."
(add-hook 'after-save-hook 'compile-on-save-start nil t)) (add-hook 'after-save-hook 'compile-on-save-start nil t))
(kill-local-variable 'after-save-hook))) (kill-local-variable 'after-save-hook)))
(defun maybe-delete-frame-buffer (frame)
"When a dedicated FRAME is deleted, also kill its buffer.
A dedicated frame contains a single window whose buffer is not
displayed anywhere else."
(let ((windows (window-list frame)))
(when (eq 1 (length windows))
(let ((buffer (window-buffer (car windows))))
(when (eq 1 (length (get-buffer-window-list buffer nil t)))
(kill-buffer buffer))))))
(add-to-list 'delete-frame-functions #'maybe-delete-frame-buffer)
(require 'base16-theme) (require 'base16-theme)
(defvar base16-generated-colors (defvar base16-generated-colors