Make sure my/kill-some-buffers asks about all buffers on tty frames

This commit is contained in:
Alexander Rosenberg 2024-11-04 13:41:54 -08:00
parent 2ef42f86dc
commit ac07328aca
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

12
init.el
View File

@ -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 ;; we already ask, no need to do it again
(let ((kill-buffer-query-functions nil) (let ((kill-buffer-query-functions nil)
(all-action (when auto-unmod 'unmod)) (all-action (when auto-unmod 'unmod))
(ask-again-buffers)) (ask-again-buffers)
(to-kill))
(cl-flet ((ask-about (buffer allow-unmod) (cl-flet ((ask-about (buffer allow-unmod)
(unless all-action (unless all-action
(read-answer (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) (when (buffer-file-name buffer)
(with-current-buffer buffer (with-current-buffer buffer
(save-buffer))) (save-buffer)))
(kill-buffer buffer)) (push buffer to-kill))
((equal ans "nosave") ((equal ans "nosave")
(with-current-buffer buffer (with-current-buffer buffer
(set-buffer-modified-p nil)) (set-buffer-modified-p nil))
(kill-buffer buffer)) (push buffer to-kill))
;; Skip buffer ;; Skip buffer
;; ((equal ans "no")) ;; ((equal ans "no"))
((equal ans "quit") ((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))) (act-on (ask-about buffer t) buffer t)))
(setq all-action nil) (setq all-action nil)
(dolist (buffer ask-again-buffers) (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) (keymap-global-set "C-x K" 'my/kill-some-buffers)
(use-package tab-bar (use-package tab-bar