Skip to content

Instantly share code, notes, and snippets.

@idcrook
Created June 13, 2018 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idcrook/6011fc29204b920ec00fc69be778d9dc to your computer and use it in GitHub Desktop.
Save idcrook/6011fc29204b920ec00fc69be778d9dc to your computer and use it in GitHub Desktop.
Emacs magit-status kill associated buffers (instead of just burying)
;; based on http://manuel-uberti.github.io/emacs/2018/02/17/magit-bury-buffer/
;; had to deviate from it since:
;; 1. the post's key bind code did not work for me
;; 2. added late loading, otherwise magit-status-mode-map undefined
;; 3. 'q' was already bound by magit, so use 'Q' instead of rebinding
(defun idc-magit-kill-buffers ()
"Restore window configuration and kill all (of these) Magit buffers."
(interactive)
(let ((buffers (magit-mode-get-buffers)))
(magit-restore-window-configuration)
(mapc #'kill-buffer buffers)))
(eval-after-load "magit"
'(define-key magit-status-mode-map (kbd "Q") #'idc-magit-kill-buffers))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment