commit 4f739b94e20aa4bbb0d960a980432bb0be27a0b2
Author: Simon Watson <spw01@protonmail.com>
Date: Sat Feb 12 09:58:14 2022 -0500
Add handling for closing all magit buffers
diff --git a/emacs/.emacs-all b/emacs/.emacs-all
index 6e8175b..c701780 100644
--- a/emacs/.emacs-all
+++ b/emacs/.emacs-all
@@ -185,6 +185,8 @@
(load-theme 'solarized-light))
;; Keybinds/macros
+;;(global-set-key (kbd "C-c C-q") #'mu-magit-kill-buffers magit-status-mode-map)
+(global-set-key (kbd "C-c C-q") #'mu-magit-kill-buffers)
(global-set-key (kbd "C-c ;") 'comment-line)
(global-set-key (kbd "C-c b") 'fzf-switch-buffer)
(global-set-key (kbd "C-c z") 'fzf-find-file)
diff --git a/emacs/elisp/helpers.el b/emacs/elisp/helpers.el
index 975ec3e..7a67179 100644
--- a/emacs/elisp/helpers.el
+++ b/emacs/elisp/helpers.el
@@ -2,3 +2,13 @@
(interactive)
"Little helper for showing full file path in minibuffer"
(message (buffer-file-name)))
+
+;;; See great post here:
+;;; https://www.manueluberti.eu/emacs/2018/02/17/magit-bury-buffer/
+
+(defun mu-magit-kill-buffers ()
+ "Restore window configuration and kill all Magit buffers."
+ (interactive)
+ (let ((buffers (magit-mode-get-buffers)))
+ (magit-restore-window-configuration)
+ (mapc #'kill-buffer buffers)))