From ac07328aca27e0f05104b79c9eb390521bb4fc1c Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Mon, 4 Nov 2024 13:41:54 -0800 Subject: [PATCH] Make sure my/kill-some-buffers asks about all buffers on tty frames --- init.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/init.el b/init.el index bb82297..7289b5d 100644 --- a/init.el +++ b/init.el @@ -269,7 +269,8 @@ PRED is nil, the value of `my/kill-some-buffers-default-pred' is used." ;; we already ask, no need to do it again (let ((kill-buffer-query-functions nil) (all-action (when auto-unmod 'unmod)) - (ask-again-buffers)) + (ask-again-buffers) + (to-kill)) (cl-flet ((ask-about (buffer allow-unmod) (unless all-action (read-answer @@ -299,11 +300,11 @@ PRED is nil, the value of `my/kill-some-buffers-default-pred' is used." (when (buffer-file-name buffer) (with-current-buffer buffer (save-buffer))) - (kill-buffer buffer)) + (push buffer to-kill)) ((equal ans "nosave") (with-current-buffer buffer (set-buffer-modified-p nil)) - (kill-buffer buffer)) + (push buffer to-kill)) ;; Skip buffer ;; ((equal ans "no")) ((equal ans "quit") @@ -314,7 +315,10 @@ PRED is nil, the value of `my/kill-some-buffers-default-pred' is used." (act-on (ask-about buffer t) buffer t))) (setq all-action nil) (dolist (buffer ask-again-buffers) - (act-on (ask-about buffer nil) buffer nil))))) + (act-on (ask-about buffer nil) buffer nil)) + ;; Do this last so that tty frames don't auto-close half way through + (dolist (buffer to-kill) + (kill-buffer buffer))))) (keymap-global-set "C-x K" 'my/kill-some-buffers) (use-package tab-bar